add_definitions(-D_DEBUG=1)
endif ()
+add_definitions(
+ -DGTK_DISABLE_SINGLE_INCLUDES
+ -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES
+ -DGSEAL_ENABLE
+ -DGTK_DISABLE_DEPRECATED
+ -DGDK_DISABLE_DEPRECATED
+)
+
if (APPLE)
option(XWINDOWS "Build against X11" ON)
add_definitions(
// *************************
namespace SunPlug
{
-GtkWindow* main_window;
+ui::Window main_window;
char MenuList[100] = "";
const char* init( void* hApp, void* pMainWidget ){
- main_window = GTK_WINDOW( pMainWidget );
+ main_window = ui::Window(GTK_WINDOW( pMainWidget ));
return "Initializing SunPlug for GTKRadiant";
}
const char* getName(){
#include "iscenegraph.h"
#include <gtk/gtk.h>
-
-/**
- * GTK callback functions
- */
-
-class UFOAIGtk
-{
-GtkWindow* m_gtk_window;
-public:
-UFOAIGtk( void* gtk_window ) : m_gtk_window( ( GtkWindow* )gtk_window ){
-}
-};
+#include <uilib/uilib.h>
/**
* @brief If you return FALSE in the "delete_event" signal handler,
return false;
}
-static gboolean accelerator_key_event( GtkWindow* window, GdkEventKey* event, AcceleratorMap* acceleratorMap ){
+static gboolean accelerator_key_event( ui::Window window, GdkEventKey* event, AcceleratorMap* acceleratorMap ){
return AcceleratorMap_activate( *acceleratorMap, accelerator_for_event_key( event->keyval, event->state ) );
}
return 0;
}
-bool window_has_accel( GtkWindow* toplevel ){
+bool window_has_accel( ui::Window toplevel ){
return g_slist_length( gtk_accel_groups_from_object( G_OBJECT( toplevel ) ) ) != 0;
}
g_queuedAcceleratorsAdd.clear();
}
-void accel_group_test( GtkWindow* toplevel, GtkAccelGroup* accel ){
- guint n_entries;
- gtk_accel_group_query( accel, '4', (GdkModifierType)0, &n_entries );
- globalOutputStream() << "grid4: " << n_entries << "\n";
- globalOutputStream() << "toplevel accelgroups: " << g_slist_length( gtk_accel_groups_from_object( G_OBJECT( toplevel ) ) ) << "\n";
-}
-
-typedef std::set<GtkWindow*> WindowSet;
+typedef std::set<ui::Window> WindowSet;
WindowSet g_accel_windows;
bool Buttons_press( ButtonMask& buttons, guint button, guint state ){
g_accel_enabled = false;
for ( WindowSet::iterator i = g_accel_windows.begin(); i != g_accel_windows.end(); ++i )
{
- GtkWindow* toplevel = *i;
+ ui::Window toplevel = *i;
ASSERT_MESSAGE( window_has_accel( toplevel ), "ERROR" );
ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET(toplevel) ), "disabling accel for non-toplevel window" );
gtk_window_remove_accel_group( toplevel, global_accel );
#if 0
globalOutputStream() << reinterpret_cast<unsigned int>( toplevel ) << ": disabled global accelerators\n";
-#endif
-#if 0
- accel_group_test( toplevel, global_accel );
#endif
}
}
g_accel_enabled = true;
for ( WindowSet::iterator i = g_accel_windows.begin(); i != g_accel_windows.end(); ++i )
{
- GtkWindow* toplevel = *i;
+ ui::Window toplevel = *i;
ASSERT_MESSAGE( !window_has_accel( toplevel ), "ERROR" );
ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET(toplevel) ), "enabling accel for non-toplevel window" );
- gtk_window_add_accel_group( toplevel, global_accel );
+ toplevel.add_accel_group( global_accel );
#if 0
globalOutputStream() << reinterpret_cast<unsigned int>( toplevel ) << ": enabled global accelerators\n";
-#endif
-#if 0
- accel_group_test( toplevel, global_accel );
#endif
}
globalQueuedAccelerators_commit();
Keys_releaseAll( g_pressedKeys.keys, 0 );
}
-void GlobalPressedKeys_connect( GtkWindow* window ){
+void GlobalPressedKeys_connect( ui::Window window ){
unsigned int key_press_handler = g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( PressedKeys_key_press ), &g_pressedKeys );
unsigned int key_release_handler = g_signal_connect( G_OBJECT( window ), "key_release_event", G_CALLBACK( PressedKeys_key_release ), &g_pressedKeys );
g_object_set_data( G_OBJECT( window ), "key_press_handler", gint_to_pointer( key_press_handler ) );
g_object_set_data( G_OBJECT( window ), "focus_out_handler", gint_to_pointer( focus_out_handler ) );
}
-void GlobalPressedKeys_disconnect( GtkWindow* window ){
+void GlobalPressedKeys_disconnect( ui::Window window ){
g_signal_handler_disconnect( G_OBJECT( window ), gpointer_to_int( g_object_get_data( G_OBJECT( window ), "key_press_handler" ) ) );
g_signal_handler_disconnect( G_OBJECT( window ), gpointer_to_int( g_object_get_data( G_OBJECT( window ), "key_release_handler" ) ) );
g_signal_handler_disconnect( G_OBJECT( window ), gpointer_to_int( g_object_get_data( G_OBJECT( window ), "focus_in_handler" ) ) );
}
}
-GtkAccelGroup* global_accel = 0;
-
-void global_accel_init(){
- global_accel = ui::AccelGroup();
-}
-
-void global_accel_destroy(){
- g_object_unref( global_accel );
-}
+ui::AccelGroup global_accel = ui::AccelGroup();
GClosure* global_accel_group_add_accelerator( Accelerator accelerator, const Callback& callback ){
if ( !global_accel_enabled() ) {
}
/// \brief Propagates key events to the focus-widget, overriding global accelerators.
-static gboolean override_global_accelerators( GtkWindow* window, GdkEventKey* event, gpointer data ){
+static gboolean override_global_accelerators( ui::Window window, GdkEventKey* event, gpointer data ){
gboolean b = gtk_window_propagate_key_event( window, event );
return b;
}
-void global_accel_connect_window( GtkWindow* window ){
+void global_accel_connect_window( ui::Window window ){
#if 1
unsigned int override_handler = g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( override_global_accelerators ), 0 );
g_object_set_data( G_OBJECT( window ), "override_handler", gint_to_pointer( override_handler ) );
g_object_set_data( G_OBJECT( window ), "key_release_handler", gint_to_pointer( key_release_handler ) );
#endif
g_accel_windows.insert( window );
- gtk_window_add_accel_group( window, global_accel );
+ window.add_accel_group( global_accel );
}
-void global_accel_disconnect_window( GtkWindow* window ){
+void global_accel_disconnect_window( ui::Window window ){
#if 1
GlobalPressedKeys_disconnect( window );
#if !defined( INCLUDED_GTKUTIL_ACCELERATOR_H )
#define INCLUDED_GTKUTIL_ACCELERATOR_H
+#include <uilib/uilib.h>
#include <gdk/gdk.h>
#include "generic/callback.h"
void keyup_accelerators_remove( Accelerator accelerator );
typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-void global_accel_connect_window( GtkWindow* window );
-void global_accel_disconnect_window( GtkWindow* window );
+void global_accel_connect_window( ui::Window window );
+void global_accel_disconnect_window( ui::Window window );
void GlobalPressedKeys_releaseAll();
-typedef struct _GtkAccelGroup GtkAccelGroup;
-extern GtkAccelGroup* global_accel;
-void global_accel_init();
-void global_accel_destroy();
+extern ui::AccelGroup global_accel;
GClosure* global_accel_group_find( Accelerator accelerator );
}
-void Sys_GetCursorPos( GtkWindow* window, int *x, int *y ){
+void Sys_GetCursorPos( ui::Window window, int *x, int *y ){
gdk_display_get_pointer( gdk_display_get_default(), 0, x, y, 0 );
}
-void Sys_SetCursorPos( GtkWindow* window, int x, int y ){
+void Sys_SetCursorPos( ui::Window window, int x, int y ){
GdkScreen *screen;
gdk_display_get_pointer( gdk_display_get_default(), &screen, 0, 0, 0 );
gdk_display_warp_pointer( gdk_display_get_default(), screen, x, y );
#include <glib.h>
#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "debugging/debugging.h"
typedef struct _GdkCursor GdkCursor;
typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
GdkCursor* create_blank_cursor();
void blank_cursor( GtkWidget* widget );
void default_cursor( GtkWidget* widget );
-void Sys_GetCursorPos( GtkWindow* window, int *x, int *y );
-void Sys_SetCursorPos( GtkWindow* window, int x, int y );
+void Sys_GetCursorPos( ui::Window window, int *x, int *y );
+void Sys_SetCursorPos( ui::Window window, int x, int y );
}
static gboolean motion_delta( GtkWidget *widget, GdkEventMotion *event, FreezePointer* self ){
int current_x, current_y;
- Sys_GetCursorPos( GTK_WINDOW( widget ), ¤t_x, ¤t_y );
+ Sys_GetCursorPos( ui::Window(GTK_WINDOW( widget )), ¤t_x, ¤t_y );
int dx = current_x - self->last_x;
int dy = current_y - self->last_y;
int ddx = current_x - self->recorded_x;
if ( dx != 0 || dy != 0 ) {
//globalOutputStream() << "motion x: " << dx << ", y: " << dy << "\n";
if (ddx < -32 || ddx > 32 || ddy < -32 || ddy > 32) {
- Sys_SetCursorPos( GTK_WINDOW( widget ), self->recorded_x, self->recorded_y );
+ Sys_SetCursorPos( ui::Window(GTK_WINDOW( widget )), self->recorded_x, self->recorded_y );
self->last_x = self->recorded_x;
self->last_y = self->recorded_y;
}
return FALSE;
}
-void freeze_pointer( GtkWindow* window, MotionDeltaFunction function, void* data ){
+void freeze_pointer( ui::Window window, MotionDeltaFunction function, void* data ){
ASSERT_MESSAGE( m_function == 0, "can't freeze pointer" );
const GdkEventMask mask = static_cast<GdkEventMask>( GDK_POINTER_MOTION_MASK
handle_motion = g_signal_connect( G_OBJECT( window ), "motion_notify_event", G_CALLBACK( motion_delta ), this );
}
-void unfreeze_pointer( GtkWindow* window ){
+void unfreeze_pointer( ui::Window window ){
g_signal_handler_disconnect( G_OBJECT( window ), handle_motion );
m_function = 0;
return button;
}
-GtkWindow* create_dialog_window( GtkWindow* parent, const char* title, GCallback func, gpointer data, int default_w, int default_h ){
- GtkWindow* window = create_floating_window( title, parent );
+ui::Window create_dialog_window( ui::Window parent, const char* title, GCallback func, gpointer data, int default_w, int default_h ){
+ ui::Window window = create_floating_window( title, parent );
gtk_window_set_default_size( window, default_w, default_h );
gtk_window_set_position( window, GTK_WIN_POS_CENTER_ON_PARENT );
g_signal_connect( G_OBJECT( window ), "delete_event", func, data );
return TRUE;
}
-EMessageBoxReturn modal_dialog_show( GtkWindow* window, ModalDialog& dialog ){
+EMessageBoxReturn modal_dialog_show( ui::Window window, ModalDialog& dialog ){
gtk_grab_add( GTK_WIDGET( window ) );
gtk_widget_show( GTK_WIDGET( window ) );
return create_dialog_button( label, G_CALLBACK( modal_dialog_button_clicked ), &button );
}
-GtkWindow* create_modal_dialog_window( GtkWindow* parent, const char* title, ModalDialog& dialog, int default_w, int default_h ){
+ui::Window create_modal_dialog_window( ui::Window parent, const char* title, ModalDialog& dialog, int default_w, int default_h ){
return create_dialog_window( parent, title, G_CALLBACK( modal_dialog_delete ), &dialog, default_w, default_h );
}
-GtkWindow* create_fixedsize_modal_dialog_window( GtkWindow* parent, const char* title, ModalDialog& dialog, int width, int height ){
- GtkWindow* window = create_modal_dialog_window( parent, title, dialog, width, height );
+ui::Window create_fixedsize_modal_dialog_window( ui::Window parent, const char* title, ModalDialog& dialog, int width, int height ){
+ ui::Window window = create_modal_dialog_window( parent, title, dialog, width, height );
gtk_window_set_resizable( window, FALSE );
gtk_window_set_modal( window, TRUE );
return TRUE;
}
-GtkWindow* create_simple_modal_dialog_window( const char* title, ModalDialog& dialog, GtkWidget* contents ){
- GtkWindow* window = create_fixedsize_modal_dialog_window( 0, title, dialog );
+ui::Window create_simple_modal_dialog_window( const char* title, ModalDialog& dialog, GtkWidget* contents ){
+ ui::Window window = create_fixedsize_modal_dialog_window(ui::Window(), title, dialog );
GtkVBox* vbox1 = create_dialog_vbox( 8, 4 );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox1 ) );
typedef void ( *GCallback )( void );
typedef void* gpointer;
-typedef struct _GtkWindow GtkWindow;
typedef struct _GtkTable GtkTable;
typedef struct _GtkButton GtkButton;
typedef struct _GtkVBox GtkVBox;
typedef struct _GtkHBox GtkHBox;
typedef struct _GtkFrame GtkFrame;
-GtkWindow* create_fixedsize_modal_window( GtkWindow* parent, const char* title, int width, int height );
+ui::Window create_fixedsize_modal_window( ui::Window parent, const char* title, int width, int height );
-GtkWindow* create_dialog_window( GtkWindow* parent, const char* title, GCallback func, gpointer data, int default_w = -1, int default_h = -1 );
+ui::Window create_dialog_window( ui::Window parent, const char* title, GCallback func, gpointer data, int default_w = -1, int default_h = -1 );
GtkTable* create_dialog_table( unsigned int rows, unsigned int columns, unsigned int row_spacing, unsigned int col_spacing, int border = 0 );
GtkButton* create_dialog_button( const char* label, GCallback func, gpointer data );
GtkVBox* create_dialog_vbox( int spacing, int border = 0 );
GtkFrame* create_dialog_frame( const char* label, GtkShadowType shadow = GTK_SHADOW_ETCHED_IN );
GtkButton* create_modal_dialog_button( const char* label, ModalDialogButton& button );
-GtkWindow* create_modal_dialog_window( GtkWindow* parent, const char* title, ModalDialog& dialog, int default_w = -1, int default_h = -1 );
-GtkWindow* create_fixedsize_modal_dialog_window( GtkWindow* parent, const char* title, ModalDialog& dialog, int width = -1, int height = -1 );
-EMessageBoxReturn modal_dialog_show( GtkWindow* window, ModalDialog& dialog );
+ui::Window create_modal_dialog_window( ui::Window parent, const char* title, ModalDialog& dialog, int default_w = -1, int default_h = -1 );
+ui::Window create_fixedsize_modal_dialog_window( ui::Window parent, const char* title, ModalDialog& dialog, int width = -1, int height = -1 );
+EMessageBoxReturn modal_dialog_show( ui::Window window, ModalDialog& dialog );
gboolean dialog_button_ok( GtkWidget *widget, ModalDialog* data );
gboolean dialog_button_no( GtkWidget *widget, ModalDialog* data );
gboolean dialog_delete_callback( GtkWidget *widget, GdkEventAny* event, ModalDialog* data );
-GtkWindow* create_simple_modal_dialog_window( const char* title, ModalDialog& dialog, GtkWidget* contents );
+ui::Window create_simple_modal_dialog_window( const char* title, ModalDialog& dialog, GtkWidget* contents );
class RadioHBox
{
}
void menu_item_add_accelerator( GtkMenuItem* item, Accelerator accelerator ){
- if ( accelerator.key != 0 ) {
+ if ( accelerator.key != 0 && gtk_accelerator_valid( accelerator.key, accelerator.modifiers )) {
GClosure* closure = global_accel_group_find( accelerator );
ASSERT_NOTNULL(closure);
menu_item_set_accelerator( item, closure );
ModalDialogButton yes_button( dialog, eIDYES );
ModalDialogButton no_button( dialog, eIDNO );
- GtkWindow* parentWindow = parent ? GTK_WINDOW( parent ) : 0;
+ ui::Window parentWindow = ui::Window(parent ? GTK_WINDOW( parent ) : 0);
- GtkWindow* window = create_fixedsize_modal_dialog_window( parentWindow, title, dialog, 400, 100 );
+ ui::Window window = create_fixedsize_modal_dialog_window( parentWindow, title, dialog, 400, 100 );
- if ( parentWindow != 0 ) {
+ if ( parentWindow ) {
//g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(floating_window_delete_present), parent);
gtk_window_deiconify( parentWindow );
}
- GtkAccelGroup* accel = ui::AccelGroup();
- gtk_window_add_accel_group( window, accel );
+ auto accel = ui::AccelGroup();
+ window.add_accel_group( accel );
GtkVBox* vbox = create_dialog_vbox( 8, 8 );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
return FALSE;
}
-unsigned int connect_floating( GtkWindow* main_window, GtkWindow* floating ){
+unsigned int connect_floating( ui::Window main_window, ui::Window floating ){
return g_signal_connect( G_OBJECT( main_window ), "window_state_event", G_CALLBACK( main_window_iconified ), floating );
}
-gboolean destroy_disconnect_floating( GtkWindow* widget, gpointer data ){
+gboolean destroy_disconnect_floating( ui::Window widget, gpointer data ){
g_signal_handler_disconnect( G_OBJECT( data ), gpointer_to_int( g_object_get_data( G_OBJECT( widget ), "floating_handler" ) ) );
return FALSE;
}
-gboolean floating_window_delete_present( GtkWindow* floating, GdkEventFocus *event, GtkWindow* main_window ){
+gboolean floating_window_delete_present( ui::Window floating, GdkEventFocus *event, ui::Window main_window ){
if ( gtk_window_is_active( floating ) || gtk_window_is_active( main_window ) ) {
gtk_window_present( main_window );
}
return FALSE;
}
-guint connect_floating_window_delete_present( GtkWindow* floating, GtkWindow* main_window ){
+guint connect_floating_window_delete_present( ui::Window floating, ui::Window main_window ){
return g_signal_connect( G_OBJECT( floating ), "delete_event", G_CALLBACK( floating_window_delete_present ), main_window );
}
-gboolean floating_window_destroy_present( GtkWindow* floating, GtkWindow* main_window ){
+gboolean floating_window_destroy_present( ui::Window floating, ui::Window main_window ){
if ( gtk_window_is_active( floating ) || gtk_window_is_active( main_window ) ) {
gtk_window_present( main_window );
}
return FALSE;
}
-guint connect_floating_window_destroy_present( GtkWindow* floating, GtkWindow* main_window ){
+guint connect_floating_window_destroy_present( ui::Window floating, ui::Window main_window ){
return g_signal_connect( G_OBJECT( floating ), "destroy", G_CALLBACK( floating_window_destroy_present ), main_window );
}
-GtkWindow* create_floating_window( const char* title, GtkWindow* parent ){
- GtkWindow* window = ui::Window( ui::window_type::TOP );
+ui::Window create_floating_window( const char* title, ui::Window parent ){
+ ui::Window window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( window, title );
- if ( parent != 0 ) {
+ if ( parent ) {
gtk_window_set_transient_for( window, parent );
connect_floating_window_destroy_present( window, parent );
g_object_set_data( G_OBJECT( window ), "floating_handler", gint_to_pointer( connect_floating( parent, window ) ) );
return window;
}
-void destroy_floating_window( GtkWindow* window ){
+void destroy_floating_window( ui::Window window ){
gtk_widget_destroy( GTK_WIDGET( window ) );
}
return FALSE;
}
-gboolean persistent_floating_window_delete( GtkWindow* floating, GdkEvent *event, GtkWindow* main_window ){
+gboolean persistent_floating_window_delete( ui::Window floating, GdkEvent *event, ui::Window main_window ){
gtk_widget_hide( GTK_WIDGET( floating ) );
return TRUE;
}
-GtkWindow* create_persistent_floating_window( const char* title, GtkWindow* main_window ){
- GtkWindow* window = GTK_WINDOW( create_floating_window( title, main_window ) );
+ui::Window create_persistent_floating_window( const char* title, ui::Window main_window ){
+ ui::Window window = ui::Window(GTK_WINDOW( create_floating_window( title, main_window ) ));
gtk_widget_set_events( GTK_WIDGET( window ), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK );
return FALSE;
}
-void window_remove_minmax( GtkWindow* window ){
+void window_remove_minmax( ui::Window window ){
g_signal_connect( G_OBJECT( window ), "realize", G_CALLBACK( window_realize_remove_minmax ), 0 );
}
#define INCLUDED_GTKUTIL_WINDOW_H
#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "debugging/debugging.h"
#include "generic/callback.h"
return FALSE;
}
-inline guint window_connect_focus_in_clear_focus_widget( GtkWindow* window ){
+inline guint window_connect_focus_in_clear_focus_widget( ui::Window window ){
return g_signal_connect( G_OBJECT( window ), "focus_in_event", G_CALLBACK( window_focus_in_clear_focus_widget ), NULL );
}
-unsigned int connect_floating( GtkWindow* main_window, GtkWindow* floating );
-GtkWindow* create_floating_window( const char* title, GtkWindow* parent );
-void destroy_floating_window( GtkWindow* window );
+unsigned int connect_floating( ui::Window main_window, ui::Window floating );
+ui::Window create_floating_window( const char* title, ui::Window parent );
+void destroy_floating_window( ui::Window window );
-GtkWindow* create_persistent_floating_window( const char* title, GtkWindow* main_window );
-gboolean persistent_floating_window_delete( GtkWindow* floating, GdkEvent *event, GtkWindow* main_window );
+ui::Window create_persistent_floating_window( const char* title, ui::Window main_window );
+gboolean persistent_floating_window_delete( ui::Window floating, GdkEvent *event, ui::Window main_window );
-void window_remove_minmax( GtkWindow* window );
+void window_remove_minmax( ui::Window window );
typedef struct _GtkScrolledWindow GtkScrolledWindow;
GtkScrolledWindow* create_scrolled_window( GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, int border = 0 );
const WindowPosition c_default_window_pos( 50, 25, 400, 300 );
-inline void window_get_position( GtkWindow* window, WindowPosition& position ){
- ASSERT_MESSAGE( window != 0, "error saving window position" );
+inline void window_get_position( ui::Window window, WindowPosition& position ){
+ ASSERT_MESSAGE( window , "error saving window position" );
gtk_window_get_position( window, &position.x, &position.y );
gtk_window_get_size( window, &position.w, &position.h );
}
-inline void window_set_position( GtkWindow* window, const WindowPosition& position ){
+inline void window_set_position( ui::Window window, const WindowPosition& position ){
gtk_window_set_gravity( window, GDK_GRAVITY_STATIC );
GdkScreen* screen = gdk_screen_get_default();
: m_position( c_default_window_pos ){
}
-void sync( GtkWindow* window ){
+void sync( ui::Window window ){
window_set_position( window, m_position );
}
-void connect( GtkWindow* window ){
+void connect( ui::Window window ){
sync( window );
g_signal_connect( G_OBJECT( window ), "configure_event", G_CALLBACK( configure ), this );
}
type == window_type::TOP ? GTK_WINDOW_TOPLEVEL :
type == window_type::POPUP ? GTK_WINDOW_POPUP :
GTK_WINDOW_TOPLEVEL)))
- { };
+ {};
Window Window::create_dialog_window(const char *title, void func(), void *data, int default_w, int default_h)
{
return g_signal_connect_closure(G_OBJECT(*this), "key-press-event", clos, false);
}
+ void Window::add_accel_group(AccelGroup group)
+ {
+ gtk_window_add_accel_group(*this, group);
+ }
+
AccelGroup::AccelGroup() : AccelGroup(GTK_ACCEL_GROUP(gtk_accel_group_new()))
- { }
+ {}
Adjustment::Adjustment(double value,
double lower, double upper,
double page_size)
: Adjustment(
GTK_ADJUSTMENT(gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size)))
- { }
+ {}
Alignment::Alignment(float xalign, float yalign, float xscale, float yscale)
: Alignment(GTK_ALIGNMENT(gtk_alignment_new(xalign, yalign, xscale, yscale)))
- { }
+ {}
Button::Button() : Button(GTK_BUTTON(gtk_button_new()))
- { }
+ {}
Button::Button(const char *label) : Button(GTK_BUTTON(gtk_button_new_with_label(label)))
- { }
+ {}
CellRendererText::CellRendererText() : CellRendererText(GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new()))
- { }
+ {}
ComboBoxText::ComboBoxText() : ComboBoxText(GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new()))
- { }
+ {}
CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label)))
- { }
+ {}
Entry::Entry() : Entry(GTK_ENTRY(gtk_entry_new()))
- { }
+ {}
Entry::Entry(std::size_t max_length) : Entry()
{
}
Frame::Frame(const char *label) : Frame(GTK_FRAME(gtk_frame_new(label)))
- { }
+ {}
HBox::HBox(bool homogenous, int spacing) : HBox(GTK_HBOX(gtk_hbox_new(homogenous, spacing)))
- { }
+ {}
HScale::HScale(Adjustment adjustment) : HScale(GTK_HSCALE(gtk_hscale_new(adjustment)))
- { }
+ {}
HScale::HScale(double min, double max, double step) : HScale(GTK_HSCALE(gtk_hscale_new_with_range(min, max, step)))
- { }
+ {}
Image::Image() : Image(GTK_IMAGE(gtk_image_new()))
- { }
+ {}
Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
- { }
+ {}
Menu::Menu() : Menu(GTK_MENU(gtk_menu_new()))
- { }
+ {}
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)))
- { }
+ {}
HPaned::HPaned() : HPaned(GTK_HPANED(gtk_hpaned_new()))
- { }
+ {}
VPaned::VPaned() : VPaned(GTK_VPANED(gtk_vpaned_new()))
- { }
+ {}
ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr)))
- { }
+ {}
SpinButton::SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits) : SpinButton(
GTK_SPIN_BUTTON(gtk_spin_button_new(adjustment, climb_rate, digits)))
- { }
+ {}
Table::Table(std::size_t rows, std::size_t columns, bool homogenous) : Table(
GTK_TABLE(gtk_table_new(rows, columns, homogenous)))
- { }
+ {}
TextView::TextView() : TextView(GTK_TEXT_VIEW(gtk_text_view_new()))
- { }
+ {}
TreePath::TreePath() : TreePath(gtk_tree_path_new())
- { }
+ {}
TreePath::TreePath(const char *path) : TreePath(gtk_tree_path_new_from_string(path))
- { }
+ {}
TreeView::TreeView() : TreeView(GTK_TREE_VIEW(gtk_tree_view_new()))
- { }
+ {}
TreeView::TreeView(TreeModel model) : TreeView(GTK_TREE_VIEW(gtk_tree_view_new_with_model(model)))
- { }
+ {}
TreeViewColumn::TreeViewColumn(const char *title, CellRenderer renderer,
std::initializer_list<TreeViewColumnAttribute> attributes)
};
VBox::VBox(bool homogenous, int spacing) : VBox(GTK_VBOX(gtk_vbox_new(homogenous, spacing)))
- { }
+ {}
}
explicit name(impl *h) : super(reinterpret_cast<super::native *>(h)) {} \
methods \
}; \
+ inline bool operator<(name self, name other) { return self._handle < other._handle; } \
static_assert(sizeof(name) == sizeof(super), "object slicing")
WRAP(AccelGroup, Object, ui_accelgroup,
std::uint64_t on_key_press(bool (*f)(Widget widget, ui_evkey *event, void *extra),
void *extra = nullptr);
+
+ void add_accel_group(AccelGroup group);
);
#undef WRAP
return accelerator_window_key_press(widget, event, dialogptr);
}, &dialog);
- GtkAccelGroup* accel = ui::AccelGroup();
- gtk_window_add_accel_group( window, accel );
+ auto accel = ui::AccelGroup();
+ window.add_accel_group( accel );
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
virtual void exportData() const = 0;
};
-typedef struct _GtkWindow GtkWindow;
typedef struct _GtkToggleButton GtkToggleButton;
typedef struct _GtkRadioButton GtkRadioButton;
typedef struct _GtkSpinButton GtkSpinButton;
ui::Window window = ui::Window(create_persistent_floating_window( "Entity List", main_window ));
- gtk_window_add_accel_group( window, global_accel );
+ window.add_accel_group(global_accel);
getEntityList().m_positionTracker.connect( window );
ui::Window window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog );
- GtkAccelGroup* accel = ui::AccelGroup();
- gtk_window_add_accel_group( window, accel );
+ auto accel = ui::AccelGroup();
+ window.add_accel_group( accel );
{
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
- GtkAccelGroup* accel = ui::AccelGroup();
- gtk_window_add_accel_group( window, accel );
+ auto accel = ui::AccelGroup();
+ window.add_accel_group( accel );
{
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Light intensity", dialog, -1, -1 );
- GtkAccelGroup *accel_group = ui::AccelGroup();
- gtk_window_add_accel_group( window, accel_group );
+ auto accel_group = ui::AccelGroup();
+ window.add_accel_group( accel_group );
{
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
- GtkAccelGroup *accel_group = ui::AccelGroup();
- gtk_window_add_accel_group( window, accel_group );
+ auto accel_group = ui::AccelGroup();
+ window.add_accel_group( accel_group );
{
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
- GtkAccelGroup *accel_group = ui::AccelGroup();
- gtk_window_add_accel_group( window, accel_group );
+ auto accel_group = ui::AccelGroup();
+ window.add_accel_group( accel_group );
{
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( parent ) );
}
- bool ok = modal_dialog_show( GTK_WINDOW( dlg ), dialog ) == eIDOK;
+ bool ok = modal_dialog_show( ui::Window(GTK_WINDOW( dlg )), dialog ) == eIDOK;
if ( ok ) {
gtk_color_selection_get_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG( dlg )) ), &clr );
color[0] = clr.red / 65535.0f;
Radiant_Initialise();
- global_accel_init();
-
user_shortcuts_init();
g_pParentWnd = 0;
user_shortcuts_save();
- global_accel_destroy();
-
Radiant_Shutdown();
// close the log file if any
class ZWnd;
typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
const int c_command_status = 0;
const int c_position_status = 1;
ui::Window window = MainFrame_getWindow().create_dialog_window("Find Brush", G_CALLBACK(dialog_delete_callback ), &dialog );
- GtkAccelGroup* accel = ui::AccelGroup();
- gtk_window_add_accel_group( window, accel );
+ auto accel = ui::AccelGroup();
+ window.add_accel_group( accel );
{
GtkVBox* vbox = create_dialog_vbox( 4, 4 );
ui::Window window = MainFrame_getWindow().create_dialog_window("Patch density", G_CALLBACK(dialog_delete_callback ), &dialog );
- GtkAccelGroup* accel = ui::AccelGroup();
- gtk_window_add_accel_group( window, accel );
+ auto accel = ui::AccelGroup();
+ window.add_accel_group( accel );
{
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
ui::Window window = MainFrame_getWindow().create_modal_dialog_window( "Cap", dialog );
- GtkAccelGroup *accel_group = ui::AccelGroup();
- gtk_window_add_accel_group( window, accel_group );
+ auto accel_group = ui::AccelGroup();
+ window.add_accel_group( accel_group );
{
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
if ( !g_rotate_dialog.window ) {
g_rotate_dialog.window = MainFrame_getWindow().create_dialog_window("Arbitrary rotation", G_CALLBACK(rotatedlg_delete ), &g_rotate_dialog );
- GtkAccelGroup* accel = ui::AccelGroup();
- gtk_window_add_accel_group( g_rotate_dialog.window, accel );
+ auto accel = ui::AccelGroup();
+ g_rotate_dialog.window.add_accel_group( accel );
{
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
if ( !g_scale_dialog.window ) {
g_scale_dialog.window = MainFrame_getWindow().create_dialog_window("Arbitrary scale", G_CALLBACK(scaledlg_delete ), &g_scale_dialog );
- GtkAccelGroup* accel = ui::AccelGroup();
- gtk_window_add_accel_group( g_scale_dialog.window, accel );
+ auto accel = ui::AccelGroup();
+ g_scale_dialog.window.add_accel_group( accel );
{
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) );
GlobalToggles_insert( "ToggleFrontView", ToggleShown::ToggleCaller( g_xz_front_shown ), ToggleItem::AddCallbackCaller( g_xz_front_shown.m_item ) );
- GlobalCommands_insert( "NextView", FreeCaller<XY_Next>(), Accelerator( GDK_KEY_Tab, (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "NextView", FreeCaller<XY_Next>(), Accelerator( GDK_KEY_Tab, (GdkModifierType)GDK_CONTROL_MASK ) ); // fixme: doesn't show its shortcut
GlobalCommands_insert( "ZoomIn", FreeCaller<XY_ZoomIn>(), Accelerator( GDK_KEY_Delete ) );
GlobalCommands_insert( "ZoomOut", FreeCaller<XY_ZoomOut>(), Accelerator( GDK_KEY_Insert ) );
GlobalCommands_insert( "ViewTop", FreeCaller<XY_Top>(), Accelerator( GDK_KEY_KP_Home ) );