gtk_widget_show( menu );
gtk_option_menu_set_menu( GTK_OPTION_MENU( zlist ), menu );
- item = gtk_menu_item_new_with_label( "Z-Buffer Test and Write (recommended for solid or no polygons)" );
+ item = ui::MenuItem( "Z-Buffer Test and Write (recommended for solid or no polygons)" );
gtk_widget_show( item );
gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC( OnSelchangeZbuffer ), GINT_TO_POINTER( 0 ) );
gtk_menu_append( GTK_MENU( menu ), item );
- item = gtk_menu_item_new_with_label( "Z-Buffer Test Only (recommended for transparent polygons)" );
+ item = ui::MenuItem( "Z-Buffer Test Only (recommended for transparent polygons)" );
gtk_widget_show( item );
gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC( OnSelchangeZbuffer ), GINT_TO_POINTER( 1 ) );
gtk_menu_append( GTK_MENU( menu ), item );
- item = gtk_menu_item_new_with_label( "Z-Buffer Off" );
+ item = ui::MenuItem( "Z-Buffer Off" );
gtk_widget_show( item );
gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC( OnSelchangeZbuffer ), GINT_TO_POINTER( 2 ) );
#include <gtk/gtkradiomenuitem.h>
#include <gtk/gtktearoffmenuitem.h>
#include <gtk/gtkaccellabel.h>
+#include <uilib/uilib.h>
#include "generic/callback.h"
}
GtkMenuItem* new_sub_menu_item_with_mnemonic( const char* mnemonic ){
- GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_mnemonic( mnemonic ) );
+ GtkMenuItem* item = ui::MenuItem( mnemonic, true );
gtk_widget_show( GTK_WIDGET( item ) );
GtkWidget* sub_menu = gtk_menu_new();
}
GtkMenuItem* new_menu_item_with_mnemonic( const char *mnemonic, const Callback& callback ){
- GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_mnemonic( mnemonic ) );
+ GtkMenuItem* item = ui::MenuItem( mnemonic, true );
gtk_widget_show( GTK_WIDGET( item ) );
menu_item_connect_callback( item, callback );
return item;
Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
{ }
+ MenuItem::MenuItem(const char *label, bool mnemonic) : MenuItem(GTK_MENU_ITEM((mnemonic ? gtk_menu_item_new_with_mnemonic : gtk_menu_item_new_with_label)(label)))
+ { }
+
TreeView::TreeView(TreeModel model) : TreeView(GTK_TREE_VIEW(gtk_tree_view_new_with_model(model)))
{ }
Label(const char *label);
);
- WRAP(MenuItem, ui_menuitem,);
+ WRAP(MenuItem, ui_menuitem,
+ MenuItem(const char *label, bool mnemonic = false);
+ );
WRAP(ScrolledWindow, ui_scrolledwindow,
ScrolledWindow();
menu = gtk_menu_new();
- item = gtk_menu_item_new_with_label( "Validate (RETURN)" );
+ item = ui::MenuItem( "Validate (RETURN)" );
gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( Textool_Validate ), NULL );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
- item = gtk_menu_item_new_with_label( "Zoom in (INSERT)" );
+ item = ui::MenuItem( "Zoom in (INSERT)" );
gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( view_ZoomIn ), this );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
- item = gtk_menu_item_new_with_label( "Zoom out (DELETE)" );
+ item = ui::MenuItem( "Zoom out (DELETE)" );
gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( view_ZoomOut ), this );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
- item = gtk_menu_item_new_with_label( "Cancel (ESC)" );
+ item = ui::MenuItem( "Cancel (ESC)" );
gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( Textool_Cancel ), NULL );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
void console_populate_popup( GtkTextView* textview, GtkMenu* menu, gpointer user_data ){
menu_separator( menu );
- ui::Widget item(gtk_menu_item_new_with_label( "Clear" ));
+ ui::Widget item(ui::MenuItem( "Clear" ));
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( console_clear ), 0 );
gtk_widget_show( item );
container_add_widget( GTK_CONTAINER( menu ), item );
const char *menuText, *menuCommand;
WidgetStack menuStack;
- parent = ui::Widget(gtk_menu_item_new_with_label( pPlugIn->getMenuName() ));
+ parent = ui::MenuItem( pPlugIn->getMenuName() );
gtk_widget_show( parent );
gtk_container_add( GTK_CONTAINER( plugin_menu ), parent );
continue;
}
- item = ui::Widget(gtk_menu_item_new_with_label( menuText ));
+ item = ui::MenuItem( menuText );
gtk_widget_show( item );
gtk_container_add( GTK_CONTAINER( menu ), item );
}
else
{
- item = ui::Widget(gtk_menu_item_new_with_label( menuText ));
+ item = ui::MenuItem( menuText );
g_object_set_data( G_OBJECT( item ),"command", const_cast<gpointer>( static_cast<const void*>( menuCommand ) ) );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( plugin_activated ), gint_to_pointer( m_nNextPlugInID ) );
}
void TextureBrowser_createContextMenu( ui::Widget treeview, GdkEventButton *event ){
ui::Widget menu = ui::Widget(gtk_menu_new());
- ui::Widget menuitem = ui::Widget(gtk_menu_item_new_with_label( "Add tag" ));
+ ui::Widget menuitem = ui::MenuItem( "Add tag" );
g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_addTag, treeview );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
- menuitem = ui::Widget(gtk_menu_item_new_with_label( "Rename tag" ));
+ menuitem = ui::MenuItem( "Rename tag" );
g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_renameTag, treeview );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
- menuitem = ui::Widget(gtk_menu_item_new_with_label( "Delete tag" ));
+ menuitem = ui::MenuItem( "Delete tag" );
g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_deleteTag, treeview );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
}
void EntityClassMenu_addItem( GtkMenu* menu, const char* name ){
- GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_label( name ) );
+ GtkMenuItem* item = ui::MenuItem( name );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( entitycreate_activated ), item );
gtk_widget_show( GTK_WIDGET( item ) );
menu_add_item( menu, item );
m_previous = e->name();
}
void pushMenu( const std::string& name ){
- GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_label( name.c_str() ) );
+ GtkMenuItem* item = ui::MenuItem( name.c_str() );
gtk_widget_show( GTK_WIDGET( item ) );
container_add_widget( GTK_CONTAINER( m_stack.back().first ), GTK_WIDGET( item ) );