25 #pragma warning( disable : 4005 4554)
32 #ifdef WIN32 // visual C++ doesn't support compound literals
37 void (*
func)(
void *arg1,
void *arg2);
40 #define BUTTONLABELSTRUCT(s,f,d) (labelFuncData){s,f,d}
41 #ifdef WIN32 // visual C++ doesn't support compound literals
42 #define BUTTONLABELSTRUCT(s,f,d) labelFuncData(s,f,d)
46 #define GDKPIXMAPCREATE(win, ref) gdk_pixmap_colormap_create_from_xpm_d(win->window,gtk_widget_get_colormap(win),NULL,NULL,ref)
48 #define GTKPIXMAPCREATE(pixGdk) (GtkPixmap*)gtk_image_new_from_pixmap(pixGdk, NULL)
53 #ifdef WIN32 // visual C++ doesn't support compound literals
57 void (*
func)(
void *arg1,
void *arg2);
60 #define BUTTONPIXMAPSTRUCT(p,f,d) (pixmapFuncData){p,f,d}
61 #ifdef WIN32 // visual C++ doesn't support compound literals
62 #define BUTTONPIXMAPSTRUCT(p,f,d) pixmapFuncData(p,f,d)
69 #ifdef WIN32 // visual C++ doesn't support compound literals
73 void (*
func)(
void *arg1,
void *arg2);
76 #define BUTTONPIXMAPSTRUCTTRANSPARENT(i,f,d) (pixmapFuncDataTransparent){i,f,d}
77 #ifdef WIN32 // visual C++ doesn't support compound literals
78 #define BUTTONPIXMAPSTRUCTTRANSPARENT(i,f,d) pixmapFuncDataTransparent(i,f,d)
85 #ifdef WIN32 // visual C++ doesn't support compound literals
89 void (*
func)(
void *arg1,
void *arg2);
92 #define BUTTONTOGGLESTRUCT(s,f,d) (toggleFuncData){s,f,d}
93 #ifdef WIN32 // visual C++ doesn't support compound literals
94 #define BUTTONTOGGLESTRUCT(s,f,d) toggleFuncData(s,f,d)
101 #ifdef WIN32 // visual C++ doesn't support compound literals
105 void (*
func)(
void *arg1,
void *arg2);
110 #define BUTTONARROWSTRUCT(f, d, a, sh) (arrowFuncData){f,d, a, sh}
111 #ifdef WIN32 // visual C++ doesn't support compound literals
112 #define BUTTONARROWSTRUCT(f,d,a,sh) arrowFuncData(f,d,a,sh)
119 #ifdef WIN32 // visual C++ doesn't support compound literals
123 void (*
func)(
void *arg1,
void *arg2);
126 #define BUTTONRADIOSTRUCT(s,f,d) (radioFuncData){s,f,d}
127 #ifdef WIN32 // visual C++ doesn't support compound literals
128 #define BUTTONRADIOSTRUCT(s,f,d) radioFuncData(s,f,d)
154 gdk_colormap_new(gdk_visual_get_best(),1);
163 gtk_button_set_alignment(GTK_BUTTON(
current()), xAlign, yAlign);
164 gtk_widget_queue_draw(
current());
174 gtk_button_get_alignment(GTK_BUTTON(
current()), xAlign, yAlign);
190 g_signal_connect_after(GTK_OBJECT((GtkButton*)
current()),
"released",GTK_SIGNAL_FUNC(nf.
func), nf.
data);
199 g_signal_handlers_disconnect_by_func(GTK_OBJECT((GtkButton*)
current()), (
void *)(nfOld.
func), nfOld.
data);
201 g_signal_connect(GTK_OBJECT((GtkButton*)
current()),
"released",GTK_SIGNAL_FUNC(nfNew.
func), nfNew.
data);
211 g_signal_handlers_disconnect_by_func(GTK_OBJECT((GtkButton*)
current()), (
void *)(nfOld.
func), nfOld.
data);
226 g_signal_connect(GTK_OBJECT((GtkButton*)
current()),
"released",GTK_SIGNAL_FUNC(nf.
func), nf.
data);
246 gtk_signal_connect(GTK_OBJECT(
current()),
"released",GTK_SIGNAL_FUNC(nf.
func), nf.
data);
258 gtk_signal_connect(GTK_OBJECT((GtkButton*)
current()),
"released",GTK_SIGNAL_FUNC(nf.
func), nf.
data);
273 g_signal_connect(GTK_OBJECT(
current()),
"released",GTK_SIGNAL_FUNC(pfdt.
func), pfdt.
data);
287 gtk_container_add (GTK_CONTAINER (
current()), arrow);
288 gtk_widget_show(arrow);
291 gtk_signal_connect(GTK_OBJECT((GtkButton*)
current()),
"released",GTK_SIGNAL_FUNC(af.
func), af.
data);
292 gtk_widget_show_all(
current());
307 gtk_signal_connect(GTK_OBJECT((GtkButton*)
current()),
"released",GTK_SIGNAL_FUNC(nf.
func), nf.
data);
320 static gboolean
exposePixmap(GtkWidget *widget, GdkEventExpose *event, gpointer data) {
321 GdkPixbuf *tipGDKPixBuf = gdk_pixbuf_new_from_xpm_data(static_cast<const char**>(data));
322 int width = gdk_pixbuf_get_width(tipGDKPixBuf), height = gdk_pixbuf_get_height(tipGDKPixBuf);
323 if ((widget->allocation.width<width) | (widget->allocation.height<height))
324 gtk_widget_set_size_request(widget, width, height);
326 cairo_t *cr=gdk_cairo_create(widget->window);
329 float xAlign, yAlign;
330 gtk_button_get_alignment(GTK_BUTTON(widget), &xAlign, &yAlign);
331 int xOffset=(
int)((
float)(widget->allocation.width-width-1)*xAlign);
if (xOffset<0) xOffset=0;
332 int yOffset=(
int)((
float)(widget->allocation.height-height-1)*yAlign);
if (yOffset<0) yOffset=0;
334 gdk_cairo_set_source_pixbuf(cr, tipGDKPixBuf, widget->allocation.x+xOffset, widget->allocation.y+yOffset);
353 if (pangoFontDescription){
354 GtkWidget *child=gtk_bin_get_child(GTK_BIN(
current()));
356 gtk_widget_modify_font(child,pangoFontDescription);
386 GtkWidget *retVal=NULL;