| 126 #endif |
126 #endif |
| 127 } |
127 } |
| 128 |
128 |
| 129 void add_toolitem_widget(GtkToolbar *tb, UiToolbarItem *item, UiObject *obj) { |
129 void add_toolitem_widget(GtkToolbar *tb, UiToolbarItem *item, UiObject *obj) { |
| 130 GtkToolItem *button; |
130 GtkToolItem *button; |
| 131 if(item->args.stockid) { |
131 button = gtk_tool_button_new(NULL, item->args.label); |
| 132 #ifdef UI_GTK2 |
|
| 133 button = gtk_tool_button_new_from_stock(item->args.stockid); |
|
| 134 #else |
|
| 135 // TODO: gtk3 stock |
|
| 136 button = gtk_tool_button_new(NULL, item->args.label); |
|
| 137 #endif |
|
| 138 } else { |
|
| 139 button = gtk_tool_button_new(NULL, item->args.label); |
|
| 140 } |
|
| 141 if(item->args.tooltip) { |
132 if(item->args.tooltip) { |
| 142 gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), item->args.tooltip); |
133 gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), item->args.tooltip); |
| 143 } |
134 } |
| 144 |
135 |
| 145 gtk_tool_item_set_homogeneous(button, FALSE); |
136 gtk_tool_item_set_homogeneous(button, FALSE); |
| 177 */ |
168 */ |
| 178 } |
169 } |
| 179 |
170 |
| 180 void add_toolitem_toggle_widget(GtkToolbar *tb, UiToolbarToggleItem *item, UiObject *obj) { |
171 void add_toolitem_toggle_widget(GtkToolbar *tb, UiToolbarToggleItem *item, UiObject *obj) { |
| 181 GtkToolItem *button; |
172 GtkToolItem *button; |
| 182 if(item->args.stockid) { |
173 button = gtk_toggle_tool_button_new(); |
| 183 #ifdef UI_GTK2 |
174 gtk_tool_item_set_homogeneous(button, FALSE); |
| 184 button = gtk_toggle_tool_button_new_from_stock(item->args.stockid); |
175 if(item->args.label) { |
| 185 #else |
176 gtk_tool_button_set_label(GTK_TOOL_BUTTON(button), item->args.label); |
| 186 button = gtk_toggle_tool_button_new_from_stock(item->args.stockid); // TODO: gtk3 stock |
177 } |
| 187 #endif |
178 if(item->args.icon) { |
| 188 } else { |
179 set_toolbutton_icon(button, item->args.icon); |
| 189 button = gtk_toggle_tool_button_new(); |
|
| 190 gtk_tool_item_set_homogeneous(button, FALSE); |
|
| 191 if(item->args.label) { |
|
| 192 gtk_tool_button_set_label(GTK_TOOL_BUTTON(button), item->args.label); |
|
| 193 } |
|
| 194 if(item->args.icon) { |
|
| 195 set_toolbutton_icon(button, item->args.icon); |
|
| 196 } |
|
| 197 } |
180 } |
| 198 if(item->args.tooltip) { |
181 if(item->args.tooltip) { |
| 199 gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), item->args.tooltip); |
182 gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), item->args.tooltip); |
| 200 } |
183 } |
| 201 ui_set_widget_ngroups(obj->ctx, GTK_WIDGET(button), item->args.groups, item->ngroups); |
184 ui_set_widget_ngroups(obj->ctx, GTK_WIDGET(button), item->args.groups, item->ngroups); |
| 286 free(menu); |
269 free(menu); |
| 287 } |
270 } |
| 288 |
271 |
| 289 void add_toolitem_menu_widget(GtkToolbar *tb, UiToolbarMenuItem *item, UiObject *obj) { |
272 void add_toolitem_menu_widget(GtkToolbar *tb, UiToolbarMenuItem *item, UiObject *obj) { |
| 290 GtkToolItem *button; |
273 GtkToolItem *button; |
| 291 if(item->args.stockid) { |
274 button = gtk_tool_button_new(NULL, item->args.label); |
| 292 #ifdef UI_GTK2 |
|
| 293 button = gtk_tool_button_new_from_stock(item->args.stockid); |
|
| 294 #else |
|
| 295 // TODO: gtk3 stock |
|
| 296 button = gtk_tool_button_new(NULL, item->args.label); |
|
| 297 #endif |
|
| 298 } else { |
|
| 299 button = gtk_tool_button_new(NULL, item->args.label); |
|
| 300 } |
|
| 301 |
275 |
| 302 gtk_tool_item_set_homogeneous(button, FALSE); |
276 gtk_tool_item_set_homogeneous(button, FALSE); |
| 303 if(item->args.icon) { |
277 if(item->args.icon) { |
| 304 set_toolbutton_icon(button, item->args.icon); |
278 set_toolbutton_icon(button, item->args.icon); |
| 305 } |
279 } |