#include "container.h"
#include "pointer.h"
-void menu_add_item( GtkMenu* menu, GtkMenuItem* item ){
+void menu_add_item( ui::Menu menu, ui::MenuItem item ){
gtk_container_add( GTK_CONTAINER( menu ), GTK_WIDGET( item ) );
}
-GtkMenuItem* menu_separator( GtkMenu* menu ){
- GtkMenuItem* menu_item = GTK_MENU_ITEM( gtk_menu_item_new() );
+ui::MenuItem menu_separator( ui::Menu menu ){
+ auto menu_item = ui::MenuItem(GTK_MENU_ITEM( gtk_menu_item_new() ));
container_add_widget( GTK_CONTAINER( menu ), GTK_WIDGET( menu_item ) );
gtk_widget_set_sensitive( GTK_WIDGET( menu_item ), FALSE );
- gtk_widget_show( GTK_WIDGET( menu_item ) );
+ menu_item.show();
return menu_item;
}
-GtkTearoffMenuItem* menu_tearoff( GtkMenu* menu ){
- GtkTearoffMenuItem* menu_item = GTK_TEAROFF_MENU_ITEM( gtk_tearoff_menu_item_new() );
+ui::TearoffMenuItem menu_tearoff( ui::Menu menu ){
+ auto menu_item = ui::TearoffMenuItem(GTK_TEAROFF_MENU_ITEM( gtk_tearoff_menu_item_new() ));
container_add_widget( GTK_CONTAINER( menu ), GTK_WIDGET( menu_item ) );
// gtk_widget_set_sensitive(GTK_WIDGET(menu_item), FALSE); -- controls whether menu is detachable
- gtk_widget_show( GTK_WIDGET( menu_item ) );
+ menu_item.show();
return menu_item;
}
-GtkMenuItem* new_sub_menu_item_with_mnemonic( const char* mnemonic ){
- GtkMenuItem* item = ui::MenuItem( mnemonic, true );
- gtk_widget_show( GTK_WIDGET( item ) );
+ui::MenuItem new_sub_menu_item_with_mnemonic( const char* mnemonic ){
+ auto item = ui::MenuItem( mnemonic, true );
+ item.show();
- GtkWidget* sub_menu = ui::Menu();
+ auto sub_menu = ui::Menu();
gtk_menu_item_set_submenu( item, sub_menu );
return item;
}
-GtkMenu* create_sub_menu_with_mnemonic( GtkMenuShell* parent, const char* mnemonic ){
- GtkMenuItem* item = new_sub_menu_item_with_mnemonic( mnemonic );
+ui::Menu create_sub_menu_with_mnemonic( ui::MenuShell parent, const char* mnemonic ){
+ auto item = new_sub_menu_item_with_mnemonic( mnemonic );
container_add_widget( GTK_CONTAINER( parent ), GTK_WIDGET( item ) );
- return GTK_MENU( gtk_menu_item_get_submenu( item ) );
+ return ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( item ) ));
}
-GtkMenu* create_sub_menu_with_mnemonic( GtkMenuBar* bar, const char* mnemonic ){
- return create_sub_menu_with_mnemonic( GTK_MENU_SHELL( bar ), mnemonic );
+ui::Menu create_sub_menu_with_mnemonic( ui::MenuBar bar, const char* mnemonic ){
+ return create_sub_menu_with_mnemonic( ui::MenuShell(GTK_MENU_SHELL( bar )), mnemonic );
}
-GtkMenu* create_sub_menu_with_mnemonic( GtkMenu* parent, const char* mnemonic ){
- return create_sub_menu_with_mnemonic( GTK_MENU_SHELL( parent ), mnemonic );
+ui::Menu create_sub_menu_with_mnemonic( ui::Menu parent, const char* mnemonic ){
+ return create_sub_menu_with_mnemonic( ui::MenuShell(GTK_MENU_SHELL( parent )), mnemonic );
}
-void activate_closure_callback( GtkWidget* widget, gpointer data ){
+void activate_closure_callback( ui::Widget widget, gpointer data ){
( *reinterpret_cast<Callback*>( data ) )( );
}
-guint menu_item_connect_callback( GtkMenuItem* item, const Callback& callback ){
+guint menu_item_connect_callback( ui::MenuItem item, const Callback& callback ){
#if 1
return g_signal_connect_swapped( G_OBJECT( item ), "activate", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
#else
#endif
}
-guint check_menu_item_connect_callback( GtkCheckMenuItem* item, const Callback& callback ){
+guint check_menu_item_connect_callback( ui::CheckMenuItem item, const Callback& callback ){
#if 1
guint handler = g_signal_connect_swapped( G_OBJECT( item ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
#else
return handler;
}
-GtkMenuItem* new_menu_item_with_mnemonic( const char *mnemonic, const Callback& callback ){
- GtkMenuItem* item = ui::MenuItem( mnemonic, true );
- gtk_widget_show( GTK_WIDGET( item ) );
+ui::MenuItem new_menu_item_with_mnemonic( const char *mnemonic, const Callback& callback ){
+ auto item = ui::MenuItem( mnemonic, true );
+ item.show();
menu_item_connect_callback( item, callback );
return item;
}
-GtkMenuItem* create_menu_item_with_mnemonic( GtkMenu* menu, const char *mnemonic, const Callback& callback ){
- GtkMenuItem* item = new_menu_item_with_mnemonic( mnemonic, callback );
+ui::MenuItem create_menu_item_with_mnemonic( ui::Menu menu, const char *mnemonic, const Callback& callback ){
+ auto item = new_menu_item_with_mnemonic( mnemonic, callback );
container_add_widget( GTK_CONTAINER( menu ), GTK_WIDGET( item ) );
return item;
}
-GtkCheckMenuItem* new_check_menu_item_with_mnemonic( const char* mnemonic, const Callback& callback ){
- GtkCheckMenuItem* item = GTK_CHECK_MENU_ITEM( gtk_check_menu_item_new_with_mnemonic( mnemonic ) );
- gtk_widget_show( GTK_WIDGET( item ) );
+ui::CheckMenuItem new_check_menu_item_with_mnemonic( const char* mnemonic, const Callback& callback ){
+ auto item = ui::CheckMenuItem(GTK_CHECK_MENU_ITEM( gtk_check_menu_item_new_with_mnemonic( mnemonic ) ));
+ item.show();
check_menu_item_connect_callback( item, callback );
return item;
}
-GtkCheckMenuItem* create_check_menu_item_with_mnemonic( GtkMenu* menu, const char* mnemonic, const Callback& callback ){
- GtkCheckMenuItem* item = new_check_menu_item_with_mnemonic( mnemonic, callback );
+ui::CheckMenuItem create_check_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const Callback& callback ){
+ auto item = new_check_menu_item_with_mnemonic( mnemonic, callback );
container_add_widget( GTK_CONTAINER( menu ), GTK_WIDGET( item ) );
return item;
}
-GtkRadioMenuItem* new_radio_menu_item_with_mnemonic( GSList** group, const char* mnemonic, const Callback& callback ){
- GtkRadioMenuItem* item = GTK_RADIO_MENU_ITEM( gtk_radio_menu_item_new_with_mnemonic( *group, mnemonic ) );
+ui::RadioMenuItem new_radio_menu_item_with_mnemonic( GSList** group, const char* mnemonic, const Callback& callback ){
+ auto item = ui::RadioMenuItem(GTK_RADIO_MENU_ITEM( gtk_radio_menu_item_new_with_mnemonic( *group, mnemonic ) ));
if ( *group == 0 ) {
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), TRUE );
}
*group = gtk_radio_menu_item_get_group( item );
- gtk_widget_show( GTK_WIDGET( item ) );
- check_menu_item_connect_callback( GTK_CHECK_MENU_ITEM( item ), callback );
+ item.show();
+ check_menu_item_connect_callback( item, callback );
return item;
}
-GtkRadioMenuItem* create_radio_menu_item_with_mnemonic( GtkMenu* menu, GSList** group, const char* mnemonic, const Callback& callback ){
- GtkRadioMenuItem* item = new_radio_menu_item_with_mnemonic( group, mnemonic, callback );
+ui::RadioMenuItem create_radio_menu_item_with_mnemonic( ui::Menu menu, GSList** group, const char* mnemonic, const Callback& callback ){
+ auto item = new_radio_menu_item_with_mnemonic( group, mnemonic, callback );
container_add_widget( GTK_CONTAINER( menu ), GTK_WIDGET( item ) );
return item;
}
-void check_menu_item_set_active_no_signal( GtkCheckMenuItem* item, gboolean active ){
+void check_menu_item_set_active_no_signal( ui::CheckMenuItem item, gboolean active ){
guint handler_id = gpointer_to_int( g_object_get_data( G_OBJECT( item ), "handler" ) );
g_signal_handler_block( G_OBJECT( item ), handler_id );
gtk_check_menu_item_set_active( item, active );
-void radio_menu_item_set_active_no_signal( GtkRadioMenuItem* item, gboolean active ){
+void radio_menu_item_set_active_no_signal( ui::RadioMenuItem item, gboolean active ){
{
for ( GSList* l = gtk_radio_menu_item_get_group( item ); l != 0; l = g_slist_next( l ) )
{
}
-void menu_item_set_accelerator( GtkMenuItem* item, GClosure* closure ){
+void menu_item_set_accelerator( ui::MenuItem item, GClosure* closure ){
GtkAccelLabel* accel_label = GTK_ACCEL_LABEL( gtk_bin_get_child( GTK_BIN( item ) ) );
gtk_accel_label_set_accel_closure( accel_label, closure );
}
}
}
-void menu_item_add_accelerator( GtkMenuItem* item, Accelerator accelerator ){
+void menu_item_add_accelerator( ui::MenuItem item, Accelerator accelerator ){
if ( accelerator.key != 0 && gtk_accelerator_valid( accelerator.key, accelerator.modifiers )) {
GClosure* closure = global_accel_group_find( accelerator );
ASSERT_NOTNULL(closure);
}
}
-GtkMenuItem* create_menu_item_with_mnemonic( GtkMenu* menu, const char* mnemonic, const Command& command ){
- GtkMenuItem* item = create_menu_item_with_mnemonic( menu, mnemonic, command.m_callback );
+ui::MenuItem create_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const Command& command ){
+ auto item = create_menu_item_with_mnemonic( menu, mnemonic, command.m_callback );
menu_item_add_accelerator( item, command.m_accelerator );
return item;
}
-void check_menu_item_set_active_callback( GtkCheckMenuItem& item, bool enabled ){
- check_menu_item_set_active_no_signal( &item, enabled );
+void check_menu_item_set_active_callback( GtkCheckMenuItem &item, bool enabled ){
+ check_menu_item_set_active_no_signal( ui::CheckMenuItem(&item), enabled );
}
typedef ReferenceCaller1<GtkCheckMenuItem, bool, check_menu_item_set_active_callback> CheckMenuItemSetActiveCaller;
-GtkCheckMenuItem* create_check_menu_item_with_mnemonic( GtkMenu* menu, const char* mnemonic, const Toggle& toggle ){
- GtkCheckMenuItem* item = create_check_menu_item_with_mnemonic( menu, mnemonic, toggle.m_command.m_callback );
- menu_item_add_accelerator( GTK_MENU_ITEM( item ), toggle.m_command.m_accelerator );
- toggle.m_exportCallback( CheckMenuItemSetActiveCaller( *item ) );
+ui::CheckMenuItem create_check_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const Toggle& toggle ){
+ auto item = create_check_menu_item_with_mnemonic( menu, mnemonic, toggle.m_command.m_callback );
+ menu_item_add_accelerator( item, toggle.m_command.m_accelerator );
+ GtkCheckMenuItem *item_ = item;
+ toggle.m_exportCallback( CheckMenuItemSetActiveCaller( *item_ ) );
return item;
}
#if !defined( INCLUDED_GTKUTIL_MENU_H )
#define INCLUDED_GTKUTIL_MENU_H
+#include <uilib/uilib.h>
#include "generic/callbackfwd.h"
typedef int gint;
typedef gint gboolean;
typedef struct _GSList GSList;
-typedef struct _GtkMenu GtkMenu;
-typedef struct _GtkMenuBar GtkMenuBar;
-typedef struct _GtkMenuItem GtkMenuItem;
-typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
-typedef struct _GtkRadioMenuItem GtkRadioMenuItem;
-typedef struct _GtkTearoffMenuItem GtkTearoffMenuItem;
-
-void menu_add_item( GtkMenu* menu, GtkMenuItem* item );
-GtkMenuItem* menu_separator( GtkMenu* menu );
-GtkTearoffMenuItem* menu_tearoff( GtkMenu* menu );
-GtkMenuItem* new_sub_menu_item_with_mnemonic( const char* mnemonic );
-GtkMenu* create_sub_menu_with_mnemonic( GtkMenuBar* bar, const char* mnemonic );
-GtkMenu* create_sub_menu_with_mnemonic( GtkMenu* parent, const char* mnemonic );
-GtkMenuItem* create_menu_item_with_mnemonic( GtkMenu* menu, const char* mnemonic, const Callback& callback );
-GtkCheckMenuItem* create_check_menu_item_with_mnemonic( GtkMenu* menu, const char* mnemonic, const Callback& callback );
-GtkRadioMenuItem* create_radio_menu_item_with_mnemonic( GtkMenu* menu, GSList** group, const char* mnemonic, const Callback& callback );
+
+void menu_add_item( ui::Menu menu, ui::MenuItem item );
+ui::MenuItem menu_separator( ui::Menu menu );
+ui::TearoffMenuItem menu_tearoff( ui::Menu menu );
+ui::MenuItem new_sub_menu_item_with_mnemonic( const char* mnemonic );
+ui::Menu create_sub_menu_with_mnemonic( ui::MenuBar bar, const char* mnemonic );
+ui::Menu create_sub_menu_with_mnemonic( ui::Menu parent, const char* mnemonic );
+ui::MenuItem create_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const Callback& callback );
+ui::CheckMenuItem create_check_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const Callback& callback );
+ui::RadioMenuItem create_radio_menu_item_with_mnemonic( ui::Menu menu, GSList** group, const char* mnemonic, const Callback& callback );
class Command;
-GtkMenuItem* create_menu_item_with_mnemonic( GtkMenu* menu, const char* mnemonic, const Command& command );
+ui::MenuItem create_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const Command& command );
class Toggle;
-GtkCheckMenuItem* create_check_menu_item_with_mnemonic( GtkMenu* menu, const char* mnemonic, const Toggle& toggle );
+ui::CheckMenuItem create_check_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const Toggle& toggle );
-typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
-void check_menu_item_set_active_no_signal( GtkCheckMenuItem* item, gboolean active );
-typedef struct _GtkRadioMenuItem GtkRadioMenuItem;
-void radio_menu_item_set_active_no_signal( GtkRadioMenuItem* item, gboolean active );
+void check_menu_item_set_active_no_signal( ui::CheckMenuItem item, gboolean active );
+void radio_menu_item_set_active_no_signal( ui::RadioMenuItem item, gboolean active );
#endif
struct _GtkCellRenderer;
struct _GtkCellRendererText;
struct _GtkCheckButton;
+struct _GtkCheckMenuItem;
struct _GtkComboBox;
struct _GtkComboBoxText;
struct _GtkContainer;
struct _GtkLabel;
struct _GtkListStore;
struct _GtkMenu;
+struct _GtkMenuBar;
struct _GtkMenuItem;
struct _GtkMenuShell;
struct _GtkMisc;
struct _GtkObject;
struct _GtkPaned;
struct _GtkRadioButton;
+struct _GtkRadioMenuItem;
struct _GtkRadioToolButton;
struct _GtkRange;
struct _GtkScale;
MenuItem(const char *label, bool mnemonic = false);
,
);
+
+ WRAP(CheckMenuItem, MenuItem, _GtkCheckMenuItem, (),
+ ,
+ );
+
+ WRAP(RadioMenuItem, CheckMenuItem, _GtkRadioMenuItem, (),
+ ,
+ );
+
WRAP(TearoffMenuItem, MenuItem, _GtkTearoffMenuItem, (),
TearoffMenuItem();
,
,
);
- WRAP(Menu, Widget, _GtkMenu, (),
+ WRAP(MenuBar, MenuShell, _GtkMenuBar, (),
+ ,
+ );
+
+ WRAP(Menu, MenuShell, _GtkMenu, (),
Menu();
,
);
GlobalCommands_insert( "MakeStructural", FreeCaller<Select_MakeStructural>(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
}
-void Brush_constructMenu( GtkMenu* menu ){
+void Brush_constructMenu( ui::Menu menu ){
create_menu_item_with_mnemonic( menu, "Prism...", "BrushPrism" );
create_menu_item_with_mnemonic( menu, "Cone...", "BrushCone" );
create_menu_item_with_mnemonic( menu, "Sphere...", "BrushSphere" );
create_menu_item_with_mnemonic( menu, "Rock...", "BrushRock" );
menu_separator( menu );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "CSG" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "CSG" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
}
menu_separator( menu );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Clipper" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Clipper" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
#define INCLUDED_BRUSHWRAPPER_H
#include <cstddef>
+#include <uilib/uilib.h>
#include "string/stringfwd.h"
#include "generic/callbackfwd.h"
void Scene_BrushFitTexture_Selected( scene::Graph& graph, float s_repeat, float t_repeat );
void Scene_BrushFitTexture_Component_Selected( scene::Graph& graph, float s_repeat, float t_repeat );
-typedef struct _GtkMenu GtkMenu;
-void Brush_constructMenu( GtkMenu* menu );
+void Brush_constructMenu( ui::Menu menu );
extern Callback g_texture_lock_status_changed;
#include "gtkutil/window.h"
#include "gtkdlgs.h"
-void Build_refreshMenu( GtkMenu* menu );
+void Build_refreshMenu( ui::Menu menu );
void BSPCommandList_Construct( ui::ListStore store, Project& project ){
BuildMenuItems g_BuildMenuItems;
-GtkMenu* g_bsp_menu;
+ui::Menu g_bsp_menu{nullptr};
-void Build_constructMenu( GtkMenu* menu ){
+void Build_constructMenu( ui::Menu menu ){
for ( Project::iterator i = g_build_project.begin(); i != g_build_project.end(); ++i )
{
g_BuildMenuItems.push_back( BuildMenuItem( ( *i ).first.c_str(), 0 ) );
}
-void Build_refreshMenu( GtkMenu* menu ){
+void Build_refreshMenu( ui::Menu menu ){
for ( BuildMenuItems::iterator i = g_BuildMenuItems.begin(); i != g_BuildMenuItems.end(); ++i )
{
- gtk_container_remove( GTK_CONTAINER( menu ), GTK_WIDGET( ( *i ).m_item ) );
+ gtk_container_remove( menu, GTK_WIDGET( ( *i ).m_item ) );
}
g_BuildMenuItems.clear();
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_BUILD_H )
#define INCLUDED_BUILD_H
void BuildMenu_Construct();
void BuildMenu_Destroy();
-typedef struct _GtkMenu GtkMenu;
-void Build_constructMenu( GtkMenu* menu );
-extern GtkMenu* g_bsp_menu;
+void Build_constructMenu( ui::Menu menu );
+extern ui::Menu g_bsp_menu;
#endif
}
-void fill_view_camera_menu( GtkMenu* menu ){
+void fill_view_camera_menu( ui::Menu menu ){
create_check_menu_item_with_mnemonic( menu, "Camera View", "ToggleCamera" );
}
void GlobalCamera_setCamWnd( CamWnd& camwnd );
-typedef struct _GtkMenu GtkMenu;
-void fill_view_camera_menu( GtkMenu* menu );
+void fill_view_camera_menu( ui::Menu menu );
typedef struct _GtkToolbar GtkToolbar;
void CamWnd_constructToolbar( GtkToolbar* toolbar );
void CamWnd_registerShortcuts();
gtk_text_buffer_set_text( buffer, "", -1 );
}
-void console_populate_popup( GtkTextView* textview, GtkMenu* menu, gpointer user_data ){
+void console_populate_popup( GtkTextView* textview, ui::Menu menu, gpointer user_data ){
menu_separator( menu );
ui::Widget item(ui::MenuItem( "Clear" ));
-void Entity_constructMenu( GtkMenu* menu ){
+void Entity_constructMenu( ui::Menu menu ){
create_menu_item_with_mnemonic( menu, "_Regroup", "GroupSelection" );
create_menu_item_with_mnemonic( menu, "_Ungroup", "UngroupSelection" );
create_menu_item_with_mnemonic( menu, "_Connect", "ConnectSelection" );
const char* misc_model_dialog( ui::Widget parent );
-typedef struct _GtkMenu GtkMenu;
-void Entity_constructMenu( GtkMenu* menu );
+void Entity_constructMenu( ui::Menu menu );
void Entity_Construct();
void Entity_Destroy();
}
}
-void Filters_constructMenu( GtkMenu* menu_in_menu ){
+void Filters_constructMenu( ui::Menu menu_in_menu ){
create_check_menu_item_with_mnemonic( menu_in_menu, "World", "FilterWorldBrushes" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Entities", "FilterEntities" );
if ( g_pGameDescription->mGameType == "doom3" ) {
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_FILTERS_H )
#define INCLUDED_FILTERS_H
-typedef struct _GtkMenu GtkMenu;
-void Filters_constructMenu( GtkMenu* menu_in_menu );
+void Filters_constructMenu( ui::Menu menu_in_menu );
#endif
}
-void Grid_constructMenu( GtkMenu* menu ){
+void Grid_constructMenu( ui::Menu menu ){
create_check_menu_item_with_mnemonic( menu, "Grid0.125", "SetGrid0.125" );
create_check_menu_item_with_mnemonic( menu, "Grid0.25", "SetGrid0.25" );
create_check_menu_item_with_mnemonic( menu, "Grid0.5", "SetGrid0.5" );
#if !defined( INCLUDED_GRID_H )
#define INCLUDED_GRID_H
+#include <uilib/uilib.h>
#include "signal/signalfwd.h"
float GetSnapGridSize();
void AddGridChangeCallback( const SignalHandler& handler );
void Grid_registerCommands();
-typedef struct _GtkMenu GtkMenu;
-void Grid_constructMenu( GtkMenu* menu );
+void Grid_constructMenu( ui::Menu menu );
void Grid_registerShortcuts();
global_accel_group_disconnect( toggle.m_command.m_accelerator, toggle.m_command.m_callback );
}
-GtkCheckMenuItem* create_check_menu_item_with_mnemonic( GtkMenu* menu, const char* mnemonic, const char* commandName ){
+GtkCheckMenuItem* create_check_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const char* commandName ){
GlobalShortcuts_register( commandName, 2 );
const Toggle& toggle = GlobalToggles_find( commandName );
global_accel_group_connect( toggle.m_command.m_accelerator, toggle.m_command.m_callback );
return create_check_menu_item_with_mnemonic( menu, mnemonic, toggle );
}
-GtkMenuItem* create_menu_item_with_mnemonic( GtkMenu* menu, const char *mnemonic, const char* commandName ){
+GtkMenuItem* create_menu_item_with_mnemonic( ui::Menu menu, const char *mnemonic, const char* commandName ){
GlobalShortcuts_register( commandName, 1 );
const Command& command = GlobalCommands_find( commandName );
global_accel_group_connect( command.m_accelerator, command.m_callback );
typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
// this also sets up the shortcut using command_connect_accelerator
-GtkMenuItem* create_menu_item_with_mnemonic( GtkMenu *menu, const char *mnemonic, const char* commandName );
+GtkMenuItem* create_menu_item_with_mnemonic( ui::Menu menu, const char *mnemonic, const char* commandName );
// this also sets up the shortcut using command_connect_accelerator
-GtkCheckMenuItem* create_check_menu_item_with_mnemonic( GtkMenu* menu, const char* mnemonic, const char* commandName );
+GtkCheckMenuItem* create_check_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const char* commandName );
typedef struct _GtkButton GtkButton;
typedef struct _GtkToggleButton GtkToggleButton;
OpenURL( str.c_str() );
}
-void process_xlink( const char* filename, const char *menu_name, const char *base_url, GtkMenu *menu ){
+void process_xlink( const char* filename, const char *menu_name, const char *base_url, ui::Menu menu ){
if ( file_exists( filename ) ) {
xmlDocPtr pDoc = xmlParseFile( filename );
if ( pDoc ) {
globalOutputStream() << "Processing .xlink file '" << filename << "'\n";
// create sub menu
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, menu_name );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, menu_name );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
}
}
-void create_game_help_menu( GtkMenu *menu ){
+void create_game_help_menu( ui::Menu menu ){
StringOutputStream filename( 256 );
filename << AppPath_get() << "global.xlink";
process_xlink( filename.c_str(), "General", AppPath_get(), menu );
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_HELP_H )
#define INCLUDED_HELP_H
-typedef struct _GtkMenu GtkMenu;
-void create_game_help_menu( GtkMenu *menu );
+void create_game_help_menu( ui::Menu menu );
#endif
GtkMenuItem* create_colours_menu(){
GtkMenuItem* colours_menu_item = new_sub_menu_item_with_mnemonic( "Colors" );
- GtkMenu* menu_in_menu = GTK_MENU( gtk_menu_item_get_submenu( colours_menu_item ) );
+ auto menu_in_menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( colours_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
- GtkMenu* menu_3 = create_sub_menu_with_mnemonic( menu_in_menu, "Themes" );
+ auto menu_3 = create_sub_menu_with_mnemonic( menu_in_menu, "Themes" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_3 );
}
GtkMenuItem* create_file_menu(){
// File menu
GtkMenuItem* file_menu_item = new_sub_menu_item_with_mnemonic( "_File" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( file_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( file_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
GtkMenuItem* create_edit_menu(){
// Edit menu
GtkMenuItem* edit_menu_item = new_sub_menu_item_with_mnemonic( "_Edit" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( edit_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( edit_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
create_menu_item_with_mnemonic( menu, "Select i_nside", "SelectInside" );
create_menu_item_with_mnemonic( menu, "Select _touching", "SelectTouching" );
- GtkMenu* convert_menu = create_sub_menu_with_mnemonic( menu, "E_xpand Selection" );
+ auto convert_menu = create_sub_menu_with_mnemonic( menu, "E_xpand Selection" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( convert_menu );
}
return edit_menu_item;
}
-void fill_view_xy_top_menu( GtkMenu* menu ){
+void fill_view_xy_top_menu( ui::Menu menu ){
create_check_menu_item_with_mnemonic( menu, "XY (Top) View", "ToggleView" );
}
-void fill_view_yz_side_menu( GtkMenu* menu ){
+void fill_view_yz_side_menu( ui::Menu menu ){
create_check_menu_item_with_mnemonic( menu, "YZ (Side) View", "ToggleSideView" );
}
-void fill_view_xz_front_menu( GtkMenu* menu ){
+void fill_view_xz_front_menu( ui::Menu menu ){
create_check_menu_item_with_mnemonic( menu, "XZ (Front) View", "ToggleFrontView" );
}
GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){
// View menu
GtkMenuItem* view_menu_item = new_sub_menu_item_with_mnemonic( "Vie_w" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( view_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( view_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
menu_separator( menu );
{
- GtkMenu* camera_menu = create_sub_menu_with_mnemonic( menu, "Camera" );
+ auto camera_menu = create_sub_menu_with_mnemonic( menu, "Camera" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( camera_menu );
}
}
menu_separator( menu );
{
- GtkMenu* orthographic_menu = create_sub_menu_with_mnemonic( menu, "Orthographic" );
+ auto orthographic_menu = create_sub_menu_with_mnemonic( menu, "Orthographic" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( orthographic_menu );
}
menu_separator( menu );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Show" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Show" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
}
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Filter" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Filter" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
}
menu_separator( menu );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Hide/Show" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Hide/Show" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
}
menu_separator( menu );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Region" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Region" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
GtkMenuItem* create_selection_menu(){
// Selection menu
GtkMenuItem* selection_menu_item = new_sub_menu_item_with_mnemonic( "M_odify" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( selection_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( selection_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Components" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Components" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
menu_separator( menu );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Nudge" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Nudge" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
create_menu_item_with_mnemonic( menu_in_menu, "Nudge Down", "SelectNudgeDown" );
}
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Rotate" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Rotate" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
create_menu_item_with_mnemonic( menu_in_menu, "Rotate Z", "RotateSelectionZ" );
}
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Flip" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Flip" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
GtkMenuItem* create_bsp_menu(){
// BSP menu
GtkMenuItem* bsp_menu_item = new_sub_menu_item_with_mnemonic( "_Build" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( bsp_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( bsp_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
GtkMenuItem* create_grid_menu(){
// Grid menu
GtkMenuItem* grid_menu_item = new_sub_menu_item_with_mnemonic( "_Grid" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( grid_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( grid_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
GtkMenuItem* create_misc_menu(){
// Misc menu
GtkMenuItem* misc_menu_item = new_sub_menu_item_with_mnemonic( "M_isc" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( misc_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( misc_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
GtkMenuItem* create_entity_menu(){
// Brush menu
GtkMenuItem* entity_menu_item = new_sub_menu_item_with_mnemonic( "E_ntity" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( entity_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( entity_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
GtkMenuItem* create_brush_menu(){
// Brush menu
GtkMenuItem* brush_menu_item = new_sub_menu_item_with_mnemonic( "B_rush" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( brush_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( brush_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
GtkMenuItem* create_patch_menu(){
// Curve menu
GtkMenuItem* patch_menu_item = new_sub_menu_item_with_mnemonic( "_Curve" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( patch_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( patch_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
GtkMenuItem* create_help_menu(){
// Help menu
GtkMenuItem* help_menu_item = new_sub_menu_item_with_mnemonic( "_Help" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( help_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( help_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
LoadMRU g_load_mru3( 3 );
LoadMRU g_load_mru4( 4 );
-void MRU_constructMenu( GtkMenu* menu ){
+void MRU_constructMenu( ui::Menu menu ){
{
GtkMenuItem* item = create_menu_item_with_mnemonic( menu, "_1", LoadMRUCaller( g_load_mru1 ) );
gtk_widget_set_sensitive( GTK_WIDGET( item ), FALSE );
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_MRU_H )
#define INCLUDED_MRU_H
void MRU_AddFile( const char *str );
-typedef struct _GtkMenu GtkMenu;
-void MRU_constructMenu( GtkMenu* menu );
+void MRU_constructMenu( ui::Menu menu );
void MRU_Construct();
void MRU_Destroy();
toolbar_append_button( toolbar, "Put caps on the current patch (SHIFT + C)", "cap_curve.png", "CapCurrentCurve" );
}
-void Patch_constructMenu( GtkMenu* menu ){
+void Patch_constructMenu( ui::Menu menu ){
create_menu_item_with_mnemonic( menu, "Cylinder", "PatchCylinder" );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "More Cylinders" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "More Cylinders" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
create_menu_item_with_mnemonic( menu, "End cap", "PatchEndCap" );
create_menu_item_with_mnemonic( menu, "Bevel", "PatchBevel" );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "More End caps, Bevels" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "More End caps, Bevels" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
create_menu_item_with_mnemonic( menu, "Simple Patch Mesh...", "SimplePatchMesh" );
menu_separator( menu );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Insert" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Insert" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
create_menu_item_with_mnemonic( menu_in_menu, "Add (2) Rows", "PatchInsertAddRow" );
}
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Delete" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Delete" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
}
menu_separator( menu );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Matrix" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Matrix" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
create_menu_item_with_mnemonic( menu_in_menu, "Invert", "InvertCurve" );
- GtkMenu* menu_3 = create_sub_menu_with_mnemonic( menu_in_menu, "Re-disperse" );
+ auto menu_3 = create_sub_menu_with_mnemonic( menu_in_menu, "Re-disperse" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_3 );
}
create_menu_item_with_mnemonic( menu_3, "Rows", "RedisperseRows" );
create_menu_item_with_mnemonic( menu_3, "Columns", "RedisperseCols" );
- GtkMenu* menu_4 = create_sub_menu_with_mnemonic( menu_in_menu, "Smooth" );
+ auto menu_4 = create_sub_menu_with_mnemonic( menu_in_menu, "Smooth" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_4 );
}
create_menu_item_with_mnemonic( menu, "Cycle Cap Texture", "CycleCapTexturePatch" );
menu_separator( menu );
{
- GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Overlay" );
+ auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Overlay" );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
#if !defined ( INCLUDED_PATCHMANIP_H )
#define INCLUDED_PATCHMANIP_H
+#include <uilib/uilib.h>
#include "string/stringfwd.h"
void Patch_registerCommands();
typedef struct _GtkToolbar GtkToolbar;
typedef struct _GtkMenu GtkMenu;
void Patch_constructToolbar( GtkToolbar* toolbar );
-void Patch_constructMenu( GtkMenu* menu );
+void Patch_constructMenu( ui::Menu menu );
namespace scene
{
}
#include <stack>
-typedef std::stack<ui::Widget> WidgetStack;
void PlugInMenu_Add( GtkMenu* plugin_menu, IPlugIn* pPlugIn ){
- ui::Widget menu, item, parent, subMenu;
+ ui::Widget item, parent;
+ ui::Menu menu{nullptr}, subMenu{nullptr};
const char *menuText, *menuCommand;
- WidgetStack menuStack;
+ std::stack<ui::Menu> menuStack;
parent = ui::MenuItem( pPlugIn->getMenuName() );
gtk_widget_show( parent );
if ( nCount > 0 ) {
menu = ui::Menu();
if ( g_Layout_enableDetachableMenus.m_value ) {
- menu_tearoff( GTK_MENU( menu ) );
+ menu_tearoff( menu );
}
while ( nCount > 0 )
{
GtkMenuItem* create_plugins_menu(){
// Plugins menu
GtkMenuItem* plugins_menu_item = new_sub_menu_item_with_mnemonic( "_Plugins" );
- GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( plugins_menu_item ) );
+ auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( plugins_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
TextureBrowser_constructTreeStoreTags();
}
-ui::MenuItem TextureBrowser_constructViewMenu( GtkMenu* menu ){
+ui::MenuItem TextureBrowser_constructViewMenu( ui::Menu menu ){
ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_View" ));
if ( g_Layout_enableDetachableMenus.m_value ) {
return textures_menu_item;
}
-ui::MenuItem TextureBrowser_constructToolsMenu( GtkMenu* menu ){
+ui::MenuItem TextureBrowser_constructToolsMenu( ui::Menu menu ){
ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_Tools" ));
if ( g_Layout_enableDetachableMenus.m_value ) {
return textures_menu_item;
}
-ui::MenuItem TextureBrowser_constructTagsMenu( GtkMenu* menu ){
+ui::MenuItem TextureBrowser_constructTagsMenu( ui::Menu menu ){
ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "T_ags" ));
if ( g_Layout_enableDetachableMenus.m_value ) {
{ // menu bar
menu_bar = ui::Widget(gtk_menu_bar_new());
- ui::Widget menu_view = ui::Menu();
- auto view_item = TextureBrowser_constructViewMenu( GTK_MENU( menu_view ) );
+ auto menu_view = ui::Menu();
+ auto view_item = TextureBrowser_constructViewMenu( menu_view );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view );
gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), view_item );
- ui::Widget menu_tools = ui::Menu();
- auto tools_item = TextureBrowser_constructToolsMenu( GTK_MENU( menu_tools ) );
+ auto menu_tools = ui::Menu();
+ auto tools_item = TextureBrowser_constructToolsMenu( menu_tools );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools_item ), menu_tools );
gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tools_item );
TextureBrowser_buildTagList();
}
{ // tag menu bar
- ui::Widget menu_tags = ui::Menu();
- auto tags_item = TextureBrowser_constructTagsMenu( GTK_MENU( menu_tags ) );
+ auto menu_tags = ui::Menu();
+ auto tags_item = TextureBrowser_constructTagsMenu( menu_tags );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( tags_item ), menu_tags );
gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tags_item );
}
bool g_bCrossHairs = false;
-GtkMenu* XYWnd::m_mnuDrop = 0;
+ui::Menu XYWnd::m_mnuDrop{nullptr};
// this is disabled, and broken
// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=394
m_entityCreate = false;
- m_mnuDrop = 0;
+ m_mnuDrop = ui::Menu{nullptr};
GlobalWindowObservers_add( m_window_observer );
GlobalWindowObservers_connectWidget( m_gl_widget );
XYWnd::~XYWnd(){
onDestroyed();
- if ( m_mnuDrop != 0 ) {
+ if ( m_mnuDrop ) {
gtk_widget_destroy( GTK_WIDGET( m_mnuDrop ) );
- m_mnuDrop = 0;
+ m_mnuDrop = ui::Menu{nullptr};
}
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_sizeHandler );
}
}
-void EntityClassMenu_addItem( GtkMenu* menu, const char* name ){
- GtkMenuItem* item = ui::MenuItem( name );
+void EntityClassMenu_addItem( ui::Menu menu, const char* name ){
+ auto item = ui::MenuItem( name );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( entitycreate_activated ), item );
- gtk_widget_show( GTK_WIDGET( item ) );
+ item.show();
menu_add_item( menu, item );
}
class EntityClassMenuInserter : public EntityClassVisitor
{
-typedef std::pair<GtkMenu*, CopiedString> MenuPair;
+typedef std::pair<ui::Menu, CopiedString> MenuPair;
typedef std::vector<MenuPair> MenuStack;
MenuStack m_stack;
CopiedString m_previous;
public:
-EntityClassMenuInserter( GtkMenu* menu ){
+EntityClassMenuInserter( ui::Menu menu ){
m_stack.reserve( 2 );
m_stack.push_back( MenuPair( menu, "" ) );
}
m_previous = e->name();
}
void pushMenu( const CopiedString& name ){
- GtkMenuItem* item = ui::MenuItem( name.c_str() );
- gtk_widget_show( GTK_WIDGET( item ) );
+ auto item = ui::MenuItem( name.c_str() );
+ item.show();
container_add_widget( GTK_CONTAINER( m_stack.back().first ), GTK_WIDGET( item ) );
- GtkMenu* submenu = ui::Menu();
+ auto submenu = ui::Menu();
gtk_menu_item_set_submenu( item, GTK_WIDGET( submenu ) );
m_stack.push_back( MenuPair( submenu, name ) );
return;
}
- if ( m_mnuDrop == 0 ) { // first time, load it up
- GtkMenu* menu = m_mnuDrop = ui::Menu();
+ if ( !m_mnuDrop ) { // first time, load it up
+ auto menu = m_mnuDrop = ui::Menu();
EntityClassMenuInserter inserter( menu );
GlobalEntityClassManager().forEach( inserter );
}
void unrealise(){
if ( ++m_unrealised == 1 ) {
- if ( XYWnd::m_mnuDrop != 0 ) {
+ if ( XYWnd::m_mnuDrop ) {
gtk_widget_destroy( GTK_WIDGET( XYWnd::m_mnuDrop ) );
- XYWnd::m_mnuDrop = 0;
+ XYWnd::m_mnuDrop = ui::Menu(nullptr);
}
}
}
void SetViewType( VIEWTYPE n );
bool m_bActive;
-static GtkMenu* m_mnuDrop;
+static ui::Menu m_mnuDrop;
int m_chasemouse_current_x, m_chasemouse_current_y;
int m_chasemouse_delta_x, m_chasemouse_delta_y;