void wxNotebook::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); size_t cnt = m_pagesData.GetCount(); for (size_t i = 0; i < cnt; i++) gtk_widget_modify_style(GTK_WIDGET(GetNotebookPage(i)->m_label), style); }
void wxComboBox::DoApplyWidgetStyle(GtkRcStyle *style) { // gtk_widget_modify_style( GTK_COMBO(m_widget)->button, syle ); gtk_widget_modify_style( GTK_COMBO(m_widget)->entry, style ); gtk_widget_modify_style( GTK_COMBO(m_widget)->list, style ); GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); GList *child = list->children; #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ while (child) { gtk_widget_modify_style( GTK_WIDGET(child->data), style ); GtkBin *bin = GTK_BIN(child->data); gtk_widget_modify_style( bin->child, style ); child = child->next; } }
void wxComboBox::DoApplyWidgetStyle(GtkRcStyle *style) { #ifdef __WXGTK24__ if (!gtk_check_version(2,4,0)) { // Do nothing } else #endif { // gtk_widget_modify_style( GTK_COMBO(m_widget)->button, syle ); gtk_widget_modify_style( GTK_COMBO(m_widget)->entry, style ); gtk_widget_modify_style( GTK_COMBO(m_widget)->list, style ); GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); GList *child = list->children; while (child) { gtk_widget_modify_style( GTK_WIDGET(child->data), style ); GtkBin *bin = GTK_BIN(child->data); gtk_widget_modify_style( bin->child, style ); child = child->next; } } }
//===================================================================== int GUI_entry_styl (MemObj *o_par, int imod) { //===================================================================== /// \code /// GUI_entry_styl modify frame of entry; /// imod 0=GUI_STYL_normal=default_frame; 1=GUI_STYL_activ=red_frame. /// \endcode // see GUI_button_styl static GtkRcStyle *styl0 = NULL, *styl1; int pTyp, i1; Obj_Unknown *go; GUI_obj_typ (&pTyp, (void**)&go, o_par); if(!pTyp) return (-1); if(!styl0) { styl0 = gtk_rc_style_new (); styl0->color_flags[GTK_STATE_NORMAL] = GTK_RC_BASE; gdk_color_parse ("gray90", &styl0->base[0]); styl1 = gtk_rc_style_new (); styl1->color_flags[GTK_STATE_NORMAL] = GTK_RC_BASE; gdk_color_parse ("white", &styl1->base[0]); // from X11 rgb.txt file } // gtk_widget_set_can_focus(go->widget, TRUE); // gtk_widget_set_can_default (go->widget, TRUE); // gtk_entry_set_has_frame (GTK_ENTRY(go->widget), TRUE); if(imod < 1) { // GUI_STYL_normal gtk_widget_modify_style (go->widget, styl0); // gtk_widget_modify_bg (go->widget, GTK_STATE_NORMAL, &col1); // gtk_entry_set_has_frame (GTK_ENTRY(go->widget), FALSE); // i1 = GTK_SHADOW_IN; // i1 = GTK_SHADOW_ETCHED_IN; // g_object_set (G_OBJECT(go->widget),"shadow-type", i1, NULL); // gtk_widget_restore_default_style (go->widget); } else { // GUI_STYL_activ gtk_widget_modify_style (go->widget, styl1); // gtk_entry_set_has_frame (GTK_ENTRY(go->widget), TRUE); // gtk_widget_grab_focus (go->widget); // gtk_widget_has_default (go->widget); // gtk_entry_set_has_frame (GTK_ENTRY(go->widget), TRUE); // i1 = GTK_SHADOW_ETCHED_OUT; // i1 = GTK_SHADOW_OUT; // i1 = GTK_SHADOW_ETCHED_OUT; // g_object_set (G_OBJECT(go->widget),"shadow-type", i1, NULL); // gtk_widget_set_style (go->widget, UI_stylTab[iCol]); } return 0; }
void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); #ifdef __WXGTK20__ gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style); #endif }
void wxListBox::DoApplyWidgetStyle(GtkRcStyle *style) { if (m_hasBgCol && m_backgroundColour.Ok()) { GdkWindow *window = GTK_WIDGET(m_list)->window; if ( window ) { m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_clear( window ); } } GList *child = m_list->children; while (child) { gtk_widget_modify_style( GTK_WIDGET(child->data), style ); GtkBin *bin = GTK_BIN( child->data ); GtkWidget *label = GTK_WIDGET( bin->child ); gtk_widget_modify_style( label, style ); child = child->next; } }
void applet_back_change (MyPanelApplet *a, MyPanelAppletBackgroundType type, GdkColor *color, GdkPixmap *pixmap, streamer_applet *applet) { // taken from the TrashApplet GtkRcStyle *rc_style; GtkStyle *style; // reset style gtk_widget_set_style (GTK_WIDGET(applet->applet), NULL); gtk_widget_set_style (GTK_WIDGET(applet->event_box), NULL); rc_style = gtk_rc_style_new (); gtk_widget_modify_style (GTK_WIDGET(applet->applet), rc_style); gtk_widget_modify_style (GTK_WIDGET(applet->event_box), rc_style); g_object_unref (rc_style); switch (type) { case PANEL_COLOR_BACKGROUND: gtk_widget_modify_bg (GTK_WIDGET(applet->applet), GTK_STATE_NORMAL, color); gtk_widget_modify_bg (GTK_WIDGET(applet->event_box), GTK_STATE_NORMAL, color); break; case PANEL_PIXMAP_BACKGROUND: style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET(applet->applet))); if (style->bg_pixmap[GTK_STATE_NORMAL]) g_object_unref (style->bg_pixmap[GTK_STATE_NORMAL]); style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref(pixmap); gtk_widget_set_style (GTK_WIDGET(applet->applet), style); gtk_widget_set_style (GTK_WIDGET(applet->event_box), style); g_object_unref (style); break; case PANEL_NO_BACKGROUND: default: break; } }
int wxComboBox::DoAppend( const wxString &item ) { wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") ); #ifdef __WXGTK24__ if (!gtk_check_version(2,4,0)) { GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); gtk_combo_box_append_text( combobox, wxGTK_CONV( item ) ); } else #endif { DisableEvents(); GtkWidget *list = GTK_COMBO(m_widget)->list; GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( item ) ); gtk_container_add( GTK_CONTAINER(list), list_item ); if (GTK_WIDGET_REALIZED(m_widget)) { gtk_widget_realize( list_item ); gtk_widget_realize( GTK_BIN(list_item)->child ); } // Apply current widget style to the new list_item GtkRcStyle *style = CreateWidgetStyle(); if (style) { gtk_widget_modify_style( GTK_WIDGET( list_item ), style ); GtkBin *bin = GTK_BIN( list_item ); GtkWidget *label = GTK_WIDGET( bin->child ); gtk_widget_modify_style( label, style ); gtk_rc_style_unref( style ); } gtk_widget_show( list_item ); EnableEvents(); } const unsigned int count = GetCount(); if ( m_clientDataList.GetCount() < count ) m_clientDataList.Append( (wxObject*) NULL ); if ( m_clientObjectList.GetCount() < count ) m_clientObjectList.Append( (wxObject*) NULL ); InvalidateBestSize(); return count - 1; }
void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style) { GTKFrameApplyWidgetStyle(GTK_FRAME(m_widget), style); wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst(); while (node) { GtkWidget *widget = GTK_WIDGET( node->GetData()->button ); gtk_widget_modify_style( widget, style ); gtk_widget_modify_style(GTK_BIN(widget)->child, style); node = node->GetNext(); } }
void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style( m_widget, style ); wxList::compatibility_iterator node = m_boxes.GetFirst(); while (node) { GtkWidget *widget = GTK_WIDGET( node->GetData() ); gtk_widget_modify_style( widget, style ); gtk_widget_modify_style( BUTTON_CHILD(node->GetData()), style ); node = node->GetNext(); } }
/* * Change font used to display log text, NULL means reset to default */ void GTK_change_log_font(gchar *fontname) { #if 0 // old GTK GtkRcStyle *rcstyle = gtk_rc_style_new(); #else GtkStyle *rcstyle = gtk_style_new(); #endif // if (GTK_OBJECT(v9t9_command_log)->flags & GTK_DESTROYED) {//2.0 if (!v9t9_command_log) { g_free(rcstyle); return; } if (fontname && *fontname) { #if 0 // old GTK rcstyle->font_name = fontname; gtk_widget_modify_style(v9t9_command_log, rcstyle); #else gtk_style_set_font(rcstyle, gdk_font_load(fontname)); gtk_widget_set_style(v9t9_command_log, rcstyle); #endif } else { // this is probably too harsh for a cancel gtk_widget_restore_default_style(v9t9_command_log); } // g_free(rcstyle); }
void make_cancel_button(GtkWidget *fixed_base) { GtkWidget *fixed; GtkWidget *event_box; GtkWidget *label; fixed = fixed_base; label = gtk_label_new(cancel_text); gtk_widget_set_size_request(label, cancel_label_width, cancel_label_height); gtk_widget_show(label); GdkColor white = {0, 65535, 65535, 65535}; GtkRcStyle *rc_style = gtk_rc_style_new (); rc_style->fg[GTK_STATE_NORMAL] = white; rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG; gtk_widget_modify_style(label, rc_style); gtk_rc_style_unref(rc_style); event_box = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(event_box), label); gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE); gtk_widget_show(event_box); g_signal_connect(G_OBJECT(event_box), "enter_notify_event", G_CALLBACK(cancel_enter), NULL); g_signal_connect(G_OBJECT(event_box), "leave_notify_event", G_CALLBACK(cancel_leave), NULL); g_signal_connect(G_OBJECT(event_box), "button_press_event", G_CALLBACK(cancel_press), NULL); gtk_widget_show(event_box); gtk_fixed_put(GTK_FIXED(fixed), event_box, cancel_label_pos_x, cancel_label_pos_y); }
static void SetStyle( GtkWidget *widget, char *str) { int i; GtkRcStyle *rc_style; GtkStyle *style; style = GetStyle(str); if (style != NULL) { rc_style = gtk_widget_get_modifier_style(widget); for(i = GTK_STATE_NORMAL ; i <= GTK_STATE_INSENSITIVE; i++) { rc_style->fg[i] = style->fg[i]; rc_style->bg[i] = style->bg[i]; rc_style->text[i] = style->text[i]; rc_style->base[i] = style->base[i]; rc_style->color_flags[i] = GTK_RC_FG | GTK_RC_BG | GTK_RC_TEXT | GTK_RC_BASE; } gtk_widget_modify_style(widget, rc_style); if (GTK_IS_CONTAINER(widget)){ gtk_container_foreach(GTK_CONTAINER(widget), (GtkCallback)SetStyle,str); } } }
GtkWidget * create_welcome_dialog(void) { I7App *theapp = i7_app_get(); GFile *file = i7_app_get_data_file_va(theapp, "ui", "welcomedialog.ui", NULL); GtkBuilder *builder = create_new_builder(file, theapp); g_object_unref(file); GtkWidget *retval = GTK_WIDGET(load_object(builder, "welcomedialog")); /* Set the background pixmap for this window */ GtkRcStyle *newstyle = gtk_widget_get_modifier_style(retval); file = i7_app_get_data_file_va(theapp, "Resources", "Welcome Background.png", NULL); newstyle->bg_pixmap_name[GTK_STATE_NORMAL] = g_file_get_path(file); /* take ownership */ g_object_unref(file); gtk_widget_modify_style(retval, newstyle); /* Set the font size to 12 pixels for the widgets in this window */ PangoFontDescription *font = pango_font_description_new(); pango_font_description_set_absolute_size(font, 12.0 * PANGO_SCALE); gtk_widget_modify_font(GTK_WIDGET(load_object(builder, "welcome_label")), font); pango_font_description_free(font); /* If there is no "last project", make the reopen button inactive */ GFile *last_project = i7_app_get_last_opened_project(theapp); if(last_project) { gtk_widget_set_sensitive(GTK_WIDGET(load_object(builder, "welcome_reopen_button")), TRUE); g_object_unref(last_project); } g_object_unref(builder); return retval; }
/* AW: I pulled this code off the interwebs. It makes background * transparency actually work */ void change_bg(PanelApplet *applet, PanelAppletBackgroundType type, GdkColor *color, GdkPixmap *pixmap) { GtkRcStyle *rc_style; GtkStyle *style; /* reset style */ gtk_widget_set_style(GTK_WIDGET(applet), NULL); rc_style = gtk_rc_style_new(); gtk_widget_modify_style(GTK_WIDGET(applet), rc_style); gtk_rc_style_unref(rc_style); switch(type) { case PANEL_NO_BACKGROUND: break; case PANEL_COLOR_BACKGROUND: gtk_widget_modify_bg(GTK_WIDGET(applet), GTK_STATE_NORMAL, color); break; case PANEL_PIXMAP_BACKGROUND: style = gtk_style_copy(GTK_WIDGET(applet)->style); if(style->bg_pixmap[GTK_STATE_NORMAL]) g_object_unref(style->bg_pixmap[GTK_STATE_NORMAL]); style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref(pixmap); gtk_widget_set_style(GTK_WIDGET(applet), style); g_object_unref(style); break; } }
void tabmanagergui_create_label (GuTabPage* tp, gchar* labeltext) { static unsigned count = 0; GtkRcStyle* rcstyle = NULL; GtkWidget* image = NULL; GtkHBox* hbox; tp->labelbox = gtk_event_box_new (); hbox = GTK_HBOX (gtk_hbox_new (FALSE, 0)); tp->unsavednr = ++count; gtk_event_box_set_visible_window (GTK_EVENT_BOX (tp->labelbox), FALSE); gtk_container_add (GTK_CONTAINER(tp->labelbox), GTK_WIDGET (hbox)); tp->label = GTK_LABEL (gtk_label_new (labeltext)); gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (tp->label), TRUE, TRUE, 5); tp->button = GTK_BUTTON (gtk_button_new()); image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); gtk_button_set_image (tp->button, image); g_object_set (tp->button, "relief", GTK_RELIEF_NONE, "focus-on-click", FALSE, NULL); gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (tp->button), FALSE,FALSE,0); rcstyle = gtk_rc_style_new (); rcstyle->xthickness = rcstyle->ythickness = 0; gtk_widget_modify_style (GTK_WIDGET (tp->button), rcstyle); g_object_unref (rcstyle); gtk_widget_show_all (GTK_WIDGET (hbox)); }
void wxInfoBar::DoApplyWidgetStyle(GtkRcStyle *style) { wxInfoBarGeneric::DoApplyWidgetStyle(style); if ( UseNative() ) gtk_widget_modify_style(m_impl->m_label, style); }
static void gimp_number_pair_entry_modify_font (GimpNumberPairEntry *entry, gboolean italic) { GimpNumberPairEntryPrivate *priv = GIMP_NUMBER_PAIR_ENTRY_GET_PRIVATE (entry); GtkRcStyle *rc_style; if (priv->font_italic == italic) return; rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (entry)); if (! rc_style->font_desc) { PangoContext *context; PangoFontDescription *font_desc; context = gtk_widget_get_pango_context (GTK_WIDGET (entry)); font_desc = pango_context_get_font_description (context); rc_style->font_desc = pango_font_description_copy (font_desc); } pango_font_description_set_style (rc_style->font_desc, italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL); gtk_widget_modify_style (GTK_WIDGET (entry), rc_style); priv->font_italic = italic; }
/* Create a new tab. */ LXTab * lxterminal_tab_label_new(const gchar * str) { /* Allocate LXTab structure. */ LXTab * tab = g_slice_new0(LXTab); /* Create a horizontal box as the toplevel. */ tab->main = gtk_hbox_new(FALSE, 4); /* Create the Close button. */ tab->close_btn = gtk_button_new(); gtk_button_set_relief(GTK_BUTTON(tab->close_btn), GTK_RELIEF_NONE); gtk_button_set_focus_on_click(GTK_BUTTON(tab->close_btn), FALSE); gtk_container_add(GTK_CONTAINER(tab->close_btn), gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU)); /* Make the button as small as possible. */ GtkRcStyle * rcstyle = gtk_rc_style_new(); rcstyle->xthickness = rcstyle->ythickness = 0; gtk_widget_modify_style(tab->close_btn, rcstyle); gtk_rc_style_unref(rcstyle), /* Create the label. */ tab->label = gtk_label_new(str); gtk_widget_set_size_request(GTK_WIDGET(tab->label), 100, -1); gtk_label_set_ellipsize(GTK_LABEL(tab->label), PANGO_ELLIPSIZE_END); gtk_misc_set_alignment(GTK_MISC(tab->label), 0.0, 0.5); gtk_misc_set_padding(GTK_MISC(tab->label), 0, 0); /* Pack everything, show the widget and return. */ gtk_box_pack_start(GTK_BOX(tab->main), tab->label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tab->main), tab->close_btn, FALSE, FALSE, 0); gtk_widget_show_all(tab->main); return tab; }
static VALUE rg_modify_style(VALUE self, VALUE style) { gtk_widget_modify_style(_SELF(self), GTK_RC_STYLE(RVAL2GOBJ(style))); return self; }
static void gimp_scale_combo_box_style_set (GtkWidget *widget, GtkStyle *prev_style) { GtkWidget *entry; GtkRcStyle *rc_style; gint font_size; gdouble scale; GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style); gtk_widget_style_get (widget, "label-scale", &scale, NULL); entry = gtk_bin_get_child (GTK_BIN (widget)); rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (entry)); if (! rc_style->font_desc) { PangoContext *context; PangoFontDescription *font_desc; context = gtk_widget_get_pango_context (widget); font_desc = pango_context_get_font_description (context); rc_style->font_desc = pango_font_description_copy (font_desc); } font_size = pango_font_description_get_size (rc_style->font_desc); pango_font_description_set_size (rc_style->font_desc, scale * font_size); gtk_widget_modify_style (GTK_WIDGET (entry), rc_style); }
void setup_sload(t_sload *sload) { GtkRcStyle *rc; gtk_widget_hide(sload->label); gtk_label_set_text(GTK_LABEL(sload->label), sload->options.label_text); if (sload->options.use_label) { gtk_widget_show(sload->label); } gtk_widget_hide(GTK_WIDGET(sload->status)); rc = gtk_widget_get_modifier_style(GTK_WIDGET(sload->status)); if (!rc) { rc = gtk_rc_style_new(); } if (rc) { rc->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG; rc->bg[GTK_STATE_PRELIGHT] = sload->options.color; } gtk_widget_modify_style(GTK_WIDGET(sload->status), rc); gtk_widget_show(GTK_WIDGET(sload->status)); }
void wxNotebook::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); size_t cnt = m_pagesData.GetCount(); #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for (size_t i = 0; i < cnt; i++) gtk_widget_modify_style(GTK_WIDGET(GetNotebookPage(i)->m_label), style); }
static void setup_monitor(t_global_monitor *global) { GtkRcStyle *rc; gint i; gtk_widget_hide(GTK_WIDGET(global->monitor->ebox)); gtk_widget_hide(global->monitor->label); gtk_label_set_text(GTK_LABEL(global->monitor->label), global->monitor->options.label_text); for (i = 0; i < SUM; i++) { gtk_widget_hide(GTK_WIDGET(global->monitor->status[i])); rc = gtk_widget_get_modifier_style(GTK_WIDGET(global->monitor->status[i])); if (!rc) { rc = gtk_rc_style_new(); } else { rc->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG; rc->bg[GTK_STATE_PRELIGHT] = global->monitor->options.color[i]; } gtk_widget_modify_style(GTK_WIDGET(global->monitor->status[i]), rc); gtk_widget_show(GTK_WIDGET(global->monitor->status[i])); /* Maximum */ if( global->monitor->options.auto_max ) { global->monitor->net_max[i] = INIT_MAX; } else { global->monitor->net_max[i] = global->monitor->options.max[i]; } } gtk_widget_show(GTK_WIDGET(global->monitor->ebox)); if (global->monitor->options.use_label) { gtk_widget_show(global->monitor->label); } if (!strcmp(global->monitor->options.network_device, global->monitor->options.old_network_device) == 0) { init_netload( &(global->monitor->data), global->monitor->options.network_device); if (global->monitor->options.old_network_device) { g_free(global->monitor->options.old_network_device); } global->monitor->options.old_network_device = g_strdup(global->monitor->options.network_device); } run_update( global ); }
void wxComboBox::DoApplyWidgetStyle(GtkRcStyle *style) { // gtk_widget_modify_style( GTK_COMBO(m_widget)->button, syle ); gtk_widget_modify_style( GTK_COMBO(m_widget)->entry, style ); gtk_widget_modify_style( GTK_COMBO(m_widget)->list, style ); GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); GList *child = list->children; while (child) { gtk_widget_modify_style( GTK_WIDGET(child->data), style ); GtkBin *bin = GTK_BIN(child->data); gtk_widget_modify_style( bin->child, style ); child = child->next; } }
void wxButton::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); GtkWidget *child = GTK_BIN(m_widget)->child; gtk_widget_modify_style(child, style); // in gtk+ 2.12, in case of button with image, the path to the label is: // GtkButton -> GtkAlignment -> GtkHBox -> GtkLabel if (GTK_IS_ALIGNMENT (child)) { GtkWidget *box = GTK_BIN(child)->child; if (GTK_IS_BOX (box)) { for (GList* item = GTK_BOX(box)->children; item; item = item->next) { GtkBoxChild* boxChild = wx_static_cast(GtkBoxChild*, item->data); gtk_widget_modify_style(boxChild->widget, style); } } } }
void terminal_util_set_style_thinkess (GtkWidget *widget, gint thinkness) { GtkRcStyle *style; style = gtk_rc_style_new (); style->xthickness = style->ythickness = thinkness; gtk_widget_modify_style (widget, style); g_object_unref (G_OBJECT (style)); }
void wxButton::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); GtkWidget *child = GTK_BIN(m_widget)->child; gtk_widget_modify_style(child, style); // for buttons with images, the path to the label is (at least in 2.12) // GtkButton -> GtkAlignment -> GtkHBox -> GtkLabel if ( GTK_IS_ALIGNMENT(child) ) { GtkWidget *box = GTK_BIN(child)->child; if ( GTK_IS_BOX(box) ) { for (GList* item = GTK_BOX(box)->children; item; item = item->next) { GtkBoxChild* boxChild = static_cast<GtkBoxChild*>(item->data); gtk_widget_modify_style(boxChild->widget, style); } } } }
static void createTab(char *name) { logInfo("Creating IRC console tab '%s'", name); char *dupname = strdup(name); // vertical layout GtkWidget *vLayout = gtk_vbox_new(false, 1); // scroll GtkWidget *scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(vLayout), GTK_WIDGET(scroll)); GtkWidget *input = gtk_entry_new(); GtkRcStyle *style = gtk_widget_get_modifier_style(GTK_WIDGET(input)); PangoFontDescription *font = pango_font_description_from_string("Monospace Normal"); style->font_desc = font; gtk_widget_modify_style(GTK_WIDGET(input), style); gtk_container_add(GTK_CONTAINER(vLayout), GTK_WIDGET(input)); g_signal_connect(GTK_OBJECT(input), "activate", GTK_SIGNAL_FUNC(inputActivate), dupname); gtk_box_set_child_packing(GTK_BOX(vLayout), GTK_WIDGET(input), false, true, 0, GTK_PACK_END); // list GtkWidget *list = gtk_tree_view_new(); gtk_container_add(GTK_CONTAINER(scroll), GTK_WIDGET(list)); // list columns gtk_tree_view_append_column(GTK_TREE_VIEW(list), gtk_tree_view_column_new_with_attributes("Timestamp", gtk_cell_renderer_text_new(), "text", ROW_TIME, NULL)); GtkCellRenderer *renderer = gtk_cell_renderer_text_new(); GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes("Message", renderer, "text", ROW_MESSAGE, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(list), column); gtk_tree_view_column_set_cell_data_func(column, renderer, &formatMessageCell, NULL, NULL); // create store GtkListStore *store = gtk_list_store_new(N_ROWS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT); gtk_tree_view_set_model(GTK_TREE_VIEW(list), GTK_TREE_MODEL(store)); GtkWidget *title = gtk_label_new(name); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), GTK_WIDGET(vLayout), GTK_WIDGET(title)); IrcConsoleTab *tab = ALLOCATE_OBJECT(IrcConsoleTab); g_object_ref(G_OBJECT(list)); tab->lines = 0; tab->list = list; tab->store = store; g_hash_table_insert(tabs, dupname, tab); gtk_widget_show_all(GTK_WIDGET(notebook)); }
void wxButton::DoApplyWidgetStyle(GtkRcStyle *style) { gtk_widget_modify_style(m_widget, style); GtkWidget* child = gtk_bin_get_child(GTK_BIN(m_widget)); gtk_widget_modify_style(child, style); // for buttons with images, the path to the label is (at least in 2.12) // GtkButton -> GtkAlignment -> GtkHBox -> GtkLabel if ( GTK_IS_ALIGNMENT(child) ) { GtkWidget* box = gtk_bin_get_child(GTK_BIN(child)); if ( GTK_IS_BOX(box) ) { GList* list = gtk_container_get_children(GTK_CONTAINER(box)); for (GList* item = list; item; item = item->next) { gtk_widget_modify_style(GTK_WIDGET(item->data), style); } g_list_free(list); } } }