[cairo-commit] roadster/src tooltipwindow.c, NONE,
1.1 tooltipwindow.h, NONE, 1.1
Ian McIntosh
commit at pdx.freedesktop.org
Fri Sep 30 22:25:32 PDT 2005
- Previous message: [cairo-commit] roadster/src Makefile.am, 1.22, 1.23 downloader.c,
1.2, NONE downloader.h, 1.2, NONE downloadmanager.c, NONE,
1.1 downloadmanager.h, NONE, 1.1 glyph.c, 1.9, 1.10 glyph.h,
1.6, 1.7 gui.c, 1.14, 1.15 history.c, 1.4, NONE history.h, 1.2,
NONE main.c, 1.31, 1.32 mainwindow.c, 1.46, 1.47 map.c, 1.50,
1.51 map_draw_cairo.c, 1.26, 1.27 map_draw_gdk.c, 1.24,
1.25 map_history.c, NONE, 1.1 map_history.h, NONE,
1.1 map_style.c, 1.3, 1.4 tooltip.c, 1.6, NONE tooltip.h, 1.4,
NONE util.c, 1.13, 1.14 util.h, 1.13, 1.14 welcomewindow.c,
1.8, NONE welcomewindow.h, 1.2, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: ian
Update of /cvs/cairo/roadster/src
In directory gabe:/tmp/cvs-serv12485/src
Added Files:
tooltipwindow.c tooltipwindow.h
Log Message:
* Add src/tooltipwindow.c
--- NEW FILE: tooltipwindow.c ---
/***************************************************************************
* tooltip.c
*
* Copyright 2005 Ian McIntosh
* ian_mcintosh at linuxadvocate.org
****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <gtk/gtk.h>
#include "main.h"
#include "tooltipwindow.h"
static gboolean tooltip_on_mouse_motion(GtkWidget* w, GdkEventMotion *event);
tooltip_t* tooltip_new()
{
tooltip_t* pNew = g_new0(tooltip_t, 1);
// create tooltip window
pNew->pWindow = GTK_WINDOW(gtk_window_new(GTK_WINDOW_POPUP));
//gtk_widget_set_name(GTK_WIDGET(pNew->pWindow), "gtk-tooltips");
gtk_widget_add_events(GTK_WIDGET(pNew->pWindow), GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK);
g_signal_connect(G_OBJECT(pNew->pWindow), "motion_notify_event", G_CALLBACK(tooltip_on_mouse_motion), NULL);
gtk_window_set_resizable(pNew->pWindow, FALSE); // FALSE means window will resize to hug the label.
// create frame (draws the nice outline for us) and add to window (we don't need to keep a pointer to this)
GtkFrame* pFrame = GTK_FRAME(gtk_frame_new(NULL));
gtk_frame_set_shadow_type(pFrame, GTK_SHADOW_IN);
gtk_container_add(GTK_CONTAINER(pNew->pWindow), GTK_WIDGET(pFrame));
// create label and add to frame
pNew->pLabel = GTK_LABEL(gtk_label_new("testing"));
gtk_container_add(GTK_CONTAINER(pFrame), GTK_WIDGET(pNew->pLabel));
pNew->bEnabled = TRUE; // XXX: currently no API to disable it
return pNew;
}
void tooltip_set_markup(tooltip_t* pTooltip, const gchar* pszMarkup)
{
gtk_label_set_markup(pTooltip->pLabel, pszMarkup);
}
void tooltip_set_bg_color(tooltip_t* pTooltip, GdkColor* pColor)
{
gtk_widget_modify_bg(GTK_WIDGET(pTooltip->pWindow), GTK_STATE_NORMAL, pColor);
}
void tooltip_set_upper_left_corner(tooltip_t* pTooltip, gint nX, gint nY)
{
gtk_window_move(pTooltip->pWindow, nX, nY);
}
void tooltip_show(tooltip_t* pTooltip)
{
if(pTooltip->bEnabled) {
gtk_widget_show_all(GTK_WIDGET(pTooltip->pWindow));
}
}
void tooltip_hide(tooltip_t* pTooltip)
{
gtk_widget_hide(GTK_WIDGET(pTooltip->pWindow));
}
static gboolean tooltip_on_mouse_motion(GtkWidget* pWidget, GdkEventMotion *__unused)
{
// in case the mouse makes its way onto the tooltip, hide it.
gtk_widget_hide(pWidget);
}
--- NEW FILE: tooltipwindow.h ---
/***************************************************************************
* tooltip.h
*
* Copyright 2005 Ian McIntosh
* ian_mcintosh at linuxadvocate.org
****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _TOOLTIP_H
#define _TOOLTIP_H
typedef struct {
GtkWindow* pWindow;
GtkLabel* pLabel;
gboolean bEnabled;
} tooltip_t;
tooltip_t* tooltip_new();
void tooltip_set_markup(tooltip_t* pTooltip, const gchar* pszMarkup);
void tooltip_set_upper_left_corner(tooltip_t* pTooltip, gint nX, gint nY);
void tooltip_show(tooltip_t* pTooltip);
void tooltip_hide(tooltip_t* pTooltip);
void tooltip_set_bg_color(tooltip_t* pTooltip, GdkColor* pColor);
#endif
- Previous message: [cairo-commit] roadster/src Makefile.am, 1.22, 1.23 downloader.c,
1.2, NONE downloader.h, 1.2, NONE downloadmanager.c, NONE,
1.1 downloadmanager.h, NONE, 1.1 glyph.c, 1.9, 1.10 glyph.h,
1.6, 1.7 gui.c, 1.14, 1.15 history.c, 1.4, NONE history.h, 1.2,
NONE main.c, 1.31, 1.32 mainwindow.c, 1.46, 1.47 map.c, 1.50,
1.51 map_draw_cairo.c, 1.26, 1.27 map_draw_gdk.c, 1.24,
1.25 map_history.c, NONE, 1.1 map_history.h, NONE,
1.1 map_style.c, 1.3, 1.4 tooltip.c, 1.6, NONE tooltip.h, 1.4,
NONE util.c, 1.13, 1.14 util.h, 1.13, 1.14 welcomewindow.c,
1.8, NONE welcomewindow.h, 1.2, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list