int linkNum;
};
-typedef struct _GtkWidget GtkWidget;
-
struct TwinWidget {
GtkWidget* one;
GtkComboBox* two;
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkButton GtkButton;
namespace callbacks {
#if !defined( INCLUDED_IGTKGL_H )
#define INCLUDED_IGTKGL_H
+#include <uilib/uilib.h>
#include "generic/constant.h"
-typedef struct _GtkWidget GtkWidget;
typedef int gint;
typedef gint gboolean;
INTEGER_CONSTANT( Version, 1 );
STRING_CONSTANT( Name, "gtkgl" );
- GtkWidget* ( *glwidget_new )(gboolean zbufffer);
- void ( *glwidget_swap_buffers )( GtkWidget* widget );
- gboolean ( *glwidget_make_current )( GtkWidget* widget );
- void ( *glwidget_destroy_context )( GtkWidget* widget );
- void ( *glwidget_create_context )( GtkWidget* widget );
+ ui::Widget ( *glwidget_new )(gboolean zbufffer);
+ void ( *glwidget_swap_buffers )( ui::Widget widget );
+ gboolean ( *glwidget_make_current )( ui::Widget widget );
+ void ( *glwidget_destroy_context )( ui::Widget widget );
+ void ( *glwidget_create_context )( ui::Widget widget );
};
#endif
// load a .bmp file and create a GtkImage widget from it
// NOTE: 'filename' is relative to <radiant_path>/plugins/bitmaps/
-typedef struct _GtkImage GtkImage;
typedef ui::Image ( *PFN_QERAPP_NEWIMAGE )( const char* filename );
// ========================================
return FALSE;
}
-void PressedButtons_connect( PressedButtons& pressedButtons, GtkWidget* widget ){
+void PressedButtons_connect( PressedButtons& pressedButtons, ui::Widget widget ){
g_signal_connect( G_OBJECT( widget ), "button_press_event", G_CALLBACK( PressedButtons_button_press ), &pressedButtons );
g_signal_connect( G_OBJECT( widget ), "button_release_event", G_CALLBACK( PressedButtons_button_release ), &pressedButtons );
g_signal_connect( G_OBJECT( widget ), "focus_out_event", G_CALLBACK( PressedButtons_focus_out ), &pressedButtons );
void keyup_accelerators_add( Accelerator accelerator, const Callback& callback );
void keyup_accelerators_remove( Accelerator accelerator );
-typedef struct _GtkWidget GtkWidget;
void global_accel_connect_window( ui::Window window );
void global_accel_disconnect_window( ui::Window window );
struct PressedButtons;
-typedef struct _GtkWidget GtkWidget;
-void PressedButtons_connect( PressedButtons& pressedButtons, GtkWidget* widget );
+void PressedButtons_connect( PressedButtons& pressedButtons, ui::Widget widget );
extern PressedButtons g_pressedButtons;
namespace
{
-GtkWidget* g_shared = 0;
+ ui::Widget g_shared;
}
-gint glwidget_context_created( GtkWidget* widget, gpointer data ){
+gint glwidget_context_created( ui::Widget widget, gpointer data ){
if ( ++g_context_count == 1 ) {
g_shared = widget;
g_object_ref( g_shared );
return FALSE;
}
-gint glwidget_context_destroyed( GtkWidget* widget, gpointer data ){
+gint glwidget_context_destroyed( ui::Widget widget, gpointer data ){
if ( --g_context_count == 0 ) {
GlobalOpenGL().contextValid = false;
GLWidget_sharedContextDestroyed();
g_object_unref( g_shared );
- g_shared = 0;
+ g_shared = ui::Widget(nullptr);
}
return FALSE;
}
-gboolean glwidget_enable_gl( GtkWidget* widget, GtkWidget* widget2, gpointer data ){
- if ( widget2 == 0 && !gtk_widget_is_gl_capable( widget ) ) {
+gboolean glwidget_enable_gl( ui::Widget widget, ui::Widget widget2, gpointer data ){
+ if ( !widget2 && !gtk_widget_is_gl_capable( widget ) ) {
GdkGLConfig* glconfig = ( g_object_get_data( G_OBJECT( widget ), "zbuffer" ) ) ? glconfig_new_with_depth() : glconfig_new();
ASSERT_MESSAGE( glconfig != 0, "failed to create OpenGL config" );
- gtk_widget_set_gl_capability( widget, glconfig, g_shared != 0 ? gtk_widget_get_gl_context( g_shared ) : 0, TRUE, GDK_GL_RGBA_TYPE );
+ gtk_widget_set_gl_capability( widget, glconfig, g_shared ? gtk_widget_get_gl_context( g_shared ) : 0, TRUE, GDK_GL_RGBA_TYPE );
gtk_widget_realize( widget );
- if ( g_shared == 0 ) {
+ if ( !g_shared ) {
g_shared = widget;
}
return FALSE;
}
-GtkWidget* glwidget_new( gboolean zbuffer ){
- GtkWidget* widget = gtk_drawing_area_new();
+ui::Widget glwidget_new( gboolean zbuffer ){
+ auto widget = ui::Widget(gtk_drawing_area_new());
g_object_set_data( G_OBJECT( widget ), "zbuffer", gint_to_pointer( zbuffer ) );
return widget;
}
-void glwidget_destroy_context( GtkWidget *widget ){
+void glwidget_destroy_context( ui::Widget widget ){
}
-void glwidget_create_context( GtkWidget *widget ){
+void glwidget_create_context( ui::Widget widget ){
}
-void glwidget_swap_buffers( GtkWidget *widget ){
+void glwidget_swap_buffers( ui::Widget widget ){
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable( widget );
gdk_gl_drawable_swap_buffers( gldrawable );
}
-gboolean glwidget_make_current( GtkWidget *widget ){
+gboolean glwidget_make_current( ui::Widget widget ){
GdkGLContext *glcontext = gtk_widget_get_gl_context( widget );
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable( widget );
return gdk_gl_drawable_gl_begin( gldrawable, glcontext );
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_GTKUTIL_GLWIDGET_H )
#define INCLUDED_GTKUTIL_GLWIDGET_H
-typedef struct _GtkWidget GtkWidget;
typedef int gint;
typedef gint gboolean;
-GtkWidget* glwidget_new( gboolean zbuffer );
-void glwidget_swap_buffers( GtkWidget* widget );
-gboolean glwidget_make_current( GtkWidget* widget );
-void glwidget_destroy_context( GtkWidget* widget );
-void glwidget_create_context( GtkWidget* widget );
+ui::Widget glwidget_new( gboolean zbuffer );
+void glwidget_swap_buffers( ui::Widget widget );
+gboolean glwidget_make_current( ui::Widget widget );
+void glwidget_destroy_context( ui::Widget widget );
+void glwidget_create_context( ui::Widget widget );
extern void ( *GLWidget_sharedContextCreated )();
extern void ( *GLWidget_sharedContextDestroyed )();
gtk_main();
}
+ void process()
+ {
+ while (gtk_events_pending()) {
+ gtk_main_iteration();
+ }
+ }
+
Widget root{nullptr};
#define IMPL(T, F) template<> _IMPL(T, F)
void main();
+ void process();
+
extern class Widget root;
enum class alert_type {
#include "preferences.h"
#include "qe3.h"
-typedef struct _GtkMenuItem GtkMenuItem;
-
class BuildMenuItem
{
const char* m_name;
void GlobalCamera_setCamWnd( CamWnd& camwnd );
void fill_view_camera_menu( ui::Menu menu );
-typedef struct _GtkToolbar GtkToolbar;
void CamWnd_constructToolbar( ui::Toolbar toolbar );
void CamWnd_registerShortcuts();
virtual void exportData() const = 0;
};
-typedef struct _GtkToggleButton GtkToggleButton;
-typedef struct _GtkRadioButton GtkRadioButton;
-typedef struct _GtkSpinButton GtkSpinButton;
-typedef struct _GtkComboBox GtkComboBox;
-typedef struct _GtkEntry GtkEntry;
-typedef struct _GtkAdjustment GtkAdjustment;
template<typename FirstArgument>
class CallbackDialogData;
void RedrawEntityList();
typedef FreeCaller<RedrawEntityList> RedrawEntityListCaller;
-typedef struct _GtkTreeView GtkTreeView;
class EntityList
{
void Draw2D( VIEWTYPE vt );
};
-typedef struct _GtkListStore GtkListStore;
class CDbgDlg : public Dialog
{
global_accel_group_disconnect( toggle.m_command.m_accelerator, toggle.m_command.m_callback );
}
-GtkCheckMenuItem* create_check_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const char* commandName ){
+ui::CheckMenuItem 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( ui::Menu menu, const char *mnemonic, const char* commandName ){
+ui::MenuItem 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 );
return ok;
}
-void button_clicked_entry_browse_file( ui::Widget widget, GtkEntry* entry ){
+void button_clicked_entry_browse_file( ui::Widget widget, ui::Entry entry ){
const char *filename = ui::Widget(gtk_widget_get_toplevel( widget )).file_dialog( TRUE, "Choose File", gtk_entry_get_text( entry ) );
if ( filename != 0 ) {
}
}
-void button_clicked_entry_browse_directory( ui::Widget widget, GtkEntry* entry ){
+void button_clicked_entry_browse_directory( ui::Widget widget, ui::Entry entry ){
const char* text = gtk_entry_get_text( entry );
char *dir = dir_dialog( ui::Widget(gtk_widget_get_toplevel( widget )), "Choose Directory", path_is_absolute( text ) ? text : "" );
#if !defined( INCLUDED_GTKMISC_H )
#define INCLUDED_GTKMISC_H
-#include <gtk/gtk.h>
#include <uilib/uilib.h>
-inline void process_gui(){
- while ( gtk_events_pending() )
- {
- gtk_main_iteration();
- }
-}
-
void command_connect_accelerator( const char* commandName );
void command_disconnect_accelerator( const char* commandName );
void toggle_add_accelerator( const char* commandName );
void toggle_remove_accelerator( const char* name );
-typedef struct _GtkMenu GtkMenu;
-typedef struct _GtkMenuItem GtkMenuItem;
-typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
-
// this also sets up the shortcut using command_connect_accelerator
-GtkMenuItem* create_menu_item_with_mnemonic( ui::Menu menu, const char *mnemonic, const char* commandName );
+ui::MenuItem 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( ui::Menu menu, const char* mnemonic, const char* commandName );
+ui::CheckMenuItem create_check_menu_item_with_mnemonic( ui::Menu menu, const char* mnemonic, const char* commandName );
-typedef struct _GtkButton GtkButton;
-typedef struct _GtkToggleButton GtkToggleButton;
-typedef struct _GtkToolbar GtkToolbar;
// this DOES NOT set up the shortcut using command_connect_accelerator
ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon, const char* commandName );
typedef BasicVector3<float> Vector3;
bool color_dialog( ui::Widget parent, Vector3& color, const char* title = "Choose Color" );
-typedef struct _GtkEntry GtkEntry;
-void button_clicked_entry_browse_file( ui::Widget widget, GtkEntry* entry );
-void button_clicked_entry_browse_directory( ui::Widget widget, GtkEntry* entry );
+void button_clicked_entry_browse_file( ui::Widget widget, ui::Entry entry );
+void button_clicked_entry_browse_directory( ui::Widget widget, ui::Entry entry );
#endif
void ScreenUpdates_process(){
if ( redrawRequired() && gtk_widget_get_visible( g_wait.m_window ) ) {
- process_gui();
+ ui::process();
}
}
if ( g_wait_stack.empty() ) {
EverySecondTimer_disable();
- process_gui();
+ ui::process();
bool isActiveApp = MainFrame_isActiveApp();
void show_splash(){
splash_screen = create_splash();
- process_gui();
+ ui::process();
}
void hide_splash(){
class CamWnd;
class ZWnd;
-typedef struct _GtkWidget GtkWidget;
const int c_command_status = 0;
const int c_position_status = 1;
Scene_forEachVisibleSelectedPatch( PatchSetFixedSubdivisions( subdivisions ) );
}
-typedef struct _GtkCheckButton GtkCheckButton;
class Subdivisions
{
}
}
-GtkMenuItem* create_plugins_menu(){
+ui::MenuItem create_plugins_menu(){
// Plugins menu
- GtkMenuItem* plugins_menu_item = new_sub_menu_item_with_mnemonic( "_Plugins" );
+ auto plugins_menu_item = new_sub_menu_item_with_mnemonic( "_Plugins" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( plugins_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_PLUGINMENU_H )
#define INCLUDED_PLUGINMENU_H
-typedef struct _GtkMenuItem GtkMenuItem;
-GtkMenuItem* create_plugins_menu();
+ui::MenuItem create_plugins_menu();
-typedef struct _GtkMenu GtkMenu;
-typedef struct _GtkMenuItem GtkMenuItem;
void PluginsMenu_populate();
void PluginsMenu_clear();
textureBrowser->m_heightChanged = true;
textureBrowser->m_tag_frame.show();
- process_gui();
+ ui::process();
TextureBrowser_Focus( *textureBrowser, textureBrowser->shader.c_str() );
}
{
class Node;
}
-typedef struct _GtkMenu GtkMenu;
void FlipClip();