switch ( m_vt )
{
case XY:
- m_pTabLabel = gtk_label_new( "X/Y" );
+ m_pTabLabel = ui::Label( "X/Y" );
m_pImage = &backgroundXY;
break;
case XZ:
- m_pTabLabel = gtk_label_new( "X/Z" );
+ m_pTabLabel = ui::Label( "X/Z" );
m_pImage = &backgroundXZ;
break;
case YZ:
- m_pTabLabel = gtk_label_new( "Y/Z" );
+ m_pTabLabel = ui::Label( "Y/Z" );
m_pImage = &backgroundYZ;
break;
}
gtk_container_add( GTK_CONTAINER( frame ), hbox );
// label to display filename
- m_pFileLabel = gtk_label_new( NO_FILE_MSG );
+ m_pFileLabel = ui::Label( NO_FILE_MSG );
gtk_label_set_selectable( GTK_LABEL( m_pFileLabel ),TRUE );
//TODO set min size ? done with spaces right now
gtk_box_pack_start( GTK_BOX( hbox ),m_pFileLabel, TRUE, TRUE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ),4 );
gtk_container_add( GTK_CONTAINER( frame ), hbox );
- w = gtk_label_new( "Vertex alpha:" );
+ w = ui::Label( "Vertex alpha:" );
gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 );
gtk_widget_show( w );
*/
EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMessageBoxType type ){
- GtkWidget *window, *w, *vbox, *hbox;
+ ui::Widget window, w, vbox, hbox;
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Widget(gtk_window_new( GTK_WINDOW_TOPLEVEL ));
gtk_signal_connect( GTK_OBJECT( window ), "delete_event",
GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
gtk_signal_connect( GTK_OBJECT( window ), "destroy",
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::Widget(gtk_vbox_new( FALSE, 10 ));
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
- w = gtk_label_new( lpText );
+ w = ui::Label( lpText );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
- w = gtk_hseparator_new();
+ w = ui::Widget(gtk_hseparator_new());
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_widget_show( w );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::Widget(gtk_hbox_new( FALSE, 10 ));
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
if ( type == eMB_OK ) {
- w = gtk_button_new_with_label( "Ok" );
+ w = ui::Widget(gtk_button_new_with_label( "Ok" ));
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
ret = eIDOK;
}
else if ( type == eMB_OKCANCEL ) {
- w = gtk_button_new_with_label( "Ok" );
+ w = ui::Widget(gtk_button_new_with_label( "Ok" ));
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = gtk_button_new_with_label( "Cancel" );
+ w = ui::Widget(gtk_button_new_with_label( "Cancel" ));
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
ret = eIDCANCEL;
}
else if ( type == eMB_YESNOCANCEL ) {
- w = gtk_button_new_with_label( "Yes" );
+ w = ui::Widget(gtk_button_new_with_label( "Yes" ));
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = gtk_button_new_with_label( "No" );
+ w = ui::Widget(gtk_button_new_with_label( "No" ));
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
gtk_widget_show( w );
- w = gtk_button_new_with_label( "Cancel" );
+ w = ui::Widget(gtk_button_new_with_label( "Cancel" ));
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
}
else /* if (mode == MB_YESNO) */
{
- w = gtk_button_new_with_label( "Yes" );
+ w = ui::Widget(gtk_button_new_with_label( "Yes" ));
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = gtk_button_new_with_label( "No" );
+ w = ui::Widget(gtk_button_new_with_label( "No" ));
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
gtk_box_pack_start( GTK_BOX( hbox2 ), text1, FALSE, FALSE, 2 );
gtk_widget_show( text1 );
- w = gtk_label_new( "Number Of Sides" );
+ w = ui::Label( "Number Of Sides" );
gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox2 ), text2, FALSE, FALSE, 2 );
gtk_widget_show( text2 );
- w = gtk_label_new( "Border Width" );
+ w = ui::Label( "Border Width" );
gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
gtk_widget_show( hbox );
// dunno if you want this text or not ...
- w = gtk_label_new( text );
+ w = ui::Label( text );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); // not entirely sure on all the parameters / what they do ...
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), textStairHeight, FALSE, FALSE, 1 );
gtk_widget_show( textStairHeight );
- w = gtk_label_new( "Stair Height" );
+ w = ui::Label( "Stair Height" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Direction:" );
+ w = ui::Label( "Direction:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 5 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Style:" );
+ w = ui::Label( "Style:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 5 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), textMainTex, FALSE, FALSE, 0 );
gtk_widget_show( textMainTex );
- w = gtk_label_new( "Main Texture" );
+ w = ui::Label( "Main Texture" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), textRiserTex, FALSE, FALSE, 0 );
gtk_widget_show( textRiserTex );
- w = gtk_label_new( "Riser Texture" );
+ w = ui::Label( "Riser Texture" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), textFrontBackTex, FALSE, FALSE, 0 );
gtk_widget_show( textFrontBackTex );
- w = gtk_label_new( "Door Front/Back Texture" );
+ w = ui::Label( "Door Front/Back Texture" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), textTrimTex, FALSE, FALSE, 0 );
gtk_widget_show( textTrimTex );
- w = gtk_label_new( "Door Trim Texture" );
+ w = ui::Label( "Door Trim Texture" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Orientation" );
+ w = ui::Label( "Orientation" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), text1, FALSE, FALSE, 2 );
gtk_widget_show( text1 );
- w = gtk_label_new( "Number Of Points" );
+ w = ui::Label( "Number Of Points" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), text2, FALSE, FALSE, 2 );
gtk_widget_show( text2 );
- w = gtk_label_new( "Multipler" );
+ w = ui::Label( "Multipler" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
// ---- /hbox ----
- w = gtk_label_new( "Path Distance = dist(start -> apex) * multiplier" );
+ w = ui::Label( "Path Distance = dist(start -> apex) * multiplier" );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), text3, FALSE, FALSE, 2 );
gtk_widget_show( text3 );
- w = gtk_label_new( "Gravity" );
+ w = ui::Label( "Gravity" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
texSelected = "Currently Selected Texture: ";
texSelected += GetCurrentTexture();
- w = gtk_label_new( texSelected );
+ w = ui::Label( texSelected );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "Old Name: " );
+ w = ui::Label( "Old Name: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( dlgTexReset.editTexOld );
- w = gtk_label_new( "New Name: " );
+ w = ui::Label( "New Name: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "New Horizontal Scale: " );
+ w = ui::Label( "New Horizontal Scale: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "New Vertical Scale: " );
+ w = ui::Label( "New Vertical Scale: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "New Horizontal Shift: " );
+ w = ui::Label( "New Horizontal Shift: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "New Vertical Shift: " );
+ w = ui::Label( "New Vertical Shift: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "New Rotation Value: " );
+ w = ui::Label( "New Rotation Value: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
// ---- frame ----
- w = gtk_label_new( "X: " );
+ w = ui::Label( "X: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "Y: " );
+ w = ui::Label( "Y: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
// ---- frame ----
- w = gtk_label_new( "Start: " );
+ w = ui::Label( "Start: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "End: " );
+ w = ui::Label( "End: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
// ---- frame ----
- w = gtk_label_new( "Start: " );
+ w = ui::Label( "Start: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "End: " );
+ w = ui::Label( "End: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
// ---- frame ----
- w = gtk_label_new( "Number: " );
+ w = ui::Label( "Number: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( hbox );
// dunno if you want this text or not ...
- w = gtk_label_new( text );
+ w = ui::Label( text );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), textlinkNum, FALSE, FALSE, 1 );
gtk_widget_show( textlinkNum );
- w = gtk_label_new( "Number of elements in chain" );
+ w = ui::Label( "Number of elements in chain" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), textlinkName, FALSE, FALSE, 0 );
gtk_widget_show( textlinkName );
- w = gtk_label_new( "Basename for chain's targetnames." );
+ w = ui::Label( "Basename for chain's targetnames." );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
gtk_widget_show( w );
}
void OnExportClicked( GtkButton* button, gpointer user_data ){
- GtkWidget* window = lookup_widget( GTK_WIDGET( button ), "w_plugplug2" );
+ ui::Widget window = lookup_widget( GTK_WIDGET( button ), "w_plugplug2" );
ASSERT_NOTNULL( window );
const char* cpath = GlobalRadiant().m_pfnFileDialog( window, false, "Save as Obj", 0, 0, false, false, true );
if ( !cpath ) {
{
radio = lookup_widget( GTK_WIDGET( button ), "r_nocollapse" );
ASSERT_NOTNULL( radio );
- ASSERT_NOTNULL( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) );
+ ASSERT_TRUE( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) );
mode = COLLAPSE_NONE;
}
}
gtk_box_pack_start( GTK_BOX( vbox1 ), vbox2, TRUE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 2 );
- label1 = gtk_label_new( "Ignored materials:" );
+ label1 = ui::Label( "Ignored materials:" );
gtk_widget_set_name( label1, "label1" );
gtk_widget_show( label1 );
gtk_box_pack_start( GTK_BOX( vbox2 ), label1, FALSE, FALSE, 0 );
// spawn plugin window (and make sure it got destroyed first or never created)
void CreateWindow( void ){
- ASSERT_NOTNULL( !g_brushexp_window );
+ ASSERT_TRUE( !g_brushexp_window );
GtkWidget* wnd = create_w_plugplug2();
namespace BrushExport
{
-GtkWindow* g_mainwnd;
+ui::Window g_mainwnd;
const char* init( void* hApp, void* pMainWidget ){
- g_mainwnd = (GtkWindow*)pMainWidget;
- ASSERT_NOTNULL( g_mainwnd );
+ g_mainwnd = ui::Window(GTK_WINDOW(pMainWidget));
+ ASSERT_TRUE( g_mainwnd );
return "";
}
const char* getName(){
void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
if ( string_equal( command, "About" ) ) {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ), "Brushexport plugin v 2.0 by namespace (www.codecreator.net)\n"
+ GlobalRadiant().m_pfnMessageBox( g_mainwnd, "Brushexport plugin v 2.0 by namespace (www.codecreator.net)\n"
"Enjoy!\n\nSend feedback to spam@codecreator.net", "About me...",
eMB_OK,
eMB_ICONDEFAULT );
#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "support.h"
-GtkWidget*
+ui::Widget
lookup_widget( GtkWidget *widget,
const gchar *widget_name ){
GtkWidget *parent, *found_widget;
if ( !found_widget ) {
g_warning( "Widget not found: %s", widget_name );
}
- return found_widget;
+ return ui::Widget(found_widget);
}
#endif
#include <gtk/gtk.h>
+#include <uilib/uilib.h>
/*
* Public Functions.
* or alternatively any widget in the component, and the name of the widget
* you want returned.
*/
-GtkWidget* lookup_widget( GtkWidget *widget,
+ui::Widget lookup_widget( GtkWidget *widget,
const gchar *widget_name );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Name:" );
+ w = ui::Label( "Name:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Name:" );
+ w = ui::Label( "Name:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Parameters:" );
+ w = ui::Label( "Parameters:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "File:" );
+ w = ui::Label( "File:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Name:" );
+ w = ui::Label( "Name:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), g_pCamName, FALSE, FALSE, 0 );
gtk_widget_show( g_pCamName );
- w = gtk_label_new( "Type: " );
+ w = ui::Label( "Type: " );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- w = gtk_label_new( "" );
+ w = ui::Label( "" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
g_pCamType = GTK_LABEL( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Edit:" );
+ w = ui::Label( "Edit:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( g_pEditModeAddRadioButton ), TRUE );
}
- w = gtk_label_new( "Type: " );
+ w = ui::Label( "Type: " );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- w = gtk_label_new( "" );
+ w = ui::Label( "" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
g_pPathType = GTK_LABEL( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Length (seconds):" );
+ w = ui::Label( "Length (seconds):" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Current Time: " );
+ w = ui::Label( "Current Time: " );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- w = gtk_label_new( "0.00" );
+ w = ui::Label( "0.00" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
g_pCurrentTime = GTK_LABEL( w );
- w = gtk_label_new( " of " );
+ w = ui::Label( " of " );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- w = gtk_label_new( "0.00" );
+ w = ui::Label( "0.00" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
g_pTotalTime = GTK_LABEL( w );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Events:" );
+ w = ui::Label( "Events:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "General" );
+ label = ui::Label( "General" );
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), table, label );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Wavelength:" );
+ label = ui::Label( "Wavelength:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
- label = gtk_label_new( "Max. amplitude:" );
+ label = ui::Label( "Max. amplitude:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
- label = gtk_label_new( "Roughness:" );
+ label = ui::Label( "Roughness:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
- label = gtk_label_new( "Random seed:" );
+ label = ui::Label( "Random seed:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- label = gtk_label_new( "Extents" );
+ label = ui::Label( "Extents" );
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "X:" );
+ label = ui::Label( "X:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "hmin_text", label );
- label = gtk_label_new( "X:" );
+ label = ui::Label( "X:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "hmax_text", label );
- label = gtk_label_new( "Y:" );
+ label = ui::Label( "Y:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "vmin_text", label );
- label = gtk_label_new( "Y:" );
+ label = ui::Label( "Y:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "vmax_text", label );
- label = gtk_label_new( "Lower-left" );
+ label = ui::Label( "Lower-left" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Upper-right" );
+ label = ui::Label( "Upper-right" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "X:" );
+ label = ui::Label( "X:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "nh_text", label );
- label = gtk_label_new( "Y:" );
+ label = ui::Label( "Y:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( extents_use_patches ), NULL );
// ^Fishman - Snap to grid, replaced scroll bar with a texbox.
- label = gtk_label_new( "Snap to grid:" );
+ label = ui::Label( "Snap to grid:" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
gtk_object_set_data( GTK_OBJECT( dlg ), "snap_text", label );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 10 );
- label = gtk_label_new( "Decimate:" );
+ label = ui::Label( "Decimate:" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Upper-left:" );
+ label = ui::Label( "Upper-left:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Lower-left:" );
+ label = ui::Label( "Lower-left:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Upper-right:" );
+ label = ui::Label( "Upper-right:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Lower-right:" );
+ label = ui::Label( "Lower-right:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- label = gtk_label_new( "Bitmap" );
+ label = ui::Label( "Bitmap" );
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
- label = gtk_label_new( "" );
+ label = ui::Label( "" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "bmp_note", label );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Filename:" );
+ label = ui::Label( "Filename:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Map color 0 to:" );
+ label = ui::Label( "Map color 0 to:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
- label = gtk_label_new( "Map color 255 to:" );
+ label = ui::Label( "Map color 255 to:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- label = gtk_label_new( "Fix Points" );
+ label = ui::Label( "Fix Points" );
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
- label = gtk_label_new( "Click on a vertex in the lower half of the preview window,\n"
+ label = ui::Label( "Click on a vertex in the lower half of the preview window,\n"
"then use the arrow keys or text box to assign a value.\n"
"Use Ctrl+Click to select multiple vertices/toggle a\n"
"selection. Use Shift+Click to select a range of vertices.\n\n"
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Value:" );
+ label = ui::Label( "Value:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
g_object_set_data( G_OBJECT( dlg ), "fix_value_text", label );
- label = gtk_label_new( "Range affected:" );
+ label = ui::Label( "Range affected:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
g_object_set_data( G_OBJECT( dlg ), "fix_range_text", label );
- label = gtk_label_new( "Rate of change:" );
+ label = ui::Label( "Rate of change:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- label = gtk_label_new( "Texture" );
+ label = ui::Label( "Texture" );
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Surface:" );
+ label = ui::Label( "Surface:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
- label = gtk_label_new( "Other:" );
+ label = ui::Label( "Other:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
- label = gtk_label_new( "Steep:" );
+ label = ui::Label( "Steep:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
- label = gtk_label_new( "\"Steep\" angle:" );
+ label = ui::Label( "\"Steep\" angle:" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Offset <h,v>" );
+ label = ui::Label( "Offset <h,v>" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Scale <h,v>" );
+ label = ui::Label( "Scale <h,v>" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 4, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
g_object_set_data( G_OBJECT( dlg ), "go", button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_go ), NULL );
- label = gtk_label_new( "Settings:" );
+ label = ui::Label( "Settings:" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 3 );
- label = gtk_label_new( "Elevation" );
+ label = ui::Label( "Elevation" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, TRUE, 0 );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_box_pack_end( GTK_BOX( hbox ), spin, FALSE, TRUE, 0 );
- label = gtk_label_new( "Azimuth" );
+ label = ui::Label( "Azimuth" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_box_pack_end( GTK_BOX( hbox ), label, FALSE, TRUE, 0 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
- w = gtk_label_new( lpText );
+ w = ui::Label( lpText );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
#include "AboutDialog.h"
#include <gtk/gtk.h>
#include <gtkutil/pointer.h>
+#include <uilib/uilib.h>
#include "version.h"
#include "gtkutil/pointer.h"
"Written by Geoffrey DeWan\ngdewan@prairienet.org\n\n"
"Built against NetRadiant " +radiant::version()+ "\n"
__DATE__;
- label = gtk_label_new( label_text.c_str() );
+ label = ui::Label( label_text.c_str() );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox ), label, TRUE, TRUE, 0 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
#include "ConfigDialog.h"
#include <stdio.h>
#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "gtkutil/pointer.h"
#include "iscenegraph.h"
gtk_box_pack_start( GTK_BOX( hbox ), lw3slider, TRUE, TRUE, 0 );
gtk_scale_set_draw_value( GTK_SCALE( lw3slider ), FALSE );
- lw3label = gtk_label_new( "" );
+ lw3label = ui::Label( "" );
gtk_widget_show( lw3label );
gtk_box_pack_start( GTK_BOX( hbox ), lw3label, FALSE, TRUE, 0 );
gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScroll3d ), lw3label );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_scale_set_draw_value( GTK_SCALE( transslider ), FALSE );
- translabel = gtk_label_new( "" );
+ translabel = ui::Label( "" );
gtk_widget_show( translabel );
gtk_table_attach( GTK_TABLE( table ), translabel, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_scale_set_draw_value( GTK_SCALE( clipslider ), FALSE );
- cliplabel = gtk_label_new( "" );
+ cliplabel = ui::Label( "" );
gtk_widget_show( cliplabel );
gtk_table_attach( GTK_TABLE( table ), cliplabel, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_box_pack_start( GTK_BOX( hbox ), lw2slider, TRUE, TRUE, 0 );
gtk_scale_set_draw_value( GTK_SCALE( lw2slider ), FALSE );
- lw2label = gtk_label_new( "" );
+ lw2label = ui::Label( "" );
gtk_widget_show( lw2label );
gtk_box_pack_start( GTK_BOX( hbox ), lw2label, FALSE, TRUE, 0 );
gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScroll2d ), lw2label );
namespace Shaderplug
{
-GtkWindow* g_window;
+ui::Window g_window;
std::vector<const char*> archives;
std::set<std::string> shaders;
void CreateTagFile();
const char* init( void* hApp, void* pMainWidget ){
- g_window = GTK_WINDOW( pMainWidget );
+ g_window = ui::Window(GTK_WINDOW( pMainWidget ));
return "";
}
const char* getName(){
}
void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
if ( string_equal( command, "About" ) ) {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), "Shaderplug (1.0)\n\n"
+ GlobalRadiant().m_pfnMessageBox( g_window, "Shaderplug (1.0)\n\n"
"by Shaderman (shaderman@gmx.net)",
"About",
eMB_OK,
strcat( message, "\nPlease restart Radiant now.\n" );
if ( file_exists( tagFile ) ) {
- EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ),
+ EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox( g_window ,
"WARNING! A tag file already exists! Overwrite it?", "Overwrite tag file?",
eMB_NOYES,
eMB_ICONWARNING );
if ( result == eIDYES ) {
TagBuilder.SaveXmlDoc( tagFile );
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), message, "INFO", eMB_OK, eMB_ICONASTERISK );
+ GlobalRadiant().m_pfnMessageBox( g_window, message, "INFO", eMB_OK, eMB_ICONASTERISK );
}
}
else {
TagBuilder.SaveXmlDoc( tagFile );
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), message, "INFO", eMB_OK, eMB_ICONASTERISK );
+ GlobalRadiant().m_pfnMessageBox( g_window, message, "INFO", eMB_OK, eMB_ICONASTERISK );
}
}
else {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ),
+ GlobalRadiant().m_pfnMessageBox( g_window,
"No shaders or textures found. No XML tag file created!\n"
"",
"ERROR",
vbox = gtk_vbox_new( FALSE, 10 ); // create a box to arrange new objects vertically
gtk_container_add( GTK_CONTAINER( window ), vbox ); // add the box to the window
- label = gtk_label_new( "SunPlug v1.0 for NetRadiant 1.5\nby Topsun" ); // create a label
+ label = ui::Label( "SunPlug v1.0 for NetRadiant 1.5\nby Topsun" ); // create a label
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // text align left
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 2 ); // insert the label in the box
gtk_table_set_col_spacings( GTK_TABLE( table ), 8 ); // set column spacings
gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, FALSE, 2 ); // insert table into vbox
- label = gtk_label_new( "x" ); // create label
+ label = ui::Label( "x" ); // create label
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
gtk_table_attach_defaults( GTK_TABLE( table ), label, 1, 2, 0, 1 ); // insert label into table
- label = gtk_label_new( "y" ); // create label
+ label = ui::Label( "y" ); // create label
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
gtk_table_attach_defaults( GTK_TABLE( table ), label, 2, 3, 0, 1 ); // insert label into table
- label = gtk_label_new( "mapcoordsmins" ); // create label
+ label = ui::Label( "mapcoordsmins" ); // create label
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 1, 2 ); // insert label into table
spinnerMinY = gtk_spin_button_new( spinner_adj_MinY, 1.0, 0 ); // create textbox wiht value spin, value and value range
gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMinY, 2, 3, 1, 2 ); // insert spinbox into table
- label = gtk_label_new( "mapcoordsmaxs" ); // create label
+ label = ui::Label( "mapcoordsmaxs" ); // create label
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 2, 3 ); // insert label into table
else {
globalOutputStream() << "SunPlug: no worldspawn found!\n"; // output error to console
- label = gtk_label_new( "ERROR: No worldspawn was found in the map!\nIn order to use this tool the map must have at least one brush in the worldspawn. " ); // create a label
+ label = ui::Label( "ERROR: No worldspawn was found in the map!\nIn order to use this tool the map must have at least one brush in the worldspawn. " ); // create a label
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // text align left
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 2 ); // insert the label in the box
namespace UFOAI
{
-GtkWindow* g_mainwnd;
+ ui::Window g_mainwnd;
const char* init( void* hApp, void* pMainWidget ){
- g_mainwnd = GTK_WINDOW( pMainWidget );
+ g_mainwnd = ui::Window(GTK_WINDOW( pMainWidget ));
return "Initializing GTKRadiant UFOAI plugin";
}
const char* getName(){
"\nRadiant version: " +radiant::version()+
"\nPlugin version: " PLUGIN_VERSION
"\nAuthor: Martin Gerhardy (tlh2000/mattn)\n";
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ),
+ GlobalRadiant().m_pfnMessageBox( g_mainwnd,
version_string.c_str(), "About",
eMB_OK, eMB_ICONDEFAULT );
}
}
if ( message != NULL ) {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ),
+ GlobalRadiant().m_pfnMessageBox( g_mainwnd,
message, "Note",
eMB_OK, eMB_ICONDEFAULT );
}
#ifndef __QERPLUGIN_H__
#define __QERPLUGIN_H__
+#include "uilib/uilib.h"
#include "generic/constant.h"
// NOTE: parent can be 0 in all functions but it's best to set them
// this API does not depend on gtk+ or glib
-typedef struct _GtkWidget GtkWidget;
enum EMessageBoxType
{
// simple Message Box, see above for the 'type' flags
-typedef EMessageBoxReturn ( *PFN_QERAPP_MESSAGEBOX )( GtkWidget *parent, const char* text, const char* caption /* = "NetRadiant"*/, EMessageBoxType type /* = eMB_OK*/, EMessageBoxIcon icon /* = eMB_ICONDEFAULT*/ );
+typedef EMessageBoxReturn ( *PFN_QERAPP_MESSAGEBOX )( ui::Widget parent, const char* text, const char* caption /* = "NetRadiant"*/, EMessageBoxType type /* = eMB_OK*/, EMessageBoxIcon icon /* = eMB_ICONDEFAULT*/ );
// file and directory selection functions return null if the user hits cancel
// - 'title' is the dialog title (can be null)
// - 'path' is used to set the initial directory (can be null)
// - 'pattern': the first pattern is for the win32 mode, then comes the Gtk pattern list, see Radiant source for samples
-typedef const char* ( *PFN_QERAPP_FILEDIALOG )( GtkWidget *parent, bool open, const char* title, const char* path /* = 0*/, const char* pattern /* = 0*/, bool want_load /* = false*/, bool want_import /* = false*/, bool want_save /* = false*/ );
+typedef const char* ( *PFN_QERAPP_FILEDIALOG )( ui::Widget parent, bool open, const char* title, const char* path /* = 0*/, const char* pattern /* = 0*/, bool want_load /* = false*/, bool want_import /* = false*/, bool want_save /* = false*/ );
// returns a gchar* string that must be g_free'd by the user
-typedef char* ( *PFN_QERAPP_DIRDIALOG )( GtkWidget *parent, const char* title /* = "Choose Directory"*/, const char* path /* = 0*/ );
+typedef char* ( *PFN_QERAPP_DIRDIALOG )( ui::Widget parent, const char* title /* = "Choose Directory"*/, const char* path /* = 0*/ );
// return true if the user closed the dialog with 'Ok'
// 'color' is used to set the initial value and store the selected value
template<typename Element> class BasicVector3;
typedef BasicVector3<float> Vector3;
-typedef bool ( *PFN_QERAPP_COLORDIALOG )( GtkWidget *parent, Vector3& color,
+typedef bool ( *PFN_QERAPP_COLORDIALOG )( ui::Widget parent, Vector3& color,
const char* title /* = "Choose Color"*/ );
// load a .bmp file and create a GtkImage widget from it
add_subdirectory(splines)
add_subdirectory(stream)
add_subdirectory(string)
+add_subdirectory(uilib)
add_subdirectory(xml)
add_library(etclib
globalDebugMessageHandler().getOutputStream() << FILE_LINE "\nruntime error: " << message << "\n"; \
if ( !globalDebugMessageHandler().handleMessage() ) { DEBUGGER_BREAKPOINT(); }} while ( 0 )
-#define ASSERT_NOTNULL( ptr ) ASSERT_MESSAGE( ptr != 0, "pointer \"" # ptr "\" is null" )
+#define ASSERT_NOTNULL( ptr ) ASSERT_MESSAGE( ptr != nullptr, "pointer \"" # ptr "\" is null" )
+#define ASSERT_TRUE( flag ) ASSERT_MESSAGE( !!(flag) == true, "condition \"" # flag "\" is false" )
#else
GtkLabel* DialogLabel_new( const char* name ){
- GtkLabel* label = GTK_LABEL( gtk_label_new( name ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ ui::Label label = ui::Label( name );
+ gtk_widget_show(label);
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
#include <gtk/gtkfilechooser.h>
#include <gtk/gtkfilechooserdialog.h>
#include <gtk/gtkstock.h>
+#include <uilib/uilib.h>
#include "string/string.h"
#include "stream/stringstream.h"
return g_file_dialog_file;
}
-char* dir_dialog( GtkWidget* parent, const char* title, const char* path ){
+char* dir_dialog( ui::Widget parent, const char* title, const char* path ){
GtkWidget* dialog = gtk_file_chooser_dialog_new( title,
GTK_WINDOW( parent ),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
return filename;
}
-const char* file_dialog( GtkWidget* parent, bool open, const char* title, const char* path, const char* pattern, bool want_load, bool want_import, bool want_save ){
+const char* file_dialog( ui::Widget parent, bool open, const char* title, const char* path, const char* pattern, bool want_load, bool want_import, bool want_save ){
for (;; )
{
const char* file = file_dialog_show( parent, open, title, path, pattern, want_load, want_import, want_save );
if ( open
- || file == 0
+ || file == nullptr
|| !file_exists( file )
- || gtk_MessageBox( parent, "The file specified already exists.\nDo you want to replace it?", title, eMB_NOYES, eMB_ICONQUESTION ) == eIDYES ) {
+ || parent.alert("The file specified already exists.\nDo you want to replace it?", title, ui::alert_type::NOYES, ui::alert_icon::QUESTION ) == ui::alert_response::YES ) {
return file;
}
}
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_GTKUTIL_FILECHOOSER_H )
#define INCLUDED_GTKUTIL_FILECHOOSER_H
/// \file
/// GTK+ file-chooser dialogs.
-typedef struct _GtkWidget GtkWidget;
-const char* file_dialog( GtkWidget *parent, bool open, const char* title, const char* path = 0, const char* pattern = 0, bool want_load = false, bool want_import = false, bool want_save = false );
+const char* file_dialog( ui::Widget parent, bool open, const char* title, const char* path = 0, const char* pattern = 0, bool want_load = false, bool want_import = false, bool want_save = false );
/// \brief Prompts the user to browse for a directory.
/// The prompt window will be transient to \p parent.
/// The directory will initially default to \p path, which must be an absolute path.
/// The returned string is allocated with \c g_malloc and must be freed with \c g_free.
-char* dir_dialog( GtkWidget *parent, const char* title = "Choose Directory", const char* path = "" );
+char* dir_dialog( ui::Widget parent, const char* title = "Choose Directory", const char* path = "" );
#endif
}
}
-EMessageBoxReturn gtk_MessageBox( GtkWidget *parent, const char* text, const char* title, EMessageBoxType type, EMessageBoxIcon icon ){
+EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const char* title, EMessageBoxType type, EMessageBoxIcon icon ){
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
ModalDialogButton yes_button( dialog, eIDYES );
ModalDialogButton no_button( dialog, eIDNO );
- GtkWindow* parentWindow = parent != 0 ? GTK_WINDOW( parent ) : 0;
+ GtkWindow* parentWindow = parent ? GTK_WINDOW( parent ) : nullptr;
GtkWindow* window = create_fixedsize_modal_dialog_window( parentWindow, title, dialog, 400, 100 );
gtk_widget_show( GTK_WIDGET( image ) );
gtk_box_pack_start( GTK_BOX( iconBox ), GTK_WIDGET( image ), FALSE, FALSE, 0 );
- GtkLabel* label = GTK_LABEL( gtk_label_new( text ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( text ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
#include "qerplugin.h"
-typedef struct _GtkWidget GtkWidget;
/// \brief Shows a modal message-box.
-EMessageBoxReturn gtk_MessageBox( GtkWidget *parent, const char* text, const char* title = "NetRadiant", EMessageBoxType type = eMB_OK, EMessageBoxIcon icon = eMB_ICONDEFAULT );
+EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const char* title = "NetRadiant", EMessageBoxType type = eMB_OK, EMessageBoxIcon icon = eMB_ICONDEFAULT );
#endif
#define INCLUDED_XORRECTANGLE_H
#include <gtk/gtkwidget.h>
+#include <uilib/uilib.h>
#include "math/vector.h"
class rectangle_t
}
public:
-XORRectangle( GtkWidget* widget ) : m_widget( widget ), m_gc( 0 ){
+XORRectangle( ui::Widget widget ) : m_widget( widget ), m_gc( 0 ){
}
~XORRectangle(){
if ( initialised() ) {
--- /dev/null
+add_library(uilib
+ uilib.cpp
+ uilib.h
+)
--- /dev/null
+#include "uilib.h"
+
+#include <tuple>
+
+#include <gtk/gtk.h>
+
+#include "gtkutil/dialog.h"
+#include "gtkutil/filechooser.h"
+#include "gtkutil/messagebox.h"
+#include "gtkutil/window.h"
+
+namespace ui {
+
+ void init(int argc, char *argv[])
+ {
+ gtk_disable_setlocale();
+ gtk_init(&argc, &argv);
+ }
+
+ void main()
+ {
+ gtk_main();
+ }
+
+ Widget root;
+
+ alert_response Widget::alert(std::string text, std::string title, alert_type type, alert_icon icon)
+ {
+ auto ret = gtk_MessageBox(*this, text.c_str(),
+ title.c_str(),
+ type == alert_type::OK ? eMB_OK :
+ type == alert_type::OKCANCEL ? eMB_OKCANCEL :
+ type == alert_type::YESNO ? eMB_YESNO :
+ type == alert_type::YESNOCANCEL ? eMB_YESNOCANCEL :
+ type == alert_type::NOYES ? eMB_NOYES :
+ eMB_OK,
+ icon == alert_icon::DEFAULT ? eMB_ICONDEFAULT :
+ icon == alert_icon::ERROR ? eMB_ICONERROR :
+ icon == alert_icon::WARNING ? eMB_ICONWARNING :
+ icon == alert_icon::QUESTION ? eMB_ICONQUESTION :
+ icon == alert_icon::ASTERISK ? eMB_ICONASTERISK :
+ eMB_ICONDEFAULT
+ );
+ return
+ ret == eIDOK ? alert_response::OK :
+ ret == eIDCANCEL ? alert_response::CANCEL :
+ ret == eIDYES ? alert_response::YES :
+ ret == eIDNO ? alert_response::NO :
+ alert_response::OK;
+ }
+
+ const char *Widget::file_dialog(bool open, const char *title, const char *path,
+ const char *pattern, bool want_load, bool want_import,
+ bool want_save)
+ {
+ return ::file_dialog(*this, open, title, path, pattern, want_load, want_import, want_save);
+ }
+
+ Window Window::create_dialog_window(const char *title, void func(), void *data, int default_w, int default_h)
+ {
+ return Window(::create_dialog_window(*this, title, func, data, default_w, default_h));
+ }
+
+ Window Window::create_modal_dialog_window(const char *title, ui_modal &dialog, int default_w, int default_h)
+ {
+ return Window(::create_modal_dialog_window(*this, title, dialog, default_w, default_h));
+ }
+
+ Window Window::create_floating_window(const char *title)
+ {
+ return Window(::create_floating_window(title, *this));
+ }
+
+ std::uint64_t Window::on_key_press(bool (*f)(Widget widget, ui_evkey *event, void *extra), void *extra)
+ {
+ auto pass = std::make_tuple(f, extra);
+ auto func = [](ui_widget *widget, GdkEventKey *event, void *pass_) -> bool {
+ using pass_t = decltype(pass);
+ auto &args = *(pass_t *) pass_;
+ auto func = std::get<0>(args);
+ auto pass = std::get<1>(args);
+ return func(Widget(widget), event, pass);
+ };
+ return g_signal_connect(G_OBJECT(*this), "key-press-event", (GCallback) +func, &pass);
+ }
+
+ Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
+ { }
+
+}
--- /dev/null
+#ifndef INCLUDED_UILIB_H
+#define INCLUDED_UILIB_H
+
+#include <string>
+
+using ui_typeinst = struct _GTypeInstance;
+using ui_widget = struct _GtkWidget;
+using ui_window = struct _GtkWindow;
+using ui_menuitem = struct _GtkMenuItem;
+using ui_label = struct _GtkLabel;
+
+using ui_evkey = struct _GdkEventKey;
+
+using ui_modal = struct ModalDialog;
+
+namespace ui {
+
+ void init(int argc, char *argv[]);
+
+ void main();
+
+ enum class alert_type {
+ OK,
+ OKCANCEL,
+ YESNO,
+ YESNOCANCEL,
+ NOYES,
+ };
+
+ enum class alert_icon {
+ DEFAULT,
+ ERROR,
+ WARNING,
+ QUESTION,
+ ASTERISK,
+ };
+
+ enum class alert_response {
+ OK,
+ CANCEL,
+ YES,
+ NO,
+ };
+
+ template<class Self, class T>
+ class Convertible {
+ public:
+ T *handle() const
+ { return (T *) static_cast<const Self *>(this)->_handle; }
+
+ operator T *() const
+ { return handle(); }
+ };
+
+ class Base {
+ public:
+ void *_handle;
+
+ Base(void *h) : _handle(h)
+ { }
+
+ explicit operator bool() const
+ { return _handle != nullptr; }
+
+ explicit operator ui_typeinst *() const
+ { return (ui_typeinst *) _handle; }
+
+ explicit operator void *() const
+ { return _handle; }
+ };
+
+ static_assert(sizeof(Base) == sizeof(ui_widget *), "object slicing");
+
+ class Widget : public Base, public Convertible<Widget, ui_widget> {
+ public:
+ explicit Widget(ui_widget *h = nullptr) : Base((void *) h)
+ { }
+
+ alert_response alert(std::string text, std::string title = "NetRadiant",
+ alert_type type = alert_type::OK, alert_icon icon = alert_icon::DEFAULT);
+
+ const char *file_dialog(bool open, const char *title, const char *path = nullptr,
+ const char *pattern = nullptr, bool want_load = false, bool want_import = false,
+ bool want_save = false);
+ };
+
+ static_assert(sizeof(Widget) == sizeof(Base), "object slicing");
+
+ extern Widget root;
+
+#define WIDGET(name, impl, methods) \
+ class name : public Widget, public Convertible<name, impl> { \
+ public: \
+ explicit name(impl *h = nullptr) : Widget(reinterpret_cast<ui_widget *>(h)) {} \
+ methods \
+ }; \
+ static_assert(sizeof(name) == sizeof(Widget), "object slicing")
+
+ WIDGET(Window, ui_window,
+ Window create_dialog_window(const char *title, void func(), void *data, int default_w = -1,
+ int default_h = -1);
+
+ Window create_modal_dialog_window(const char *title, ui_modal &dialog, int default_w = -1,
+ int default_h = -1);
+
+ Window create_floating_window(const char *title);
+
+ std::uint64_t on_key_press(bool (*f)(Widget widget, ui_evkey *event, void *extra),
+ void *extra = nullptr);
+ );
+
+ WIDGET(CheckButton, ui_widget,);
+
+ WIDGET(SpinButton, ui_widget,);
+
+ WIDGET(MenuItem, ui_menuitem,);
+
+ WIDGET(Label, ui_label,
+ Label(const char *label);
+ );
+
+}
+
+#endif
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
- w = gtk_label_new( lpText );
+ w = ui::Label( lpText );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
splines
stream
string
+ uilib
xmllib
)
if(NOT WIN32)
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
#include "autosave.h"
#include "os/file.h"
{
StringOutputStream strMsg( 256 );
strMsg << "Snapshot save failed.. unabled to create directory\n" << snapshotsDir.c_str();
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), strMsg.c_str() );
+ MainFrame_getWindow().alert( strMsg.c_str() );
}
}
/*
}
void Autosave_constructPreferences( PreferencesPage& page ){
- GtkWidget* autosave_enabled = page.appendCheckBox( "Autosave", "Enable Autosave", g_AutoSave_Enabled );
- GtkWidget* autosave_frequency = page.appendSpinner( "Autosave Frequency (minutes)", m_AutoSave_Frequency, 1, 1, 60 );
+ ui::CheckButton autosave_enabled = page.appendCheckBox( "Autosave", "Enable Autosave", g_AutoSave_Enabled );
+ ui::SpinButton autosave_frequency = page.appendSpinner( "Autosave Frequency (minutes)", m_AutoSave_Frequency, 1, 1, 60 );
Widget_connectToggleDependency( autosave_frequency, autosave_enabled );
page.appendCheckBox( "", "Save Snapshots", g_SnapShots_Enabled );
}
return FALSE;
}
-gboolean project_key_press( GtkWidget* widget, GdkEventKey* event, ProjectList* projectList ){
+gboolean project_key_press( ui::Widget widget, GdkEventKey* event, ProjectList* projectList ){
Project& project = projectList->m_project;
if ( event->keyval == GDK_Delete ) {
return FALSE;
}
-gboolean commands_key_press( GtkWidget* widget, GdkEventKey* event, GtkListStore* store ){
+gboolean commands_key_press( ui::Widget widget, GdkEventKey* event, GtkListStore* store ){
if ( g_current_build == 0 ) {
return FALSE;
}
}
-GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Build Menu", G_CALLBACK( dialog_delete_callback ), &modal, -1, 400 );
+ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Build Menu", G_CALLBACK(dialog_delete_callback ), &modal, -1, 400 );
- GtkWidget* buildView = 0;
+ ui::Widget buildView;
{
GtkTable* table1 = create_dialog_table( 2, 2, 4, 4, 4 );
{
GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
{
GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
ProjectList projectList( g_build_project );
- GtkWindow* window = BuildMenuDialog_construct( modal, projectList );
+ ui::Window window = BuildMenuDialog_construct( modal, projectList );
if ( modal_dialog_show( window, modal ) == eIDCANCEL ) {
build_commands_clear();
FreezePointer m_freezePointer;
public:
-GtkWidget* m_gl_widget;
-GtkWindow* m_parent;
+ui::Widget m_gl_widget;
+ui::Window m_parent;
SelectionSystemWindowObserver* m_window_observer;
XORRectangle m_XORRectangle;
}
-GtkWidget* CamWnd_getWidget( CamWnd& camwnd ){
+ui::Widget CamWnd_getWidget( CamWnd& camwnd ){
return camwnd.m_gl_widget;
}
-GtkWindow* CamWnd_getParent( CamWnd& camwnd ){
+ui::Window CamWnd_getParent( CamWnd& camwnd ){
return camwnd.m_parent;
}
ToggleShown g_camera_shown( true );
-void CamWnd_setParent( CamWnd& camwnd, GtkWindow* parent ){
+void CamWnd_setParent( CamWnd& camwnd, ui::Window parent ){
camwnd.m_parent = parent;
g_camera_shown.connect( GTK_WIDGET( camwnd.m_parent ) );
}
// =============================================================================
// CamWnd class
-gboolean enable_freelook_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
+gboolean enable_freelook_button_press( ui::Widget widget, GdkEventButton* event, CamWnd* camwnd ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
camwnd->EnableFreeMove();
return TRUE;
return FALSE;
}
-gboolean disable_freelook_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
+gboolean disable_freelook_button_press( ui::Widget widget, GdkEventButton* event, CamWnd* camwnd ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
camwnd->DisableFreeMove();
return TRUE;
}
#if 0
-gboolean mousecontrol_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
+gboolean mousecontrol_button_press( ui::Widget widget, GdkEventButton* event, CamWnd* camwnd ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
Cam_MouseControl( camwnd->getCamera(), event->x, widget->allocation.height - 1 - event->y );
}
}
-gboolean selection_button_press( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_press( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
if ( event->type == GDK_BUTTON_PRESS ) {
observer->onMouseDown( WindowVector_forDouble( event->x, event->y ), button_for_button( event->button ), modifiers_for_state( event->state ) );
}
return FALSE;
}
-gboolean selection_button_release( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_release( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
if ( event->type == GDK_BUTTON_RELEASE ) {
observer->onMouseUp( WindowVector_forDouble( event->x, event->y ), button_for_button( event->button ), modifiers_for_state( event->state ) );
}
reinterpret_cast<WindowObserver*>( data )->onMouseMotion( WindowVector_forDouble( x, y ), modifiers_for_state( state ) );
}
-inline WindowVector windowvector_for_widget_centre( GtkWidget* widget ){
- return WindowVector( static_cast<float>( widget->allocation.width / 2 ), static_cast<float>( widget->allocation.height / 2 ) );
+inline WindowVector windowvector_for_widget_centre( ui::Widget widget ){
+ return WindowVector( static_cast<float>( widget.handle()->allocation.width / 2 ), static_cast<float>( widget.handle()->allocation.height / 2 ) );
}
-gboolean selection_button_press_freemove( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_press_freemove( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
if ( event->type == GDK_BUTTON_PRESS ) {
observer->onMouseDown( windowvector_for_widget_centre( widget ), button_for_button( event->button ), modifiers_for_state( event->state ) );
}
return FALSE;
}
-gboolean selection_button_release_freemove( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_release_freemove( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
if ( event->type == GDK_BUTTON_RELEASE ) {
observer->onMouseUp( windowvector_for_widget_centre( widget ), button_for_button( event->button ), modifiers_for_state( event->state ) );
}
return FALSE;
}
-gboolean selection_motion_freemove( GtkWidget *widget, GdkEventMotion *event, WindowObserver* observer ){
+gboolean selection_motion_freemove( ui::Widget widget, GdkEventMotion *event, WindowObserver* observer ){
observer->onMouseMotion( windowvector_for_widget_centre( widget ), modifiers_for_state( event->state ) );
return FALSE;
}
-gboolean wheelmove_scroll( GtkWidget* widget, GdkEventScroll* event, CamWnd* camwnd ){
+gboolean wheelmove_scroll( ui::Widget widget, GdkEventScroll* event, CamWnd* camwnd ){
if ( event->direction == GDK_SCROLL_UP ) {
Camera_Freemove_updateAxes( camwnd->getCamera() );
Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( camwnd->getCamera().forward, static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
return FALSE;
}
-gboolean camera_size_allocate( GtkWidget* widget, GtkAllocation* allocation, CamWnd* camwnd ){
+gboolean camera_size_allocate( ui::Widget widget, GtkAllocation* allocation, CamWnd* camwnd ){
camwnd->getCamera().width = allocation->width;
camwnd->getCamera().height = allocation->height;
Camera_updateProjection( camwnd->getCamera() );
return FALSE;
}
-gboolean camera_expose( GtkWidget* widget, GdkEventExpose* event, gpointer data ){
+gboolean camera_expose( ui::Widget widget, GdkEventExpose* event, gpointer data ){
reinterpret_cast<CamWnd*>( data )->draw();
return FALSE;
}
m_view( true ),
m_Camera( &m_view, CamWndQueueDraw( *this ) ),
m_cameraview( m_Camera, &m_view, ReferenceCaller<CamWnd, CamWnd_Update>( *this ) ),
- m_gl_widget( glwidget_new( TRUE ) ),
+ m_gl_widget( ui::Widget(glwidget_new( TRUE )) ),
m_window_observer( NewWindowObserver() ),
m_XORRectangle( m_gl_widget ),
m_deferredDraw( WidgetQueueDrawCaller( *m_gl_widget ) ),
// NOTE TTimo if there's an OS-level focus out of the application
// then we can release the camera cursor grab
-static gboolean camwindow_freemove_focusout( GtkWidget* widget, GdkEventFocus* event, gpointer data ){
+static gboolean camwindow_freemove_focusout( ui::Widget widget, GdkEventFocus* event, gpointer data ){
reinterpret_cast<CamWnd*>( data )->DisableFreeMove();
return FALSE;
}
#if !defined( INCLUDED_CAMWINDOW_H )
#define INCLUDED_CAMWINDOW_H
+#include <uilib/uilib.h>
#include "math/vector.h"
#include "signal/signalfwd.h"
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-
class CamWnd;
CamWnd* NewCamWnd();
void DeleteCamWnd( CamWnd* camwnd );
void CamWnd_Update( CamWnd& camwnd );
-GtkWidget* CamWnd_getWidget( CamWnd& camwnd );
-void CamWnd_setParent( CamWnd& camwnd, GtkWindow* parent );
+ui::Widget CamWnd_getWidget( CamWnd& camwnd );
+void CamWnd_setParent( CamWnd& camwnd, ui::Window parent );
void GlobalCamera_setCamWnd( CamWnd& camwnd );
#include "commands.h"
#include "debugging/debugging.h"
-#include "warnings.h"
#include <map>
#include "string/string.h"
#include "versionlib.h"
-#include "gtkutil/accelerator.h"
#include "gtkutil/messagebox.h"
#include <gtk/gtktreeselection.h>
#include <gtk/gtkbutton.h>
}
-#include <cctype>
-
#include <gtk/gtkbox.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
#include <gtk/gtkcellrenderertext.h>
+#include <uilib/uilib.h>
#include "gtkutil/dialog.h"
#include "mainframe.h"
dialog.m_waiting_for_key = true;
}
-gboolean accelerator_window_key_press( GtkWidget *widget, GdkEventKey *event, gpointer dialogptr ){
+bool accelerator_window_key_press( ui::Widget widget, GdkEventKey *event, gpointer dialogptr ){
command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr;
if ( !dialog.m_waiting_for_key ) {
{
const char *commandName;
const Accelerator &newAccel;
- GtkWidget *widget;
+ ui::Widget widget;
GtkTreeModel *model;
public:
bool allow;
- VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, GtkWidget *w, GtkTreeModel *m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){
+ VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, ui::Widget w, GtkTreeModel *m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){
}
void visit( const char* name, Accelerator& accelerator ){
if ( !strcmp( name, commandName ) ) {
StringOutputStream msg;
msg << "The command " << name << " is already assigned to the key " << accelerator << ".\n\n"
<< "Do you want to unassign " << name << " first?";
- EMessageBoxReturn r = gtk_MessageBox( widget, msg.c_str(), "Key already used", eMB_YESNOCANCEL );
- if ( r == eIDYES ) {
+ auto r = widget.alert( msg.c_str(), "Key already used", ui::alert_type::YESNOCANCEL );
+ if ( r == ui::alert_response::YES ) {
// clear the ACTUAL accelerator too!
disconnect_accelerator( name );
// delete the modifier
}
}
}
- else if ( r == eIDCANCEL ) {
+ else if ( r == ui::alert_response::CANCEL ) {
// aborted
allow = false;
}
void DoCommandListDlg(){
command_list_dialog_t dialog;
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Mapped Commands", dialog, -1, 400 );
- g_signal_connect( G_OBJECT( window ), "key-press-event", (GCallback) accelerator_window_key_press, &dialog );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Mapped Commands", dialog, -1, 400);
+ window.on_key_press([](ui::Widget widget, GdkEventKey *event, gpointer dialogptr) {
+ return accelerator_window_key_press(widget, event, dialogptr);
+ }, &dialog);
GtkAccelGroup* accel = gtk_accel_group_new();
gtk_window_add_accel_group( window, accel );
{
GtkListStore* store = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::Widget(gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)));
dialog.m_list = GTK_TREE_VIEW( view );
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying
GtkButton* clearbutton = create_dialog_button( "Clear", (GCallback) accelerator_clear_button_clicked, &dialog );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( clearbutton ), FALSE, FALSE, 0 );
- GtkWidget *spacer = gtk_image_new();
+ ui::Widget spacer = ui::Widget(gtk_image_new());
gtk_widget_show( spacer );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( spacer ), TRUE, TRUE, 0 );
#include <gtk/gtktextview.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkscrolledwindow.h>
+#include <uilib/uilib.h>
#include "gtkutil/accelerator.h"
#include "gtkutil/messagebox.h"
<< radiant::about_msg() << "\n";
}
else{
- gtk_MessageBox( 0, "Failed to create log file, check write permissions in Radiant directory.\n",
- "Console logging", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( "Failed to create log file, check write permissions in Radiant directory.\n",
+ "Console logging", ui::alert_type::OK, ui::alert_icon::ERROR );
}
}
else if ( !enable && g_hLogFile != 0 ) {
}
}
-GtkWidget* g_console = 0;
+ui::Widget g_console;
void console_clear(){
GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( g_console ) );
void console_populate_popup( GtkTextView* textview, GtkMenu* menu, gpointer user_data ){
menu_separator( menu );
- GtkWidget* item = gtk_menu_item_new_with_label( "Clear" );
+ ui::Widget item(gtk_menu_item_new_with_label( "Clear" ));
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( console_clear ), 0 );
gtk_widget_show( item );
container_add_widget( GTK_CONTAINER( menu ), item );
}
-gboolean destroy_set_null( GtkWindow* widget, GtkWidget** p ){
- *p = 0;
+gboolean destroy_set_null( ui::Window widget, ui::Widget* p ){
+ *p = ui::Widget();
return FALSE;
}
WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" );
-GtkWidget* Console_constructWindow( GtkWindow* toplevel ){
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ui::Widget Console_constructWindow( ui::Window toplevel ){
+ ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
gtk_widget_show( scr );
{
- GtkWidget* text = gtk_text_view_new();
+ ui::Widget text = ui::Widget(gtk_text_view_new());
gtk_widget_set_size_request( text, 0, -1 ); // allow shrinking
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text ), GTK_WRAP_WORD );
gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE );
}
if ( level != SYS_NOCON ) {
- if ( g_console != 0 ) {
+ if ( g_console ) {
GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( g_console ) );
GtkTextIter iter;
#define INCLUDED_CONSOLE_H
#include <cstddef>
+#include <uilib/uilib.h>
#define SYS_VRB 0 ///< verbose support (on/off)
#define SYS_STD 1 ///< standard print level - this is the default
TextOutputStream& getSysPrintOutputStream();
TextOutputStream& getSysPrintErrorStream();
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-GtkWidget* Console_constructWindow( GtkWindow* toplevel );
+ui::Widget Console_constructWindow( ui::Window toplevel );
// will open/close the log file based on the parameter
void Sys_LogFile( bool enable );
class DialogEntryRow
{
public:
-DialogEntryRow( GtkWidget* row, GtkEntry* entry ) : m_row( row ), m_entry( entry ){
+DialogEntryRow( ui::Widget row, GtkEntry* entry ) : m_row( row ), m_entry( entry ){
}
-GtkWidget* m_row;
+ui::Widget m_row;
GtkEntry* m_entry;
};
DialogEntryRow DialogEntryRow_new( const char* name ){
- GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+ ui::Widget alignment = ui::Widget(gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 ));
gtk_widget_show( alignment );
GtkEntry* entry = DialogEntry_new();
gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( entry ) );
- return DialogEntryRow( GTK_WIDGET( DialogRow_new( name, alignment ) ), entry );
+ return DialogEntryRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), entry );
}
class DialogSpinnerRow
{
public:
-DialogSpinnerRow( GtkWidget* row, GtkSpinButton* spin ) : m_row( row ), m_spin( spin ){
+DialogSpinnerRow( ui::Widget row, GtkSpinButton* spin ) : m_row( row ), m_spin( spin ){
}
-GtkWidget* m_row;
+ui::Widget m_row;
GtkSpinButton* m_spin;
};
DialogSpinnerRow DialogSpinnerRow_new( const char* name, double value, double lower, double upper, int fraction ){
- GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+ ui::Widget alignment = ui::Widget(gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 ));
gtk_widget_show( alignment );
GtkSpinButton* spin = DialogSpinner_new( value, lower, upper, fraction );
gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( spin ) );
- return DialogSpinnerRow( GTK_WIDGET( DialogRow_new( name, alignment ) ), spin );
+ return DialogSpinnerRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), spin );
}
( *i )->release();
}
- ASSERT_MESSAGE( m_window == 0, "dialog window not destroyed" );
+ ASSERT_MESSAGE( !m_window, "dialog window not destroyed" );
}
void Dialog::ShowDlg(){
- ASSERT_MESSAGE( m_window != 0, "dialog was not constructed" );
+ ASSERT_MESSAGE( m_window, "dialog was not constructed" );
importData();
gtk_widget_show( GTK_WIDGET( m_window ) );
}
void Dialog::HideDlg(){
- ASSERT_MESSAGE( m_window != 0, "dialog was not constructed" );
+ ASSERT_MESSAGE( m_window, "dialog was not constructed" );
exportData();
gtk_widget_hide( GTK_WIDGET( m_window ) );
}
-static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){
+static gint delete_event_callback( ui::Widget widget, GdkEvent* event, gpointer data ){
reinterpret_cast<Dialog*>( data )->HideDlg();
reinterpret_cast<Dialog*>( data )->EndModal( eIDCANCEL );
return TRUE;
}
void Dialog::Create(){
- ASSERT_MESSAGE( m_window == 0, "dialog cannot be constructed" );
+ ASSERT_MESSAGE( !m_window, "dialog cannot be constructed" );
m_window = BuildDialog();
g_signal_connect( G_OBJECT( m_window ), "delete_event", G_CALLBACK( delete_event_callback ), this );
}
void Dialog::Destroy(){
- ASSERT_MESSAGE( m_window != 0, "dialog cannot be destroyed" );
+ ASSERT_MESSAGE( m_window, "dialog cannot be destroyed" );
gtk_widget_destroy( GTK_WIDGET( m_window ) );
- m_window = 0;
+ m_window = ui::Window(nullptr);
}
PreModal();
EMessageBoxReturn ret = modal_dialog_show( m_window, m_modal );
- ASSERT_NOTNULL( m_window );
+ ASSERT_TRUE( (bool) m_window );
if ( ret == eIDOK ) {
exportData();
}
}
-GtkWidget* Dialog::addCheckBox( GtkWidget* vbox, const char* name, const char* flag, const BoolImportCallback& importViewer, const BoolExportCallback& exportViewer ){
- GtkWidget* check = gtk_check_button_new_with_label( flag );
+ui::CheckButton Dialog::addCheckBox( ui::Widget vbox, const char* name, const char* flag, const BoolImportCallback& importViewer, const BoolExportCallback& exportViewer ){
+ ui::Widget check = ui::Widget(gtk_check_button_new_with_label( flag ));
gtk_widget_show( check );
AddBoolToggleData( *GTK_TOGGLE_BUTTON( check ), importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( DialogRow_new( name, check ) ) );
- return check;
+ return ui::CheckButton(check);
}
-GtkWidget* Dialog::addCheckBox( GtkWidget* vbox, const char* name, const char* flag, bool& data ){
+ui::CheckButton Dialog::addCheckBox( ui::Widget vbox, const char* name, const char* flag, bool& data ){
return addCheckBox( vbox, name, flag, BoolImportCaller( data ), BoolExportCaller( data ) );
}
-void Dialog::addCombo( GtkWidget* vbox, const char* name, StringArrayRange values, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
- GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+void Dialog::addCombo( ui::Widget vbox, const char* name, StringArrayRange values, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ ui::Widget alignment = ui::Widget(gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 ));
gtk_widget_show( alignment );
{
- GtkWidget* combo = gtk_combo_box_new_text();
+ ui::Widget combo = ui::Widget(gtk_combo_box_new_text());
for ( StringArrayRange::Iterator i = values.first; i != values.last; ++i )
{
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
}
-void Dialog::addCombo( GtkWidget* vbox, const char* name, int& data, StringArrayRange values ){
+void Dialog::addCombo( ui::Widget vbox, const char* name, int& data, StringArrayRange values ){
addCombo( vbox, name, values, IntImportCaller( data ), IntExportCaller( data ) );
}
-void Dialog::addSlider( GtkWidget* vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment ){
+void Dialog::addSlider( ui::Widget vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment ){
#if 0
if ( draw_value == FALSE ) {
- GtkWidget* hbox2 = gtk_hbox_new( FALSE, 0 );
+ ui::Widget hbox2 = gtk_hbox_new( FALSE, 0 );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 );
{
- GtkWidget* label = gtk_label_new( low );
+ ui::Widget label = ui::Label( low );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
}
{
- GtkWidget* label = gtk_label_new( high );
+ ui::Widget label = ui::Label( high );
gtk_widget_show( label );
gtk_box_pack_end( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
}
AddIntAdjustmentData( *GTK_ADJUSTMENT( adj ), IntImportCaller( data ), IntExportCaller( data ) );
// scale
- GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 1.0, 0.0 );
+ ui::Widget alignment = ui::Widget(gtk_alignment_new( 0.0, 0.5, 1.0, 0.0 ));
gtk_widget_show( alignment );
- GtkWidget* scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+ ui::Widget scale = ui::Widget(gtk_hscale_new( GTK_ADJUSTMENT( adj ) ));
gtk_scale_set_value_pos( GTK_SCALE( scale ), GTK_POS_LEFT );
gtk_widget_show( scale );
gtk_container_add( GTK_CONTAINER( alignment ), scale );
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
}
-void Dialog::addRadio( GtkWidget* vbox, const char* name, StringArrayRange names, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
- GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+void Dialog::addRadio( ui::Widget vbox, const char* name, StringArrayRange names, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ ui::Widget alignment = ui::Widget(gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 ));
gtk_widget_show( alignment );
{
RadioHBox radioBox = RadioHBox_new( names );
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
}
-void Dialog::addRadio( GtkWidget* vbox, const char* name, int& data, StringArrayRange names ){
+void Dialog::addRadio( ui::Widget vbox, const char* name, int& data, StringArrayRange names ){
addRadio( vbox, name, names, IntImportCaller( data ), IntExportCaller( data ) );
}
-void Dialog::addRadioIcons( GtkWidget* vbox, const char* name, StringArrayRange icons, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
- GtkWidget* table = gtk_table_new( 2, static_cast<guint>( icons.last - icons.first ), FALSE );
+void Dialog::addRadioIcons( ui::Widget vbox, const char* name, StringArrayRange icons, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ ui::Widget table = ui::Widget(gtk_table_new( 2, static_cast<guint>( icons.last - icons.first ), FALSE ));
gtk_widget_show( table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
GSList* group = 0;
- GtkWidget* radio = 0;
+ ui::Widget radio;
for ( StringArrayRange::Iterator icon = icons.first; icon != icons.last; ++icon )
{
guint pos = static_cast<guint>( icon - icons.first );
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- radio = gtk_radio_button_new( group );
+ radio = ui::Widget(gtk_radio_button_new( group ));
gtk_widget_show( radio );
gtk_table_attach( GTK_TABLE( table ), radio, pos, pos + 1, 1, 2,
(GtkAttachOptions) ( 0 ),
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( DialogRow_new( name, table ) ) );
}
-void Dialog::addRadioIcons( GtkWidget* vbox, const char* name, int& data, StringArrayRange icons ){
+void Dialog::addRadioIcons( ui::Widget vbox, const char* name, int& data, StringArrayRange icons ){
addRadioIcons( vbox, name, icons, IntImportCaller( data ), IntExportCaller( data ) );
}
-GtkWidget* Dialog::addIntEntry( GtkWidget* vbox, const char* name, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ui::Widget Dialog::addIntEntry( ui::Widget vbox, const char* name, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
DialogEntryRow row( DialogEntryRow_new( name ) );
AddIntEntryData( *row.m_entry, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
return row.m_row;
}
-GtkWidget* Dialog::addSizeEntry( GtkWidget* vbox, const char* name, const SizeImportCallback& importViewer, const SizeExportCallback& exportViewer ){
+ui::Widget Dialog::addSizeEntry( ui::Widget vbox, const char* name, const SizeImportCallback& importViewer, const SizeExportCallback& exportViewer ){
DialogEntryRow row( DialogEntryRow_new( name ) );
AddSizeEntryData( *row.m_entry, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
return row.m_row;
}
-GtkWidget* Dialog::addFloatEntry( GtkWidget* vbox, const char* name, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
+ui::Widget Dialog::addFloatEntry( ui::Widget vbox, const char* name, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
DialogEntryRow row( DialogEntryRow_new( name ) );
AddFloatEntryData( *row.m_entry, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
return row.m_row;
}
-GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, bool browse_directory, const StringImportCallback& importViewer, const StringExportCallback& exportViewer ){
+ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, bool browse_directory, const StringImportCallback& importViewer, const StringExportCallback& exportViewer ){
PathEntry pathEntry = PathEntry_new();
g_signal_connect( G_OBJECT( pathEntry.m_button ), "clicked", G_CALLBACK( browse_directory ? button_clicked_entry_browse_directory : button_clicked_entry_browse_file ), pathEntry.m_entry );
GtkTable* row = DialogRow_new( name, GTK_WIDGET( pathEntry.m_frame ) );
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
- return GTK_WIDGET( row );
+ return ui::Widget(GTK_WIDGET( row ));
}
-GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, std::string& data, bool browse_directory ){
+ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, std::string& data, bool browse_directory ){
return addPathEntry( vbox, name, browse_directory, StringImportCallback( StringImportCaller( data ) ), StringExportCallback( StringExportCaller( data ) ) );
}
-GtkWidget* Dialog::addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 1 ) );
AddIntSpinnerData( *row.m_spin, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
- return row.m_row;
+ return ui::SpinButton(row.m_row);
}
-GtkWidget* Dialog::addSpinner( GtkWidget* vbox, const char* name, int& data, double value, double lower, double upper ){
+ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, int& data, double value, double lower, double upper ){
return addSpinner( vbox, name, value, lower, upper, IntImportCallback( IntImportCaller( data ) ), IntExportCallback( IntExportCaller( data ) ) );
}
-GtkWidget* Dialog::addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
+ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 10 ) );
AddFloatSpinnerData( *row.m_spin, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
- return row.m_row;
+ return ui::SpinButton(row.m_row);
}
#define INCLUDED_DIALOG_H
#include <list>
+#include <uilib/uilib.h>
#include "gtkutil/dialog.h"
#include "generic/callback.h"
virtual void exportData() const = 0;
};
-typedef struct _GtkWindow GtkWindow;
typedef struct _GtkToggleButton GtkToggleButton;
typedef struct _GtkRadioButton GtkRadioButton;
typedef struct _GtkSpinButton GtkSpinButton;
class Dialog
{
-GtkWindow* m_window;
+ui::Window m_window;
DialogDataList m_data;
public:
ModalDialog m_modal;
-GtkWindow* m_parent;
+ui::Window m_parent;
Dialog();
virtual ~Dialog();
*/
EMessageBoxReturn DoModal();
void EndModal( EMessageBoxReturn code );
-virtual GtkWindow* BuildDialog() = 0;
+virtual ui::Window BuildDialog() = 0;
virtual void exportData();
virtual void importData();
virtual void PreModal() { };
virtual void HideDlg();
void Create();
void Destroy();
-GtkWindow* GetWidget(){
+ui::Window GetWidget(){
return m_window;
}
-const GtkWindow* GetWidget() const {
+const ui::Window GetWidget() const {
return m_window;
}
-GtkWidget* addCheckBox( GtkWidget* vbox, const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback );
-GtkWidget* addCheckBox( GtkWidget* vbox, const char* name, const char* flag, bool& data );
-void addCombo( GtkWidget* vbox, const char* name, StringArrayRange values, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-void addCombo( GtkWidget* vbox, const char* name, int& data, StringArrayRange values );
-void addSlider( GtkWidget* vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment );
-void addRadio( GtkWidget* vbox, const char* name, StringArrayRange names, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-void addRadio( GtkWidget* vbox, const char* name, int& data, StringArrayRange names );
-void addRadioIcons( GtkWidget* vbox, const char* name, StringArrayRange icons, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-void addRadioIcons( GtkWidget* vbox, const char* name, int& data, StringArrayRange icons );
-GtkWidget* addIntEntry( GtkWidget* vbox, const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-GtkWidget* addEntry( GtkWidget* vbox, const char* name, int& data ){
+ui::CheckButton addCheckBox( ui::Widget vbox, const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback );
+ui::CheckButton addCheckBox( ui::Widget vbox, const char* name, const char* flag, bool& data );
+void addCombo( ui::Widget vbox, const char* name, StringArrayRange values, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+void addCombo( ui::Widget vbox, const char* name, int& data, StringArrayRange values );
+void addSlider( ui::Widget vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment );
+void addRadio( ui::Widget vbox, const char* name, StringArrayRange names, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+void addRadio( ui::Widget vbox, const char* name, int& data, StringArrayRange names );
+void addRadioIcons( ui::Widget vbox, const char* name, StringArrayRange icons, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+void addRadioIcons( ui::Widget vbox, const char* name, int& data, StringArrayRange icons );
+ui::Widget addIntEntry( ui::Widget vbox, const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+ui::Widget addEntry( ui::Widget vbox, const char* name, int& data ){
return addIntEntry( vbox, name, IntImportCaller( data ), IntExportCaller( data ) );
}
-GtkWidget* addSizeEntry( GtkWidget* vbox, const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback );
-GtkWidget* addEntry( GtkWidget* vbox, const char* name, std::size_t& data ){
+ui::Widget addSizeEntry( ui::Widget vbox, const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback );
+ui::Widget addEntry( ui::Widget vbox, const char* name, std::size_t& data ){
return addSizeEntry( vbox, name, SizeImportCaller( data ), SizeExportCaller( data ) );
}
-GtkWidget* addFloatEntry( GtkWidget* vbox, const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
-GtkWidget* addEntry( GtkWidget* vbox, const char* name, float& data ){
+ui::Widget addFloatEntry( ui::Widget vbox, const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
+ui::Widget addEntry( ui::Widget vbox, const char* name, float& data ){
return addFloatEntry( vbox, name, FloatImportCaller( data ), FloatExportCaller( data ) );
}
-GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback );
-GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, std::string& data, bool directory );
-GtkWidget* addSpinner( GtkWidget* vbox, const char* name, int& data, double value, double lower, double upper );
-GtkWidget* addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-GtkWidget* addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
+ui::Widget addPathEntry( ui::Widget vbox, const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback );
+ui::Widget addPathEntry( ui::Widget vbox, const char* name, std::string& data, bool directory );
+ui::SpinButton addSpinner( ui::Widget vbox, const char* name, int& data, double value, double lower, double upper );
+ui::SpinButton addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+ui::SpinButton addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
protected:
#include "qe3.h"
#include "commands.h"
+#include "uilib/uilib.h"
+
struct entity_globals_t
{
Vector3 color_entity;
void Entity_createFromSelection( const char* name, const Vector3& origin ){
#if 0
if ( string_equal_nocase( name, "worldspawn" ) ) {
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "Can't create an entity with worldspawn.", "info" );
+ ui::alert( GTK_WIDGET( MainFrame_getWindow() ), "Can't create an entity with worldspawn.", "info" );
return;
}
#endif
}
if ( isModel ) {
- const char* model = misc_model_dialog( GTK_WIDGET( MainFrame_getWindow() ) );
+ const char* model = misc_model_dialog(MainFrame_getWindow());
if ( model != 0 ) {
Node_getEntity( node )->setKeyValue( "model", model );
}
normalize = false;
}
- if ( color_dialog( GTK_WIDGET( MainFrame_getWindow() ), g_entity_globals.color_entity ) ) {
+ if ( color_dialog( MainFrame_getWindow(), g_entity_globals.color_entity ) ) {
if ( normalize ) {
NormalizeColor( g_entity_globals.color_entity );
}
}
}
-const char* misc_model_dialog( GtkWidget* parent ){
+const char* misc_model_dialog( ui::Widget parent ){
StringOutputStream buffer( 1024 );
buffer << g_qeglobals.m_userGamePath.c_str() << "models/";
buffer << g_qeglobals.m_userGamePath.c_str() << "/";
}
- const char *filename = file_dialog( parent, TRUE, "Choose Model", buffer.c_str(), ModelLoader::Name() );
+ const char *filename = parent.file_dialog( TRUE, "Choose Model", buffer.c_str(), ModelLoader::Name() );
if ( filename != 0 ) {
// use VFS to get the correct relative path
const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
#if !defined( INCLUDED_ENTITY_H )
#define INCLUDED_ENTITY_H
+#include <uilib/uilib.h>
+
template<typename Element> class BasicVector3;
typedef BasicVector3<float> Vector3;
void Entity_createFromSelection( const char* name, const Vector3& origin );
void Scene_EntitySetClassname_Selected( const char* classname );
-typedef struct _GtkWidget GtkWidget;
-const char* misc_model_dialog( GtkWidget* parent );
+const char* misc_model_dialog( ui::Widget parent );
typedef struct _GtkMenu GtkMenu;
void Entity_constructMenu( GtkMenu* menu );
#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkentry.h>
#include <gtk/gtkcombobox.h>
+#include <uilib/uilib.h>
#include "os/path.h"
{
public:
virtual ~EntityAttribute(){}
-virtual GtkWidget* getWidget() const = 0;
+virtual ui::Widget getWidget() const = 0;
virtual void update() = 0;
virtual void release() = 0;
};
std::string m_key;
GtkCheckButton* m_check;
-static gboolean toggled( GtkWidget *widget, BooleanAttribute* self ){
+static gboolean toggled( ui::Widget widget, BooleanAttribute* self ){
self->apply();
return FALSE;
}
update();
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_check );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_check ));
}
void release(){
delete this;
m_entry = entry;
m_nonModal.connect( m_entry );
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_entry );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_entry ));
}
GtkEntry* getEntry() const {
return m_entry;
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_entry.m_entry.m_frame );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_entry.m_entry.m_frame ));
}
void apply(){
StringOutputStream value( 64 );
}
typedef MemberCaller<ModelAttribute, &ModelAttribute::update> UpdateCaller;
void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
- const char *filename = misc_model_dialog( gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) ) );
+ const char *filename = misc_model_dialog( ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) ) ));
if ( filename != 0 ) {
setPath( filename );
typedef MemberCaller1<ModelAttribute, const BrowsedPathEntry::SetPathCallback&, &ModelAttribute::browse> BrowseCaller;
};
-const char* browse_sound( GtkWidget* parent ){
+const char* browse_sound( ui::Widget parent ){
StringOutputStream buffer( 1024 );
buffer << g_qeglobals.m_userGamePath.c_str() << "sound/";
buffer << g_qeglobals.m_userGamePath.c_str() << "/";
}
- const char* filename = file_dialog( parent, TRUE, "Open Wav File", buffer.c_str(), "sound" );
+ const char* filename = parent.file_dialog(TRUE, "Open Wav File", buffer.c_str(), "sound" );
if ( filename != 0 ) {
const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
if ( relative == filename ) {
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_entry.m_entry.m_frame );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_entry.m_entry.m_frame ));
}
void apply(){
StringOutputStream value( 64 );
}
typedef MemberCaller<SoundAttribute, &SoundAttribute::update> UpdateCaller;
void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
- const char *filename = browse_sound( gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) ) );
+ const char *filename = browse_sound( ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) )) );
if ( filename != 0 ) {
setPath( filename );
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_entry );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_entry ));
}
void apply(){
StringOutputStream angle( 32 );
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_hbox );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_hbox ));
}
void apply(){
StringOutputStream angle( 32 );
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_hbox );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_hbox ));
}
void apply(){
StringOutputStream angles( 64 );
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_hbox );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_hbox ));
}
void apply(){
StringOutputStream vector3( 64 );
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_combo );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_combo ));
}
void apply(){
Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), m_type[gtk_combo_box_get_active( m_combo )].second.c_str() );
namespace
{
-GtkWidget* g_entity_split1 = 0;
-GtkWidget* g_entity_split2 = 0;
+ui::Widget g_entity_split1;
+ui::Widget g_entity_split2;
int g_entitysplit1_position;
int g_entitysplit2_position;
{
for ( int i = 0; i < g_spawnflag_count; ++i )
{
- GtkWidget* widget = GTK_WIDGET( g_entitySpawnflagsCheck[i] );
+ ui::Widget widget = ui::Widget(GTK_WIDGET( g_entitySpawnflagsCheck[i] ));
gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), " " );
gtk_widget_hide( widget );
gtk_widget_ref( widget );
{
for ( int i = 0; i < g_spawnflag_count; ++i )
{
- GtkWidget* widget = GTK_WIDGET( g_entitySpawnflagsCheck[i] );
+ ui::Widget widget = ui::Widget(GTK_WIDGET( g_entitySpawnflagsCheck[i] ));
gtk_widget_show( widget );
StringOutputStream str( 16 );
GtkTreeModel* model;
GtkTreeIter iter;
if ( gtk_tree_selection_get_selected( gtk_tree_view_get_selection( view ), &model, &iter ) == FALSE ) {
- gtk_MessageBox( gtk_widget_get_toplevel( GTK_WIDGET( g_entityClassList ) ), "You must have a selected class to create an entity", "info" );
+ ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityClassList ) )).alert( "You must have a selected class to create an entity", "info" );
return;
}
// TTimo: if you change the classname to worldspawn you won't merge back in the structural brushes but create a parasite entity
if ( !strcmp( key.c_str(), "classname" ) && !strcmp( value.c_str(), "worldspawn" ) ) {
- gtk_MessageBox( gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry ) ), "Cannot change \"classname\" key back to worldspawn.", 0, eMB_OK );
+ ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry )) ).alert( "Cannot change \"classname\" key back to worldspawn.", 0, ui::alert_type::OK );
return;
}
// RR2DO2: we don't want spaces in entity keys
if ( strstr( key.c_str(), " " ) ) {
- gtk_MessageBox( gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry ) ), "No spaces are allowed in entity keys.", 0, eMB_OK );
+ ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry )) ).alert( "No spaces are allowed in entity keys.", 0, ui::alert_type::OK );
return;
}
}
}
-static gint EntityClassList_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
+static gint EntityClassList_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
if ( event->type == GDK_2BUTTON_PRESS ) {
EntityClassList_createEntity();
return TRUE;
return FALSE;
}
-static gint EntityClassList_keypress( GtkWidget* widget, GdkEventKey* event, gpointer data ){
+static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpointer data ){
unsigned int code = gdk_keyval_to_upper( event->keyval );
if ( event->keyval == GDK_Return ) {
g_free( val );
}
-static void SpawnflagCheck_toggled( GtkWidget *widget, gpointer data ){
+static void SpawnflagCheck_toggled( ui::Widget widget, gpointer data ){
EntityInspector_applySpawnflags();
}
return FALSE;
}
-void EntityInspector_destroyWindow( GtkWidget* widget, gpointer data ){
+void EntityInspector_destroyWindow( ui::Widget widget, gpointer data ){
g_entitysplit1_position = gtk_paned_get_position( GTK_PANED( g_entity_split1 ) );
g_entitysplit2_position = gtk_paned_get_position( GTK_PANED( g_entity_split2 ) );
GlobalEntityAttributes_clear();
}
-GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
- GtkWidget* vbox = gtk_vbox_new( FALSE, 2 );
+ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
+ ui::Widget vbox = ui::Widget(gtk_vbox_new( FALSE, 2 ));
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 );
g_signal_connect( G_OBJECT( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
{
- GtkWidget* split1 = gtk_vpaned_new();
+ ui::Widget split1 = ui::Widget(gtk_vpaned_new());
gtk_box_pack_start( GTK_BOX( vbox ), split1, TRUE, TRUE, 0 );
gtk_widget_show( split1 );
g_entity_split1 = split1;
{
- GtkWidget* split2 = gtk_vpaned_new();
+ ui::Widget split2 = ui::Widget(gtk_vpaned_new());
gtk_paned_add1( GTK_PANED( split1 ), split2 );
gtk_widget_show( split2 );
{
// class list
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
gtk_widget_show( scr );
gtk_paned_add1( GTK_PANED( split2 ), scr );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
}
{
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
gtk_widget_show( scr );
gtk_paned_add2( GTK_PANED( split2 ), scr );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
}
{
- GtkWidget* split2 = gtk_vpaned_new();
+ ui::Widget split2 = ui::Widget(gtk_vpaned_new());
gtk_paned_add2( GTK_PANED( split1 ), split2 );
gtk_widget_show( split2 );
{
- GtkWidget* vbox2 = gtk_vbox_new( FALSE, 2 );
+ ui::Widget vbox2 = ui::Widget(gtk_vbox_new( FALSE, 2 ));
gtk_widget_show( vbox2 );
gtk_paned_pack1( GTK_PANED( split2 ), vbox2, FALSE, FALSE );
{
// key/value list
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
gtk_widget_show( scr );
gtk_box_pack_start( GTK_BOX( vbox2 ), scr, TRUE, TRUE, 0 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
{
GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Value" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Value" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions)( GTK_FILL ),
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Key" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Key" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions)( GTK_FILL ),
}
{
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
gtk_widget_show( scr );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
- GtkWidget* viewport = gtk_viewport_new( 0, 0 );
+ ui::Widget viewport = ui::Widget(gtk_viewport_new( 0, 0 ));
gtk_widget_show( viewport );
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport ), GTK_SHADOW_NONE );
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_ENTITYINSPECTOR_H )
#define INCLUDED_ENTITYINSPECTOR_H
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-GtkWidget* EntityInspector_constructWindow( GtkWindow* parent );
+ui::Widget EntityInspector_constructWindow( ui::Window parent );
void EntityInspector_construct();
void EntityInspector_destroy();
const char *EntityInspector_getCurrentKey();
#include <gtk/gtktreeview.h>
#include <gtk/gtktreeselection.h>
#include <gtk/gtkcellrenderertext.h>
+#include <uilib/uilib.h>
#include "string/string.h"
#include "scenelib.h"
IdleDraw m_idleDraw;
WindowPositionTracker m_positionTracker;
-GtkWindow* m_window;
+ui::Window m_window;
GtkTreeView* m_tree_view;
GraphTreeModel* m_tree_model;
bool m_selection_disabled;
}
bool visible() const {
- return GTK_WIDGET_VISIBLE( GTK_WIDGET( m_window ) );
+ return GTK_WIDGET_VISIBLE( m_window );
}
};
gtk_tree_view_set_model( getEntityList().m_tree_view, 0 );
}
-void EntityList_constructWindow( GtkWindow* main_window ){
- ASSERT_MESSAGE( getEntityList().m_window == 0, "error" );
+void EntityList_constructWindow( ui::Window main_window ){
+ ASSERT_TRUE( !getEntityList().m_window );
- GtkWindow* window = create_persistent_floating_window( "Entity List", main_window );
+ ui::Window window = ui::Window(create_persistent_floating_window( "Entity List", main_window ));
gtk_window_add_accel_group( window, global_accel );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) );
{
- GtkWidget* view = gtk_tree_view_new();
+ ui::Widget view = ui::Widget(gtk_tree_view_new());
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_ENTITYLIST_H )
#define INCLUDED_ENTITYLIST_H
void EntityList_Construct();
void EntityList_Destroy();
-typedef struct _GtkWindow GtkWindow;
-void EntityList_constructWindow( GtkWindow* main_window );
+void EntityList_constructWindow( ui::Window main_window );
void EntityList_destroyWindow();
void EntityList_toggleShown();
// push in the list
g_ptr_array_add( m_pFeedbackElements, (void *)pHandler );
- if ( GetWidget() == 0 ) {
+ if ( !GetWidget() ) {
Create();
}
ShowDlg();
}
-GtkWindow* CDbgDlg::BuildDialog(){
- GtkWindow* window = create_floating_window( "Q3Map debug window", MainFrame_getWindow() );
+ui::Window CDbgDlg::BuildDialog(){
+ ui::Window window = MainFrame_getWindow().create_floating_window("Q3Map debug window" );
- GtkWidget* scr = gtk_scrolled_window_new( NULL, NULL );
+ ui::Widget scr = ui::Widget(gtk_scrolled_window_new( NULL, NULL ));
gtk_widget_show( scr );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
{
GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
{
}
}
void destroyWindow(){
- if ( GetWidget() != 0 ) {
+ if ( GetWidget() ) {
Destroy();
}
}
// void HideDlg();
protected:
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
};
extern CDbgDlg g_DbgDlg;
FindTextureDialog();
virtual ~FindTextureDialog();
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
-void constructWindow( GtkWindow* parent ){
+void constructWindow( ui::Window parent ){
m_parent = parent;
Create();
}
FindReplaceTextures( find.c_str(), replace.c_str(), g_FindTextureDialog.m_bSelectedOnly );
}
-static void OnApply( GtkWidget* widget, gpointer data ){
+static void OnApply( ui::Widget widget, gpointer data ){
g_FindTextureDialog.exportData();
FindTextureDialog_apply();
}
g_FindTextureDialog.HideDlg();
}*/
-static void OnClose( GtkWidget* widget, gpointer data ){
+static void OnClose( ui::Widget widget, gpointer data ){
g_FindTextureDialog.HideDlg();
}
-static gint find_focus_in( GtkWidget* widget, GdkEventFocus *event, gpointer data ){
+static gint find_focus_in( ui::Widget widget, GdkEventFocus *event, gpointer data ){
g_bFindActive = true;
return FALSE;
}
-static gint replace_focus_in( GtkWidget* widget, GdkEventFocus *event, gpointer data ){
+static gint replace_focus_in( ui::Widget widget, GdkEventFocus *event, gpointer data ){
g_bFindActive = false;
return FALSE;
}
FindTextureDialog::~FindTextureDialog(){
}
-GtkWindow* FindTextureDialog::BuildDialog(){
- GtkWidget* vbox, *hbox, *table, *label;
- GtkWidget* button, *check, *entry;
+ui::Window FindTextureDialog::BuildDialog(){
+ ui::Widget vbox, hbox, table, label;
+ ui::Widget button, check, entry;
- GtkWindow* dlg = create_floating_window( "Find / Replace Texture(s)", m_parent );
+ ui::Window dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent ));
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::Widget(gtk_hbox_new( FALSE, 5 ));
gtk_widget_show( hbox );
gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( hbox ) );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::Widget(gtk_vbox_new( FALSE, 5 ));
gtk_widget_show( vbox );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
- table = gtk_table_new( 2, 2, FALSE );
+ table = ui::Widget(gtk_table_new( 2, 2, FALSE ));
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Find:" );
+ label = ui::Label( "Find:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
- label = gtk_label_new( "Replace:" );
+ label = ui::Label( "Replace:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
- entry = gtk_entry_new();
+ entry = ui::Widget(gtk_entry_new());
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
AddDialogData( *GTK_ENTRY( entry ), m_strFind );
GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
- entry = gtk_entry_new();
+ entry = ui::Widget(gtk_entry_new());
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
AddDialogData( *GTK_ENTRY( entry ), m_strReplace );
GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
- check = gtk_check_button_new_with_label( "Within selected brushes only" );
+ check = ui::Widget(gtk_check_button_new_with_label( "Within selected brushes only" ));
gtk_widget_show( check );
gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 );
AddDialogData( *GTK_TOGGLE_BUTTON( check ), m_bSelectedOnly );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::Widget(gtk_vbox_new( FALSE, 5 ));
gtk_widget_show( vbox );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
- button = gtk_button_new_with_label( "Apply" );
+ button = ui::Widget(gtk_button_new_with_label( "Apply" ));
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnApply ), 0 );
gtk_widget_set_usize( button, 60, -2 );
- button = gtk_button_new_with_label( "Close" );
+ button = ui::Widget(gtk_button_new_with_label( "Close" ));
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
}
-void FindTextureDialog_constructWindow( GtkWindow* main_window ){
+void FindTextureDialog_constructWindow( ui::Window main_window ){
g_FindTextureDialog.constructWindow( main_window );
}
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_FINDTEXTUREDIALOG_H )
#define INCLUDED_FINDTEXTUREDIALOG_H
void FindTextureDialog_Construct();
void FindTextureDialog_Destroy();
-typedef struct _GtkWindow GtkWindow;
-void FindTextureDialog_constructWindow( GtkWindow* main_window );
+void FindTextureDialog_constructWindow( ui::Window main_window );
void FindTextureDialog_destroyWindow();
bool FindTextureDialog_isOpen();
void FindTextureDialog_selectTexture( const char* name );
class GroupDlg
{
public:
-GtkWidget* m_pNotebook;
-GtkWindow* m_window;
+ui::Widget m_pNotebook;
+ui::Window m_window;
GroupDlg();
-void Create( GtkWindow* parent );
+void Create( ui::Window parent );
void Show(){
// workaround for strange gtk behaviour - modifying the contents of a window while it is not visible causes the window position to change without sending a configure_event
std::vector<StringExportCallback> g_pages;
}
-void GroupDialog_updatePageTitle( GtkWindow* window, std::size_t pageIndex ){
+void GroupDialog_updatePageTitle( ui::Window window, std::size_t pageIndex ){
if ( pageIndex < g_pages.size() ) {
g_pages[pageIndex]( PointerCaller1<GtkWindow, const char*, gtk_window_set_title>( window ) );
}
}
static gboolean switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data ){
- GroupDialog_updatePageTitle( GTK_WINDOW( data ), page_num );
+ GroupDialog_updatePageTitle( ui::Window(GTK_WINDOW( data )), page_num );
g_current_page = page_num;
return FALSE;
m_position_tracker.setPosition( c_default_window_pos );
}
-void GroupDlg::Create( GtkWindow* parent ){
- ASSERT_MESSAGE( m_window == 0, "dialog already created" );
+void GroupDlg::Create( ui::Window parent ){
+ ASSERT_MESSAGE( !m_window, "dialog already created" );
- GtkWindow* window = create_persistent_floating_window( "Entities", parent );
+ ui::Window window = ui::Window(create_persistent_floating_window( "Entities", parent ));
global_accel_connect_window( window );
m_position_tracker.connect( window );
{
- GtkWidget* notebook = gtk_notebook_new();
+ ui::Widget notebook = ui::Widget(gtk_notebook_new());
gtk_widget_show( notebook );
gtk_container_add( GTK_CONTAINER( window ), notebook );
gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_BOTTOM );
m_pNotebook = notebook;
- g_signal_connect( G_OBJECT( notebook ), "switch_page", G_CALLBACK( switch_page ), window );
+ g_signal_connect( notebook, "switch_page", G_CALLBACK( switch_page ), window );
}
}
-GtkWidget* GroupDialog_addPage( const char* tabLabel, GtkWidget* widget, const StringExportCallback& title ){
- GtkWidget* w = gtk_label_new( tabLabel );
+ui::Widget GroupDialog_addPage( const char* tabLabel, ui::Widget widget, const StringExportCallback& title ){
+ ui::Widget w = ui::Label( tabLabel );
gtk_widget_show( w );
- GtkWidget* page = gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gtk_notebook_insert_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), widget, w, -1 ) );
+ ui::Widget page = ui::Widget(gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gtk_notebook_insert_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), widget, w, -1 ) ));
g_pages.push_back( title );
return page;
GroupDialog_setShown( !GroupDialog_isShown() );
}
-void GroupDialog_constructWindow( GtkWindow* main_window ){
+void GroupDialog_constructWindow( ui::Window main_window ){
g_GroupDlg.Create( main_window );
}
void GroupDialog_destroyWindow(){
- ASSERT_NOTNULL( g_GroupDlg.m_window );
+ ASSERT_TRUE( g_GroupDlg.m_window );
destroy_floating_window( g_GroupDlg.m_window );
- g_GroupDlg.m_window = 0;
+ g_GroupDlg.m_window = ui::Window();
}
-GtkWindow* GroupDialog_getWindow(){
- return g_GroupDlg.m_window;
+ui::Window GroupDialog_getWindow(){
+ return ui::Window(g_GroupDlg.m_window);
}
void GroupDialog_show(){
g_GroupDlg.Show();
}
-GtkWidget* GroupDialog_getPage(){
- return gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) );
+ui::Widget GroupDialog_getPage(){
+ return ui::Widget(gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) ));
}
-void GroupDialog_setPage( GtkWidget* page ){
+void GroupDialog_setPage( ui::Widget page ){
g_current_page = gtk_notebook_page_num( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), page );
gtk_notebook_set_current_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) );
}
-void GroupDialog_showPage( GtkWidget* page ){
+void GroupDialog_showPage( ui::Widget page ){
if ( GroupDialog_getPage() == page ) {
GroupDialog_ToggleShow();
}
gtk_notebook_set_current_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) );
}
-void GroupDialog_updatePageTitle( GtkWidget* page ){
+void GroupDialog_updatePageTitle( ui::Widget page ){
if ( GroupDialog_getPage() == page ) {
GroupDialog_updatePageTitle( g_GroupDlg.m_window, g_current_page );
}
#if !defined( INCLUDED_GROUPDIALOG_H )
#define INCLUDED_GROUPDIALOG_H
+#include <uilib/uilib.h>
#include "generic/callback.h"
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-
void GroupDialog_Construct();
void GroupDialog_Destroy();
-void GroupDialog_constructWindow( GtkWindow* main_window );
+void GroupDialog_constructWindow( ui::Window main_window );
void GroupDialog_destroyWindow();
-GtkWindow* GroupDialog_getWindow();
+ui::Window GroupDialog_getWindow();
void GroupDialog_show();
inline void RawStringExport( const char* string, const StringImportCallback& importer ){
importer( string );
}
typedef ConstPointerCaller1<char, const StringImportCallback&, RawStringExport> RawStringExportCaller;
-GtkWidget* GroupDialog_addPage( const char* tabLabel, GtkWidget* widget, const StringExportCallback& title );
+ui::Widget GroupDialog_addPage( const char* tabLabel, ui::Widget widget, const StringExportCallback& title );
-void GroupDialog_showPage( GtkWidget* page );
-void GroupDialog_updatePageTitle( GtkWidget* page );
+void GroupDialog_showPage( ui::Widget page );
+void GroupDialog_updatePageTitle( ui::Widget page );
bool GroupDialog_isShown();
-GtkWidget* GroupDialog_getPage();
+ui::Widget GroupDialog_getPage();
#endif
#include <gtk/gtkcellrenderertext.h>
#include <gtk/gtktreeselection.h>
#include <gtk/gtkliststore.h>
+#include <uilib/uilib.h>
#include "os/path.h"
#include "math/aabb.h"
GtkEntry* fsgame_entry;
};
-gboolean OnSelchangeComboWhatgame( GtkWidget *widget, GameCombo* combo ){
+gboolean OnSelchangeComboWhatgame( ui::Widget widget, GameCombo* combo ){
const char *gamename;
{
GtkTreeIter iter;
GtkComboBox* gamemode_combo;
};
-GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Project Settings", G_CALLBACK( dialog_delete_callback ), &modal );
+ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Project Settings", G_CALLBACK(dialog_delete_callback ), &modal );
{
GtkTable* table1 = create_dialog_table( 1, 2, 4, 4, 4 );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table2 ) );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Select mod" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Select mod" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "fs_game" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "fs_game" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
}
if ( globalMappingMode().do_mapping_mode ) {
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Mapping mode" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Mapping mode" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_FILL ),
ModalDialog modal;
ProjectSettingsDialog dialog;
- GtkWindow* window = ProjectSettingsDialog_construct( dialog, modal );
+ ui::Window window = ProjectSettingsDialog_construct( dialog, modal );
if ( modal_dialog_show( window, modal ) == eIDOK ) {
ProjectSettingsDialog_ok( dialog );
ModalDialog dialog;
GtkEntry* sides_entry;
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Arbitrary sides", G_CALLBACK( dialog_delete_callback ), &dialog );
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog );
GtkAccelGroup* accel = gtk_accel_group_new();
gtk_window_add_accel_group( window, accel );
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Sides:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Sides:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
// =============================================================================
// About dialog (no program is complete without one)
-void about_button_changelog( GtkWidget *widget, gpointer data ){
+void about_button_changelog( ui::Widget widget, gpointer data ){
StringOutputStream log( 256 );
log << AppPath_get() << "changelog.txt";
OpenURL( log.c_str() );
}
-void about_button_credits( GtkWidget *widget, gpointer data ){
+void about_button_credits( ui::Widget widget, gpointer data ){
StringOutputStream cred( 256 );
cred << AppPath_get() << "credits.html";
OpenURL( cred.c_str() );
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "About NetRadiant", dialog );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window("About NetRadiant", dialog );
{
GtkVBox* vbox = create_dialog_vbox( 4, 4 );
"you may report your problems at\n"
"https://gitlab.com/xonotic/netradiant/issues";
- GtkLabel* label = GTK_LABEL( gtk_label_new( label_text.c_str() ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( label_text.c_str() ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
GtkTable* table = create_dialog_table( 3, 2, 4, 4, 4 );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table ) );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Vendor:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Vendor:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Version:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Version:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Renderer:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Renderer:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
GtkScrolledWindow* sc_extensions = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, 4 );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( sc_extensions ) );
{
- GtkWidget* text_extensions = gtk_text_view_new();
+ ui::Widget text_extensions = ui::Widget(gtk_text_view_new());
gtk_text_view_set_editable( GTK_TEXT_VIEW( text_extensions ), FALSE );
gtk_container_add( GTK_CONTAINER( sc_extensions ), text_extensions );
GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( text_extensions ) );
GtkEntry* x;
GtkEntry* y;
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Patch texture layout", dialog );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
GtkAccelGroup* accel = gtk_accel_group_new();
gtk_window_add_accel_group( window, accel );
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture will be fit across the patch based\n"
+ GtkLabel* label = GTK_LABEL( ui::Label( "Texture will be fit across the patch based\n"
"on the x and y values given. Values of 1x1\n"
"will \"fit\" the texture. 2x2 will repeat\n"
"it twice, etc." ) );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture x:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Texture x:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture y:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Texture y:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
// Text Editor dialog
// master window widget
-static GtkWidget *text_editor = 0;
-static GtkWidget *text_widget; // slave, text widget from the gtk editor
+static ui::Widget text_editor;
+static ui::Widget text_widget; // slave, text widget from the gtk editor
-static gint editor_delete( GtkWidget *widget, gpointer data ){
- if ( gtk_MessageBox( widget, "Close the shader editor ?", "Radiant", eMB_YESNO, eMB_ICONQUESTION ) == eIDNO ) {
+static gint editor_delete( ui::Widget widget, gpointer data ){
+ if ( widget.alert( "Close the shader editor ?", "Radiant", ui::alert_type::YESNO, ui::alert_icon::QUESTION ) == ui::alert_response::NO ) {
return TRUE;
}
return TRUE;
}
-static void editor_save( GtkWidget *widget, gpointer data ){
+static void editor_save( ui::Widget widget, gpointer data ){
FILE *f = fopen( (char*)g_object_get_data( G_OBJECT( data ), "filename" ), "w" );
gpointer text = g_object_get_data( G_OBJECT( data ), "text" );
if ( f == 0 ) {
- gtk_MessageBox( GTK_WIDGET( data ), "Error saving file !" );
+ ui::Widget(GTK_WIDGET( data )).alert( "Error saving file !" );
return;
}
fclose( f );
}
-static void editor_close( GtkWidget *widget, gpointer data ){
- if ( gtk_MessageBox( text_editor, "Close the shader editor ?", "Radiant", eMB_YESNO, eMB_ICONQUESTION ) == eIDNO ) {
+static void editor_close( ui::Widget widget, gpointer data ){
+ if ( text_editor.alert( "Close the shader editor ?", "Radiant", ui::alert_type::YESNO, ui::alert_icon::QUESTION ) == ui::alert_response::NO ) {
return;
}
}
static void CreateGtkTextEditor(){
- GtkWidget *dlg;
- GtkWidget *vbox, *hbox, *button, *scr, *text;
+ ui::Widget dlg;
+ ui::Widget vbox, hbox, button, scr, text;
- dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ dlg = ui::Widget(gtk_window_new( GTK_WINDOW_TOPLEVEL ));
g_signal_connect( G_OBJECT( dlg ), "delete_event",
G_CALLBACK( editor_delete ), 0 );
gtk_window_set_default_size( GTK_WINDOW( dlg ), 600, 300 );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::Widget(gtk_vbox_new( FALSE, 5 ));
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( vbox ) );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- scr = gtk_scrolled_window_new( 0, 0 );
+ scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
gtk_widget_show( scr );
gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
- text = gtk_text_view_new();
+ text = ui::Widget(gtk_text_view_new());
gtk_container_add( GTK_CONTAINER( scr ), text );
gtk_widget_show( text );
- g_object_set_data( G_OBJECT( dlg ), "text", text );
+ g_object_set_data( G_OBJECT( dlg ), "text", (gpointer) text );
gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), TRUE );
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::Widget(gtk_hbox_new( FALSE, 5 ));
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 );
- button = gtk_button_new_with_label( "Close" );
+ button = ui::Widget(gtk_button_new_with_label( "Close" ));
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( editor_close ), dlg );
gtk_widget_set_usize( button, 60, -2 );
- button = gtk_button_new_with_label( "Save" );
+ button = ui::Widget(gtk_button_new_with_label( "Save" ));
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Light intensity", dialog, -1, -1 );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Light intensity", dialog, -1, -1 );
GtkAccelGroup *accel_group = gtk_accel_group_new();
gtk_window_add_accel_group( window, accel_group );
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "ESC for default, ENTER to validate" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "ESC for default, ENTER to validate" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), title, dialog, -1, -1 );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
GtkAccelGroup *accel_group = gtk_accel_group_new();
gtk_window_add_accel_group( window, accel_group );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
{
//GtkLabel* label = GTK_LABEL(gtk_label_new("Enter one ore more tags separated by spaces"));
- GtkLabel* label = GTK_LABEL( gtk_label_new( "ESC to cancel, ENTER to validate" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "ESC to cancel, ENTER to validate" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), title, dialog, -1, -1 );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
GtkAccelGroup *accel_group = gtk_accel_group_new();
gtk_window_add_accel_group( window, accel_group );
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "The selected shader" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "The selected shader" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( name ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( name ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "is located in file" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "is located in file" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( filename ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( filename ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
#include <gtk/gtkcolorseldialog.h>
#include <gtk/gtkentry.h>
+#include "uilib/uilib.h"
#include "math/vector.h"
#include "os/path.h"
// =============================================================================
// File dialog
-bool color_dialog( GtkWidget *parent, Vector3& color, const char* title ){
- GtkWidget* dlg;
+bool color_dialog( ui::Widget parent, Vector3& color, const char* title ){
+ ui::Widget dlg;
double clr[3];
ModalDialog dialog;
clr[1] = color[1];
clr[2] = color[2];
- dlg = gtk_color_selection_dialog_new( title );
+ dlg = ui::Widget(gtk_color_selection_dialog_new( title ));
gtk_color_selection_set_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr );
g_signal_connect( G_OBJECT( dlg ), "delete_event", G_CALLBACK( dialog_delete_callback ), &dialog );
g_signal_connect( G_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->ok_button ), "clicked", G_CALLBACK( dialog_button_ok ), &dialog );
g_signal_connect( G_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->cancel_button ), "clicked", G_CALLBACK( dialog_button_cancel ), &dialog );
- if ( parent != 0 ) {
+ if ( parent ) {
gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( parent ) );
}
return ok;
}
-void button_clicked_entry_browse_file( GtkWidget* widget, GtkEntry* entry ){
- const char *filename = file_dialog( gtk_widget_get_toplevel( widget ), TRUE, "Choose File", gtk_entry_get_text( entry ) );
+void button_clicked_entry_browse_file( ui::Widget widget, GtkEntry* entry ){
+ const char *filename = ui::Widget(gtk_widget_get_toplevel( widget )).file_dialog( TRUE, "Choose File", gtk_entry_get_text( entry ) );
if ( filename != 0 ) {
gtk_entry_set_text( entry, filename );
}
}
-void button_clicked_entry_browse_directory( GtkWidget* widget, GtkEntry* entry ){
+void button_clicked_entry_browse_directory( ui::Widget widget, GtkEntry* entry ){
const char* text = gtk_entry_get_text( entry );
- char *dir = dir_dialog( gtk_widget_get_toplevel( widget ), "Choose Directory", path_is_absolute( text ) ? text : "" );
+ char *dir = dir_dialog( ui::Widget(gtk_widget_get_toplevel( widget )), "Choose Directory", path_is_absolute( text ) ? text : "" );
if ( dir != 0 ) {
gchar* converted = g_filename_to_utf8( dir, -1, 0, 0, 0 );
#define INCLUDED_GTKMISC_H
#include <gtk/gtkmain.h>
+#include <uilib/uilib.h>
inline void process_gui(){
while ( gtk_events_pending() )
template<typename Element> class BasicVector3;
typedef BasicVector3<float> Vector3;
-bool color_dialog( GtkWidget *parent, Vector3& color, const char* title = "Choose Color" );
+bool color_dialog( ui::Widget parent, Vector3& color, const char* title = "Choose Color" );
typedef struct _GtkEntry GtkEntry;
-void button_clicked_entry_browse_file( GtkWidget* widget, GtkEntry* entry );
-void button_clicked_entry_browse_directory( GtkWidget* widget, GtkEntry* entry );
+void button_clicked_entry_browse_file( ui::Widget widget, GtkEntry* entry );
+void button_clicked_entry_browse_directory( ui::Widget widget, GtkEntry* entry );
#endif
#include "iundo.h"
+#include "uilib/uilib.h"
#include <gtk/gtkmain.h>
#include "cmdlib.h"
ScopedLock lock( m_lock );
#if defined _DEBUG
m_buffer << "Break into the debugger?\n";
- bool handled = gtk_MessageBox( 0, m_buffer.c_str(), "Radiant - Runtime Error", eMB_YESNO, eMB_ICONERROR ) == eIDNO;
+ bool handled = ui::alert( 0, m_buffer.c_str(), "Radiant - Runtime Error", eMB_YESNO, eMB_ICONERROR ) == eIDNO;
m_buffer.clear();
return handled;
#else
m_buffer << "Please report this error to the developers\n";
- gtk_MessageBox( 0, m_buffer.c_str(), "Radiant - Runtime Error", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::OK, ui::alert_icon::ERROR );
m_buffer.clear();
#endif
}
<< ") doesn't match what the latest setup has configured in this directory\n"
"Make sure you run the right/latest editor binary you installed\n"
<< AppPath_get();
- gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONDEFAULT );
+ ui::alert( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONDEFAULT );
}
return bVerIsGood;
#else
if ( remove( g_pidFile.c_str() ) == -1 ) {
StringOutputStream msg( 256 );
msg << "WARNING: Could not delete " << g_pidFile.c_str();
- gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::ERROR );
}
// in debug, never prompt to clean registry, turn console logging auto after a failed start
"The failure may be related to current global preferences.\n"
"Do you want to reset global preferences to defaults?";
- if ( gtk_MessageBox( 0, msg.c_str(), "Radiant - Startup Failure", eMB_YESNO, eMB_ICONQUESTION ) == eIDYES ) {
+ if ( ui::root.alert( msg.c_str(), "Radiant - Startup Failure", ui::alert_type::YESNO, ui::alert_icon::QUESTION ) == ui::alert_response::YES ) {
g_GamesDialog.Reset();
}
msg.clear();
msg << "Logging console output to " << SettingsPath_get() << "radiant.log\nRefer to the log if Radiant fails to start again.";
- gtk_MessageBox( 0, msg.c_str(), "Radiant - Console Log", eMB_OK );
+ ui::root.alert( msg.c_str(), "Radiant - Console Log", ui::alert_type::OK );
#endif
// set without saving, the class is not in a coherent state yet
if ( remove( g_pidFile.c_str() ) == -1 ) {
StringOutputStream msg( 256 );
msg << "WARNING: Could not delete " << g_pidFile.c_str();
- gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::ERROR );
}
}
if ( remove( g_pidGameFile.c_str() ) == -1 ) {
StringOutputStream msg;
msg << "WARNING: Could not delete " << g_pidGameFile.c_str();
- gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::ERROR );
}
// in debug, never prompt to clean registry, turn console logging auto after a failed start
"The failure may be caused by current preferences.\n"
"Do you want to reset all preferences to defaults?";
- if ( gtk_MessageBox( 0, msg.c_str(), "Radiant - Startup Failure", eMB_YESNO, eMB_ICONQUESTION ) == eIDYES ) {
+ if ( ui::root.alert( msg.c_str(), "Radiant - Startup Failure", ui::alert_type::YESNO, ui::alert_icon::QUESTION ) == ui::alert_response::YES ) {
Preferences_Reset();
}
msg.clear();
msg << "Logging console output to " << SettingsPath_get() << "radiant.log\nRefer to the log if Radiant fails to start again.";
- gtk_MessageBox( 0, msg.c_str(), "Radiant - Console Log", eMB_OK );
+ ui::root.alert( msg.c_str(), "Radiant - Console Log", ui::alert_type::OK );
#endif
// force console logging on! (will go in prefs too)
}
#endif
- gtk_disable_setlocale();
- gtk_init( &argc, &argv );
+ ui::init(argc, argv);
// redirect Gtk warnings to the console
g_log_set_handler( "Gdk", (GLogLevelFlags)( G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING |
remove_local_pid();
- gtk_main();
+ ui::main();
// avoid saving prefs when the app is minimized
if ( g_pParentWnd->IsSleeping() ) {
#include "mainframe.h"
-#include "debugging/debugging.h"
#include "version.h"
#include "ifilesystem.h"
#include "iundo.h"
-#include "ifilter.h"
-#include "itoolbar.h"
#include "editable.h"
#include "ientity.h"
#include "ishaders.h"
#include <gtk/gtkhpaned.h>
#include <gtk/gtkvpaned.h>
#include <gtk/gtktoolbar.h>
-#include <gtk/gtkmenubar.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtktable.h>
#include "cmdlib.h"
-#include "scenelib.h"
#include "stream/stringstream.h"
#include "signal/isignal.h"
#include "os/path.h"
#include "moduleobservers.h"
#include "gtkutil/clipboard.h"
-#include "gtkutil/container.h"
#include "gtkutil/frame.h"
-#include "gtkutil/glfont.h"
#include "gtkutil/glwidget.h"
#include "gtkutil/image.h"
#include "gtkutil/menu.h"
#include "gtkutil/paned.h"
-#include "gtkutil/widget.h"
#include "autosave.h"
#include "build.h"
#include "pluginmanager.h"
#include "pluginmenu.h"
#include "plugintoolbar.h"
-#include "points.h"
#include "preferences.h"
#include "qe3.h"
#include "qgl.h"
class PathsDialog : public Dialog
{
public:
-GtkWindow* BuildDialog(){
+ui::Window BuildDialog(){
GtkFrame* frame = create_dialog_frame( "Path settings", GTK_SHADOW_ETCHED_IN );
GtkVBox* vbox2 = create_dialog_vbox( 0, 4 );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
{
- PreferencesPage preferencesPage( *this, GTK_WIDGET( vbox2 ) );
+ PreferencesPage preferencesPage( *this, ui::Widget(GTK_WIDGET( vbox2 )) );
Paths_constructPreferences( preferencesPage );
}
- return create_simple_modal_dialog_window( "Engine Path Not Found", m_modal, GTK_WIDGET( frame ) );
+ return ui::Window(create_simple_modal_dialog_window( "Engine Path Not Found", m_modal, GTK_WIDGET( frame ) ));
}
};
void operator()(){
Vector3 colour;
m_get( colour );
- color_dialog( GTK_WIDGET( MainFrame_getWindow() ), colour );
+ color_dialog( MainFrame_getWindow(), colour );
m_set( colour );
}
};
}
-GtkWidget* g_page_console;
+ui::Widget g_page_console;
void Console_ToggleShow(){
GroupDialog_showPage( g_page_console );
}
-GtkWidget* g_page_entity;
+ui::Widget g_page_entity;
void EntityInspector_ToggleShow(){
GroupDialog_showPage( g_page_entity );
}
}
-gint window_realize_remove_decoration( GtkWidget* widget, gpointer data ){
- gdk_window_set_decorations( widget->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
+gint window_realize_remove_decoration( ui::Widget widget, gpointer data ){
+ gdk_window_set_decorations( widget.handle()->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
return FALSE;
}
class WaitDialog
{
public:
-GtkWindow* m_window;
+ui::Window m_window;
GtkLabel* m_label;
};
WaitDialog create_wait_dialog( const char* title, const char* text ){
WaitDialog dialog;
- dialog.m_window = create_floating_window( title, MainFrame_getWindow() );
+ dialog.m_window = MainFrame_getWindow().create_floating_window(title);
gtk_window_set_resizable( dialog.m_window, FALSE );
gtk_container_set_border_width( GTK_CONTAINER( dialog.m_window ), 0 );
gtk_window_set_position( dialog.m_window, GTK_WIN_POS_CENTER_ON_PARENT );
g_signal_connect( G_OBJECT( dialog.m_window ), "realize", G_CALLBACK( window_realize_remove_decoration ), 0 );
{
- dialog.m_label = GTK_LABEL( gtk_label_new( text ) );
+ dialog.m_label = GTK_LABEL( ui::Label( text ) );
gtk_misc_set_alignment( GTK_MISC( dialog.m_label ), 0.0, 0.5 );
gtk_label_set_justify( dialog.m_label, GTK_JUSTIFY_LEFT );
gtk_widget_show( GTK_WIDGET( dialog.m_label ) );
gtk_grab_remove( GTK_WIDGET( g_wait.m_window ) );
destroy_floating_window( g_wait.m_window );
- g_wait.m_window = 0;
+ g_wait.m_window = ui::Window();
//gtk_window_present(MainFrame_getWindow());
}
}
-GtkWidget* g_toggle_z_item = 0;
-GtkWidget* g_toggle_console_item = 0;
-GtkWidget* g_toggle_entity_item = 0;
-GtkWidget* g_toggle_entitylist_item = 0;
+ui::Widget g_toggle_z_item;
+ui::Widget g_toggle_console_item;
+ui::Widget g_toggle_entity_item;
+ui::Widget g_toggle_entitylist_item;
GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){
// View menu
return toolbar;
}
-GtkWidget* create_main_statusbar( GtkWidget *pStatusLabel[c_count_status] ){
+ui::Widget create_main_statusbar( ui::Widget pStatusLabel[c_count_status] ){
GtkTable* table = GTK_TABLE( gtk_table_new( 1, c_count_status, FALSE ) );
gtk_widget_show( GTK_WIDGET( table ) );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Label" ) );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_misc_set_padding( GTK_MISC( label ), 4, 2 );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach_defaults( table, GTK_WIDGET( label ), 0, 1, 0, 1 );
- pStatusLabel[c_command_status] = GTK_WIDGET( label );
+ pStatusLabel[c_command_status] = ui::Widget(GTK_WIDGET( label ));
}
for ( int i = 1; i < c_count_status; ++i )
gtk_table_attach_defaults( table, GTK_WIDGET( frame ), i, i + 1, 0, 1 );
gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Label" ) );
gtk_label_set_ellipsize( label, PANGO_ELLIPSIZE_END );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_misc_set_padding( GTK_MISC( label ), 4, 2 );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( label ) );
- pStatusLabel[i] = GTK_WIDGET( label );
+ pStatusLabel[i] = ui::Widget(GTK_WIDGET( label ));
}
- return GTK_WIDGET( table );
+ return ui::Widget(GTK_WIDGET( table ));
}
#if 0
{
const char* m_name;
-static gboolean frame_event( GtkWidget *widget, GdkEvent* event, WindowFocusPrinter* self ){
+static gboolean frame_event( ui::Widget widget, GdkEvent* event, WindowFocusPrinter* self ){
globalOutputStream() << self->m_name << " frame_event\n";
return FALSE;
}
-static gboolean keys_changed( GtkWidget *widget, WindowFocusPrinter* self ){
+static gboolean keys_changed( ui::Widget widget, WindowFocusPrinter* self ){
globalOutputStream() << self->m_name << " keys_changed\n";
return FALSE;
}
-static gboolean notify( GtkWindow* window, gpointer dummy, WindowFocusPrinter* self ){
+static gboolean notify( ui::Window window, gpointer dummy, WindowFocusPrinter* self ){
if ( gtk_window_is_active( window ) ) {
globalOutputStream() << self->m_name << " takes toplevel focus\n";
}
public:
WindowFocusPrinter( const char* name ) : m_name( name ){
}
-void connect( GtkWindow* toplevel_window ){
+void connect( ui::Window toplevel_window ){
g_signal_connect( G_OBJECT( toplevel_window ), "notify::has_toplevel_focus", G_CALLBACK( notify ), this );
g_signal_connect( G_OBJECT( toplevel_window ), "notify::is_active", G_CALLBACK( notify ), this );
g_signal_connect( G_OBJECT( toplevel_window ), "keys_changed", G_CALLBACK( keys_changed ), this );
class MainWindowActive
{
-static gboolean notify( GtkWindow* window, gpointer dummy, MainWindowActive* self ){
- if ( g_wait.m_window != 0 && gtk_window_is_active( window ) && !GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
+static gboolean notify( ui::Window window, gpointer dummy, MainWindowActive* self ){
+ if ( g_wait.m_window && gtk_window_is_active( window ) && !GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
gtk_widget_show( GTK_WIDGET( g_wait.m_window ) );
}
return FALSE;
}
public:
-void connect( GtkWindow* toplevel_window ){
+void connect( ui::Window toplevel_window ){
g_signal_connect( G_OBJECT( toplevel_window ), "notify::is-active", G_CALLBACK( notify ), this );
}
};
// =============================================================================
// MainFrame class
-MainFrame* g_pParentWnd = 0;
+MainFrame* g_pParentWnd = nullptr;
-GtkWindow* MainFrame_getWindow(){
- if ( g_pParentWnd == 0 ) {
- return 0;
- }
- return g_pParentWnd->m_window;
+ui::Window MainFrame_getWindow()
+{
+ return g_pParentWnd ? g_pParentWnd->m_window : ui::Window();
}
-std::vector<GtkWidget*> g_floating_windows;
+std::vector<ui::Widget> g_floating_windows;
MainFrame::MainFrame() : m_window( 0 ), m_idleRedrawStatusText( RedrawStatusTextCaller( *this ) ){
m_pXYWnd = 0;
for ( int n = 0; n < c_count_status; n++ )
{
- m_pStatusLabel[n] = 0;
+ m_pStatusLabel[n] = ui::root;
}
m_bSleeping = false;
Shutdown();
- for ( std::vector<GtkWidget*>::iterator i = g_floating_windows.begin(); i != g_floating_windows.end(); ++i )
+ for ( std::vector<ui::Widget>::iterator i = g_floating_windows.begin(); i != g_floating_windows.end(); ++i )
{
gtk_widget_destroy( *i );
}
}
-GtkWindow* create_splash(){
- GtkWindow* window = GTK_WINDOW( gtk_window_new( GTK_WINDOW_TOPLEVEL ) );
+ui::Window create_splash(){
+ ui::Window window = ui::Window(GTK_WINDOW( gtk_window_new( GTK_WINDOW_TOPLEVEL ) ));
gtk_window_set_decorated( window, FALSE );
gtk_window_set_resizable( window, FALSE );
gtk_window_set_modal( window, TRUE );
return window;
}
-static GtkWindow *splash_screen = 0;
+static ui::Window splash_screen;
void show_splash(){
splash_screen = create_splash();
WindowPositionTracker g_posXZWnd;
WindowPositionTracker g_posYZWnd;
-static gint mainframe_delete( GtkWidget *widget, GdkEvent *event, gpointer data ){
+static gint mainframe_delete( ui::Widget widget, GdkEvent *event, gpointer data ){
if ( ConfirmModified( "Exit Radiant" ) ) {
gtk_main_quit();
}
}
void MainFrame::Create(){
- GtkWindow* window = GTK_WINDOW( gtk_window_new( GTK_WINDOW_TOPLEVEL ) );
+ ui::Window window = ui::Window(GTK_WINDOW( gtk_window_new( GTK_WINDOW_TOPLEVEL ) ));
GlobalWindowObservers_connectTopLevel( window );
g_MainWindowActive.connect( window );
- GetPlugInMgr().Init( GTK_WIDGET( window ) );
+ GetPlugInMgr().Init( window );
- GtkWidget* vbox = gtk_vbox_new( FALSE, 0 );
+ ui::Widget vbox = ui::Widget(gtk_vbox_new( FALSE, 0 ));
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
}
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( plugin_toolbar ), FALSE, FALSE, 0 );
- GtkWidget* main_statusbar = create_main_statusbar( m_pStatusLabel );
+ ui::Widget main_statusbar = create_main_statusbar( m_pStatusLabel );
gtk_box_pack_end( GTK_BOX( vbox ), main_statusbar, FALSE, TRUE, 2 );
GroupDialog_constructWindow( window );
if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft ) {
{
- GtkWidget* vsplit = gtk_vpaned_new();
+ ui::Widget vsplit = ui::Widget(gtk_vpaned_new());
m_vSplit = vsplit;
gtk_box_pack_start( GTK_BOX( vbox ), vsplit, TRUE, TRUE, 0 );
gtk_widget_show( vsplit );
// console
- GtkWidget* console_window = Console_constructWindow( window );
+ ui::Widget console_window = Console_constructWindow( window );
gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE );
{
- GtkWidget* hsplit = gtk_hpaned_new();
+ ui::Widget hsplit = ui::Widget(gtk_hpaned_new());
gtk_widget_show( hsplit );
m_hSplit = hsplit;
gtk_paned_add1( GTK_PANED( vsplit ), hsplit );
// xy
m_pXYWnd = new XYWnd();
m_pXYWnd->SetViewType( XY );
- GtkWidget* xy_window = GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) );
+ ui::Widget xy_window = ui::Widget(GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) ));
{
- GtkWidget* vsplit2 = gtk_vpaned_new();
+ ui::Widget vsplit2 = ui::Widget(gtk_vpaned_new());
gtk_widget_show( vsplit2 );
m_vSplit2 = vsplit2;
}
else if ( CurrentStyle() == eFloating ) {
{
- GtkWindow* window = create_persistent_floating_window( "Camera", m_window );
+ ui::Window window = ui::Window(create_persistent_floating_window( "Camera", m_window ));
global_accel_connect_window( window );
g_posCamWnd.connect( window );
}
CamWnd_setParent( *m_pCamWnd, window );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
- GtkWindow* window = create_persistent_floating_window( ViewType_getTitle( XY ), m_window );
+ ui::Window window = ui::Window(create_persistent_floating_window( ViewType_getTitle( XY ), m_window ));
global_accel_connect_window( window );
g_posXYWnd.connect( window );
}
XY_Top_Shown_Construct( window );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
- GtkWindow* window = create_persistent_floating_window( ViewType_getTitle( XZ ), m_window );
+ ui::Window window = ui::Window(create_persistent_floating_window( ViewType_getTitle( XZ ), m_window ));
global_accel_connect_window( window );
g_posXZWnd.connect( window );
XZ_Front_Shown_Construct( window );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
- GtkWindow* window = create_persistent_floating_window( ViewType_getTitle( YZ ), m_window );
+ ui::Window window = ui::Window(create_persistent_floating_window( ViewType_getTitle( YZ ), m_window ));
global_accel_connect_window( window );
g_posYZWnd.connect( window );
YZ_Side_Shown_Construct( window );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
- g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
+ g_page_textures = GroupDialog_addPage( "Textures", ui::Widget(GTK_WIDGET( frame )), TextureBrowserExportTitleCaller() );
}
GroupDialog_show();
GlobalCamera_setCamWnd( *m_pCamWnd );
CamWnd_setParent( *m_pCamWnd, window );
- GtkWidget* camera = CamWnd_getWidget( *m_pCamWnd );
+ ui::Widget camera = CamWnd_getWidget( *m_pCamWnd );
m_pYZWnd = new XYWnd();
m_pYZWnd->SetViewType( YZ );
- GtkWidget* yz = m_pYZWnd->GetWidget();
+ ui::Widget yz = m_pYZWnd->GetWidget();
m_pXYWnd = new XYWnd();
m_pXYWnd->SetViewType( XY );
- GtkWidget* xy = m_pXYWnd->GetWidget();
+ ui::Widget xy = m_pXYWnd->GetWidget();
m_pXZWnd = new XYWnd();
m_pXZWnd->SetViewType( XZ );
- GtkWidget* xz = m_pXZWnd->GetWidget();
+ ui::Widget xz = m_pXZWnd->GetWidget();
GtkHPaned* split = create_split_views( camera, yz, xy, xz );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( split ), TRUE, TRUE, 0 );
{
GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
- g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
+ g_page_textures = GroupDialog_addPage( "Textures", ui::Widget(GTK_WIDGET( frame )), TextureBrowserExportTitleCaller() );
}
}
#if !defined( INCLUDED_MAINFRAME_H )
#define INCLUDED_MAINFRAME_H
+#include <uilib/uilib.h>
#include "gtkutil/window.h"
#include "gtkutil/idledraw.h"
#include "gtkutil/widget.h"
class CamWnd;
class ZWnd;
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-
const int c_command_status = 0;
const int c_position_status = 1;
const int c_brushcount_status = 2;
MainFrame();
~MainFrame();
-GtkWindow* m_window;
+ui::Window m_window;
std::string m_command_status;
std::string m_position_status;
void SaveWindowInfo();
void Shutdown();
-GtkWidget* m_vSplit;
-GtkWidget* m_hSplit;
-GtkWidget* m_vSplit2;
+ui::Widget m_vSplit;
+ui::Widget m_hSplit;
+ui::Widget m_vSplit2;
XYWnd* m_pXYWnd;
XYWnd* m_pYZWnd;
bool m_bSleeping;
-GtkWidget *m_pStatusLabel[c_count_status];
+ui::Widget m_pStatusLabel[c_count_status];
EViewStyle m_nCurrentStyle;
extern MainFrame* g_pParentWnd;
-GtkWindow* MainFrame_getWindow();
+ui::Window MainFrame_getWindow();
enum EMouseButtonMode
{
MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
-extern GtkWidget* g_page_entity;
+extern ui::Widget g_page_entity;
#endif
#include <gtk/gtktreeview.h>
#include <gtk/gtkliststore.h>
#include <gtk/gtkcellrenderertext.h>
+#include "uilib/uilib.h"
#include "scenelib.h"
#include "transformlib.h"
GtkEntry* entities_entry;
GtkListStore* EntityBreakdownWalker;
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Map Info", G_CALLBACK( dialog_delete_callback ), &dialog );
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Map Info", G_CALLBACK(dialog_delete_callback ), &dialog );
window_set_position( window, g_posMapInfoWnd );
entities_entry = entry;
}
{
- GtkWidget* label = gtk_label_new( "Total Brushes" );
+ ui::Widget label = ui::Label( "Total Brushes" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkWidget* label = gtk_label_new( "Total Entities" );
+ ui::Widget label = ui::Label( "Total Entities" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
}
}
{
- GtkWidget* label = gtk_label_new( "Entity breakdown" );
+ ui::Widget label = ui::Label( "Entity breakdown" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, TRUE, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
{
GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE );
{
}
const char* map_open( const char* title ){
- return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, title, getMapsPath(), MapFormat::Name(), true, false, false );
+ return MainFrame_getWindow().file_dialog( TRUE, title, getMapsPath(), MapFormat::Name(), true, false, false );
}
const char* map_import( const char* title ){
- return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, title, getMapsPath(), MapFormat::Name(), false, true, false );
+ return MainFrame_getWindow().file_dialog( TRUE, title, getMapsPath(), MapFormat::Name(), false, true, false );
}
const char* map_save( const char* title ){
- return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, title, getMapsPath(), MapFormat::Name(), false, false, true );
+ return MainFrame_getWindow().file_dialog( FALSE, title, getMapsPath(), MapFormat::Name(), false, false, true );
}
void OpenMap(){
GtkEntry* entity;
GtkEntry* brush;
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Find Brush", G_CALLBACK( dialog_delete_callback ), &dialog );
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Find Brush", G_CALLBACK(dialog_delete_callback ), &dialog );
GtkAccelGroup* accel = gtk_accel_group_new();
gtk_window_add_accel_group( window, accel );
GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkWidget* label = gtk_label_new( "Entity number" );
+ ui::Widget label = ui::Label( "Entity number" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( "Brush number" );
+ ui::Widget label = ui::Label( "Brush number" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( 0 ),
LatchedBool g_Multimon_enableSysMenuPopups( false, "Floating windows sysmenu icons" );
void MultiMonitor_constructPreferences( PreferencesPage& page ){
- GtkWidget* primary_monitor = page.appendCheckBox( "Multi Monitor", "Start on Primary Monitor", g_multimon_globals.m_bStartOnPrimMon );
- GtkWidget* popup = page.appendCheckBox(
+ ui::CheckButton primary_monitor = page.appendCheckBox( "Multi Monitor", "Start on Primary Monitor", g_multimon_globals.m_bStartOnPrimMon );
+ ui::CheckButton popup = page.appendCheckBox(
"", "Disable system menu on popup windows",
LatchedBoolImportCaller( g_Multimon_enableSysMenuPopups ),
BoolExportCaller( g_Multimon_enableSysMenuPopups.m_latched )
class PatchInspector : public Dialog
{
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
Subdivisions m_subdivisions;
NonModalEntry m_horizontalSubdivisionsEntry;
NonModalEntry m_verticalSubdivisionsEntry;
PatchInspector g_PatchInspector;
-void PatchInspector_constructWindow( GtkWindow* main_window ){
+void PatchInspector_constructWindow( ui::Window main_window ){
g_PatchInspector.m_parent = main_window;
g_PatchInspector.Create();
}
// static functions
// memorize the current state (that is don't try to undo our do before changing something else)
-static void OnApply( GtkWidget *widget, gpointer data ){
+static void OnApply( ui::Widget widget, gpointer data ){
g_PatchInspector.exportData();
if ( g_PatchInspector.m_Patch != 0 ) {
UndoableCommand command( "patchSetTexture" );
}
}
-static void OnSelchangeComboColRow( GtkWidget *widget, gpointer data ){
+static void OnSelchangeComboColRow( ui::Widget widget, gpointer data ){
if ( !g_PatchInspector.m_bListenChanged ) {
return;
}
SceneChangeNotify();
}
-static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
Patch_CapTexture();
}
-static void OnBtnPatchfit( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchfit( ui::Widget widget, gpointer data ){
Patch_FitTexture();
}
-static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchnatural( ui::Widget widget, gpointer data ){
Patch_NaturalTexture();
}
-static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchreset( ui::Widget widget, gpointer data ){
Patch_ResetTexture();
}
-static void OnBtnPatchFlipX( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchFlipX( ui::Widget widget, gpointer data ){
Patch_FlipTextureX();
}
-static void OnBtnPatchFlipY( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchFlipY( ui::Widget widget, gpointer data ){
Patch_FlipTextureY();
}
Scene_forEachVisibleSelectedPatch( PatchTranslateTexture( s, t ) );
}
-static void OnBtnPatchAutoCap( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchAutoCap( ui::Widget widget, gpointer data ){
Patch_AutoCapTexture();
}
}
// update the point-by-point view
- OnSelchangeComboColRow( 0,0 );
+ OnSelchangeComboColRow( ui::root ,0 );
}
-static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ){
+static gint OnDialogKey( ui::Widget widget, GdkEventKey* event, gpointer data ){
if ( event->keyval == GDK_Return ) {
- OnApply( 0, 0 );
+ OnApply( ui::root, 0 );
return TRUE;
}
else if ( event->keyval == GDK_Escape ) {
// =============================================================================
// PatchInspector class
-GtkWindow* PatchInspector::BuildDialog(){
- GtkWindow* window = create_floating_window( "Patch Properties", m_parent );
+ui::Window PatchInspector::BuildDialog(){
+ ui::Window window = ui::Window(create_floating_window( "Patch Properties", m_parent ));
m_position_tracker.connect( window );
gtk_table_set_row_spacings( table, 5 );
gtk_table_set_col_spacings( table, 5 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Row:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Row:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Column:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Column:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
gtk_table_set_row_spacings( table, 5 );
gtk_table_set_col_spacings( table, 5 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "X:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "X:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Y:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Y:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Z:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Z:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "S:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "S:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 3, 4,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "T:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "T:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 4, 5,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
gtk_table_set_row_spacings( table, 5 );
gtk_table_set_col_spacings( table, 5 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Fixed" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Fixed" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
m_horizontalSubdivisionsEntry.connect( entry );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Vertical" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Name:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Name:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( label ), TRUE, TRUE, 0 );
gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
gtk_table_set_row_spacings( table, 5 );
gtk_table_set_col_spacings( table, 5 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal Shift Step" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal Shift Step" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 0, 1,
(GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical Shift Step" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Vertical Shift Step" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 1, 2,
(GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal Stretch Step" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal Stretch Step" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 2, 3,
(GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical Stretch Step" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Vertical Stretch Step" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 3, 4,
(GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Rotate Step" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Rotate Step" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 4, 5,
(GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_PATCHDIALOG_H )
#define INCLUDED_PATCHDIALOG_H
void PatchInspector_Construct();
void PatchInspector_Destroy();
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-void PatchInspector_constructWindow( GtkWindow* main_window );
+void PatchInspector_constructWindow( ui::Window main_window );
void PatchInspector_destroyWindow();
namespace scene
GtkComboBox* width;
GtkComboBox* height;
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Patch density", G_CALLBACK( dialog_delete_callback ), &dialog );
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Patch density", G_CALLBACK(dialog_delete_callback ), &dialog );
GtkAccelGroup* accel = gtk_accel_group_new();
gtk_window_add_accel_group( window, accel );
GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Width:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Width:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Height:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Height:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
- GtkWidget* bevel;
- GtkWidget* ibevel;
- GtkWidget* endcap;
- GtkWidget* iendcap;
- GtkWidget* cylinder;
+ ui::Widget bevel;
+ ui::Widget ibevel;
+ ui::Widget endcap;
+ ui::Widget iendcap;
+ ui::Widget cylinder;
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Cap", dialog );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window( "Cap", dialog );
GtkAccelGroup *accel_group = gtk_accel_group_new();
gtk_window_add_accel_group( window, accel_group );
GSList* group = 0;
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Bevel" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Bevel" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
bevel = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Endcap" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Endcap" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
endcap = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Bevel" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Bevel" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
ibevel = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Endcap" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Endcap" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
iendcap = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Cylinder" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Cylinder" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 4, 5,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
/*!
build directly from a SYN_PROVIDE interface
*/
-CPluginSlot( GtkWidget* main_window, const char* name, const _QERPluginTable& table );
+CPluginSlot( ui::Widget main_window, const char* name, const _QERPluginTable& table );
/*!
dispatching a command by name to the plugin
*/
};
-CPluginSlot::CPluginSlot( GtkWidget* main_window, const char* name, const _QERPluginTable& table ){
+CPluginSlot::CPluginSlot( ui::Widget main_window, const char* name, const _QERPluginTable& table ){
mpTable = &table;
m_menu_name = name;
public:
virtual ~CPluginSlots();
-void AddPluginSlot( GtkWidget* main_window, const char* name, const _QERPluginTable& table ){
+void AddPluginSlot( ui::Widget main_window, const char* name, const _QERPluginTable& table ){
mSlots.push_back( new CPluginSlot( main_window, name, table ) );
}
CPluginSlots g_plugin_slots;
-void FillPluginSlots( CPluginSlots& slots, GtkWidget* main_window ){
+void FillPluginSlots( CPluginSlots& slots, ui::Widget main_window ){
class AddPluginVisitor : public PluginModules::Visitor
{
CPluginSlots& m_slots;
- GtkWidget* m_main_window;
+ ui::Widget m_main_window;
public:
- AddPluginVisitor( CPluginSlots& slots, GtkWidget* main_window )
+ AddPluginVisitor( CPluginSlots& slots, ui::Widget main_window )
: m_slots( slots ), m_main_window( main_window ){
}
void visit( const char* name, const _QERPluginTable& table ) const {
g_plugin_slots.Dispatch( n, p );
}
-void CPlugInManager::Init( GtkWidget* main_window ){
+void CPlugInManager::Init( ui::Widget main_window ){
FillPluginSlots( g_plugin_slots, main_window );
}
#define INCLUDED_PLUGINMANAGER_H
#include <cstddef>
+#include <uilib/uilib.h>
-typedef struct _GtkWidget GtkWidget;
/*!
\class IPlugin
{
public:
void Dispatch( std::size_t n, const char *p );
-void Init( GtkWidget* main_window );
+void Init( ui::Widget main_window );
void constructMenu( PluginsVisitor& menu );
void Shutdown();
};
int m_nNextPlugInID = 0;
-void plugin_activated( GtkWidget* widget, gpointer data ){
+void plugin_activated( ui::Widget widget, gpointer data ){
const char* str = (const char*)g_object_get_data( G_OBJECT( widget ),"command" );
GetPlugInMgr().Dispatch( gpointer_to_int( data ), str );
}
#include <stack>
-typedef std::stack<GtkWidget*> WidgetStack;
+typedef std::stack<ui::Widget> WidgetStack;
void PlugInMenu_Add( GtkMenu* plugin_menu, IPlugIn* pPlugIn ){
- GtkWidget *menu, *item, *parent, *subMenu;
+ ui::Widget menu, item, parent, subMenu;
const char *menuText, *menuCommand;
WidgetStack menuStack;
- parent = gtk_menu_item_new_with_label( pPlugIn->getMenuName() );
+ parent = ui::Widget(gtk_menu_item_new_with_label( pPlugIn->getMenuName() ));
gtk_widget_show( parent );
gtk_container_add( GTK_CONTAINER( plugin_menu ), parent );
std::size_t nCount = pPlugIn->getCommandCount();
if ( nCount > 0 ) {
- menu = gtk_menu_new();
+ menu = ui::Widget(gtk_menu_new());
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( GTK_MENU( menu ) );
}
if ( menuText != 0 && strlen( menuText ) > 0 ) {
if ( !strcmp( menuText, "-" ) ) {
- item = gtk_menu_item_new();
+ item = ui::Widget(gtk_menu_item_new());
gtk_widget_set_sensitive( item, FALSE );
}
else if ( !strcmp( menuText, ">" ) ) {
continue;
}
- item = gtk_menu_item_new_with_label( menuText );
+ item = ui::Widget(gtk_menu_item_new_with_label( menuText ));
gtk_widget_show( item );
gtk_container_add( GTK_CONTAINER( menu ), item );
- subMenu = gtk_menu_new();
+ subMenu = ui::Widget(gtk_menu_new());
gtk_menu_item_set_submenu( GTK_MENU_ITEM( item ), subMenu );
menuStack.push( menu );
menu = subMenu;
}
else
{
- item = gtk_menu_item_new_with_label( menuText );
+ item = ui::Widget(gtk_menu_item_new_with_label( 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 ) );
}
gtk_toolbar_append_element( toolbar, gtktoolbarchildtype_for_toolbarbuttontype( type ), 0, text, tooltip, "", GTK_WIDGET( new_plugin_image( icon ) ), handler, data );
}
-void ActivateToolbarButton( GtkWidget *widget, gpointer data ){
+void ActivateToolbarButton( ui::Widget widget, gpointer data ){
const_cast<const IToolbarButton*>( reinterpret_cast<IToolbarButton*>( data ) )->activate();
}
page.appendCheckBox( "", "Default Text Editor", g_TextEditor_useWin32Editor );
#else
{
- GtkWidget* use_custom = page.appendCheckBox( "Text Editor", "Custom", g_TextEditor_useCustomEditor );
- GtkWidget* custom_editor = page.appendPathEntry( "Text Editor Command", g_TextEditor_editorCommand, true );
+ ui::CheckButton use_custom = page.appendCheckBox( "Text Editor", "Custom", g_TextEditor_useCustomEditor );
+ ui::Widget custom_editor = page.appendPathEntry( "Text Editor Command", g_TextEditor_editorCommand, true );
Widget_connectToggleDependency( custom_editor, use_custom );
}
#endif
*/
#include <map>
+#include <uilib/uilib.h>
inline const char* xmlAttr_getName( xmlAttrPtr attr ){
return reinterpret_cast<const char*>( attr->name );
page.appendCheckBox( "Startup", "Show Global Preferences", m_bGamePrompt );
}
-GtkWindow* CGameDialog::BuildDialog(){
+ui::Window CGameDialog::BuildDialog(){
GtkFrame* frame = create_dialog_frame( "Game settings", GTK_SHADOW_ETCHED_IN );
GtkVBox* vbox2 = create_dialog_vbox( 0, 4 );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
{
- PreferencesPage preferencesPage( *this, GTK_WIDGET( vbox2 ) );
+ PreferencesPage preferencesPage( *this, ui::Widget(GTK_WIDGET( vbox2 )) );
Global_constructPreferences( preferencesPage );
CreateGlobalFrame( preferencesPage );
}
- return create_simple_modal_dialog_window( "Global Preferences", m_modal, GTK_WIDGET( frame ) );
+ return ui::Window(create_simple_modal_dialog_window( "Global Preferences", m_modal, GTK_WIDGET( frame ) ));
}
class LoadGameFile
delete ( *iGame );
*iGame = 0;
}
- if ( GetWidget() != 0 ) {
+ if ( GetWidget() ) {
Destroy();
}
}
// =============================================================================
// Widget callbacks for PrefsDlg
-static void OnButtonClean( GtkWidget *widget, gpointer data ){
+static void OnButtonClean( ui::Widget widget, gpointer data ){
// make sure this is what the user wants
- if ( gtk_MessageBox( GTK_WIDGET( g_Preferences.GetWidget() ), "This will close Radiant and clean the corresponding registry entries.\n"
+ if ( ui::Widget(GTK_WIDGET( g_Preferences.GetWidget() )).alert( "This will close Radiant and clean the corresponding registry entries.\n"
"Next time you start Radiant it will be good as new. Do you wish to continue?",
- "Reset Registry", eMB_YESNO, eMB_ICONASTERISK ) == eIDYES ) {
+ "Reset Registry", ui::alert_type::YESNO, ui::alert_icon::ASTERISK ) == ui::alert_response::YES ) {
PrefsDlg *dlg = (PrefsDlg*)data;
dlg->EndModal( eIDCANCEL );
g_string_append( m_inipath, PREFS_LOCAL_FILENAME );
}
-void notebook_set_page( GtkWidget* notebook, GtkWidget* page ){
+void notebook_set_page( ui::Widget notebook, ui::Widget page ){
int pagenum = gtk_notebook_page_num( GTK_NOTEBOOK( notebook ), page );
if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( notebook ) ) != pagenum ) {
gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), pagenum );
}
}
-void PrefsDlg::showPrefPage( GtkWidget* prefpage ){
+void PrefsDlg::showPrefPage( ui::Widget prefpage ){
notebook_set_page( m_notebook, prefpage );
return;
}
GtkTreeModel* model;
GtkTreeIter selected;
if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) {
- GtkWidget* prefpage;
+ ui::Widget prefpage;
gtk_tree_model_get( model, &selected, 1, (gpointer*)&prefpage, -1 );
dlg->showPrefPage( prefpage );
}
PreferenceGroupCallbacks_pushBack( g_settingsCallbacks, callback );
}
-void Widget_updateDependency( GtkWidget* self, GtkWidget* toggleButton ){
+void Widget_updateDependency( ui::Widget self, ui::Widget toggleButton ){
gtk_widget_set_sensitive( self, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggleButton ) ) && GTK_WIDGET_IS_SENSITIVE( toggleButton ) );
}
-void ToggleButton_toggled_Widget_updateDependency( GtkWidget *toggleButton, GtkWidget* self ){
+void ToggleButton_toggled_Widget_updateDependency( ui::Widget toggleButton, ui::Widget self ){
Widget_updateDependency( self, toggleButton );
}
-void ToggleButton_state_changed_Widget_updateDependency( GtkWidget* toggleButton, GtkStateType state, GtkWidget* self ){
+void ToggleButton_state_changed_Widget_updateDependency( ui::Widget toggleButton, GtkStateType state, ui::Widget self ){
if ( state == GTK_STATE_INSENSITIVE ) {
Widget_updateDependency( self, toggleButton );
}
}
-void Widget_connectToggleDependency( GtkWidget* self, GtkWidget* toggleButton ){
+void Widget_connectToggleDependency( ui::Widget self, ui::Widget toggleButton ){
g_signal_connect( G_OBJECT( toggleButton ), "state_changed", G_CALLBACK( ToggleButton_state_changed_Widget_updateDependency ), self );
g_signal_connect( G_OBJECT( toggleButton ), "toggled", G_CALLBACK( ToggleButton_toggled_Widget_updateDependency ), self );
Widget_updateDependency( self, toggleButton );
}
-inline GtkWidget* getVBox( GtkWidget* page ){
- return gtk_bin_get_child( GTK_BIN( page ) );
+inline ui::Widget getVBox( ui::Widget page ){
+ return ui::Widget(gtk_bin_get_child( GTK_BIN( page ) ));
}
-GtkTreeIter PreferenceTree_appendPage( GtkTreeStore* store, GtkTreeIter* parent, const char* name, GtkWidget* page ){
+GtkTreeIter PreferenceTree_appendPage( GtkTreeStore* store, GtkTreeIter* parent, const char* name, ui::Widget page ){
GtkTreeIter group;
gtk_tree_store_append( store, &group, parent );
gtk_tree_store_set( store, &group, 0, name, 1, page, -1 );
return group;
}
-GtkWidget* PreferencePages_addPage( GtkWidget* notebook, const char* name ){
- GtkWidget* preflabel = gtk_label_new( name );
+ui::Widget PreferencePages_addPage( ui::Widget notebook, const char* name ){
+ ui::Widget preflabel = ui::Label( name );
gtk_widget_show( preflabel );
- GtkWidget* pageframe = gtk_frame_new( name );
+ ui::Widget pageframe = ui::Widget(gtk_frame_new( name ));
gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 4 );
gtk_widget_show( pageframe );
- GtkWidget* vbox = gtk_vbox_new( FALSE, 4 );
+ ui::Widget vbox = ui::Widget(gtk_vbox_new( FALSE, 4 ));
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 4 );
gtk_container_add( GTK_CONTAINER( pageframe ), vbox );
class PreferenceTreeGroup : public PreferenceGroup
{
Dialog& m_dialog;
-GtkWidget* m_notebook;
+ui::Widget m_notebook;
GtkTreeStore* m_store;
GtkTreeIter m_group;
public:
-PreferenceTreeGroup( Dialog& dialog, GtkWidget* notebook, GtkTreeStore* store, GtkTreeIter group ) :
+PreferenceTreeGroup( Dialog& dialog, ui::Widget notebook, GtkTreeStore* store, GtkTreeIter group ) :
m_dialog( dialog ),
m_notebook( notebook ),
m_store( store ),
m_group( group ){
}
PreferencesPage createPage( const char* treeName, const char* frameName ){
- GtkWidget* page = PreferencePages_addPage( m_notebook, frameName );
+ ui::Widget page = PreferencePages_addPage( m_notebook, frameName );
PreferenceTree_appendPage( m_store, &m_group, treeName, page );
return PreferencesPage( m_dialog, getVBox( page ) );
}
};
-GtkWindow* PrefsDlg::BuildDialog(){
+ui::Window PrefsDlg::BuildDialog(){
PreferencesDialog_addInterfacePreferences( FreeCaller1<PreferencesPage&, Interface_constructPreferences>() );
Mouse_registerPreferencesPage();
- GtkWindow* dialog = create_floating_window( "NetRadiant Preferences", m_parent );
+ ui::Window dialog = ui::Window(create_floating_window( "NetRadiant Preferences", m_parent ));
{
- GtkWidget* mainvbox = gtk_vbox_new( FALSE, 5 );
+ ui::Widget mainvbox = ui::Widget(gtk_vbox_new( FALSE, 5 ));
gtk_container_add( GTK_CONTAINER( dialog ), mainvbox );
gtk_container_set_border_width( GTK_CONTAINER( mainvbox ), 5 );
gtk_widget_show( mainvbox );
{
- GtkWidget* hbox = gtk_hbox_new( FALSE, 5 );
+ ui::Widget hbox = ui::Widget(gtk_hbox_new( FALSE, 5 ));
gtk_widget_show( hbox );
gtk_box_pack_end( GTK_BOX( mainvbox ), hbox, FALSE, TRUE, 0 );
}
{
- GtkWidget* hbox = gtk_hbox_new( FALSE, 5 );
+ ui::Widget hbox = ui::Widget(gtk_hbox_new( FALSE, 5 ));
gtk_box_pack_start( GTK_BOX( mainvbox ), hbox, TRUE, TRUE, 0 );
gtk_widget_show( hbox );
{
- GtkWidget* sc_win = gtk_scrolled_window_new( 0, 0 );
+ ui::Widget sc_win = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( sc_win ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
gtk_box_pack_start( GTK_BOX( hbox ), sc_win, FALSE, FALSE, 0 );
gtk_widget_show( sc_win );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( sc_win ), GTK_SHADOW_IN );
// prefs pages notebook
- m_notebook = gtk_notebook_new();
+ m_notebook = ui::Widget(gtk_notebook_new());
// hide the notebook tabs since its not supposed to look like a notebook
gtk_notebook_set_show_tabs( GTK_NOTEBOOK( m_notebook ), FALSE );
gtk_box_pack_start( GTK_BOX( hbox ), m_notebook, TRUE, TRUE, 0 );
{
GtkTreeStore* store = gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
{
PreferencePages_addPage( m_notebook, "Front Page" );
{
- GtkWidget* global = PreferencePages_addPage( m_notebook, "Global Preferences" );
+ ui::Widget global = PreferencePages_addPage( m_notebook, "Global Preferences" );
{
PreferencesPage preferencesPage( *this, getVBox( global ) );
Global_constructPreferences( preferencesPage );
}
GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Global", global );
{
- GtkWidget* game = PreferencePages_addPage( m_notebook, "Game" );
+ ui::Widget game = PreferencePages_addPage( m_notebook, "Game" );
PreferencesPage preferencesPage( *this, getVBox( game ) );
g_GamesDialog.CreateGlobalFrame( preferencesPage );
}
{
- GtkWidget* interfacePage = PreferencePages_addPage( m_notebook, "Interface Preferences" );
+ ui::Widget interfacePage = PreferencePages_addPage( m_notebook, "Interface Preferences" );
{
PreferencesPage preferencesPage( *this, getVBox( interfacePage ) );
PreferencesPageCallbacks_constructPage( g_interfacePreferences, preferencesPage );
}
{
- GtkWidget* display = PreferencePages_addPage( m_notebook, "Display Preferences" );
+ ui::Widget display = PreferencePages_addPage( m_notebook, "Display Preferences" );
{
PreferencesPage preferencesPage( *this, getVBox( display ) );
PreferencesPageCallbacks_constructPage( g_displayPreferences, preferencesPage );
}
{
- GtkWidget* settings = PreferencePages_addPage( m_notebook, "General Settings" );
+ ui::Widget settings = PreferencePages_addPage( m_notebook, "General Settings" );
{
PreferencesPage preferencesPage( *this, getVBox( settings ) );
PreferencesPageCallbacks_constructPage( g_settingsPreferences, preferencesPage );
PrefsDlg g_Preferences; // global prefs instance
-void PreferencesDialog_constructWindow( GtkWindow* main_window ){
+void PreferencesDialog_constructWindow( ui::Window main_window ){
g_Preferences.m_parent = main_window;
g_Preferences.Create();
}
{
message << ( *i ) << '\n';
}
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), message.c_str() );
+ MainFrame_getWindow().alert( message.c_str() );
g_restart_required.clear();
}
}
#include <list>
#include <map>
-void Widget_connectToggleDependency( GtkWidget* self, GtkWidget* toggleButton );
+void Widget_connectToggleDependency( ui::Widget self, ui::Widget toggleButton );
class PreferencesPage
{
Dialog& m_dialog;
-GtkWidget* m_vbox;
+ui::Widget m_vbox;
public:
-PreferencesPage( Dialog& dialog, GtkWidget* vbox ) : m_dialog( dialog ), m_vbox( vbox ){
+PreferencesPage( Dialog& dialog, ui::Widget vbox ) : m_dialog( dialog ), m_vbox( vbox ){
}
-GtkWidget* appendCheckBox( const char* name, const char* flag, bool& data ){
+ui::CheckButton appendCheckBox( const char* name, const char* flag, bool& data ){
return m_dialog.addCheckBox( m_vbox, name, flag, data );
}
-GtkWidget* appendCheckBox( const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback ){
+ui::CheckButton appendCheckBox( const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback ){
return m_dialog.addCheckBox( m_vbox, name, flag, importCallback, exportCallback );
}
void appendCombo( const char* name, StringArrayRange values, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
void appendRadioIcons( const char* name, int& data, StringArrayRange icons ){
m_dialog.addRadioIcons( m_vbox, name, data, icons );
}
-GtkWidget* appendEntry( const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
+ui::Widget appendEntry( const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
return m_dialog.addIntEntry( m_vbox, name, importCallback, exportCallback );
}
-GtkWidget* appendEntry( const char* name, int& data ){
+ui::Widget appendEntry( const char* name, int& data ){
return m_dialog.addEntry( m_vbox, name, data );
}
-GtkWidget* appendEntry( const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback ){
+ui::Widget appendEntry( const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback ){
return m_dialog.addSizeEntry( m_vbox, name, importCallback, exportCallback );
}
-GtkWidget* appendEntry( const char* name, std::size_t& data ){
+ui::Widget appendEntry( const char* name, std::size_t& data ){
return m_dialog.addEntry( m_vbox, name, data );
}
-GtkWidget* appendEntry( const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
+ui::Widget appendEntry( const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
return m_dialog.addFloatEntry( m_vbox, name, importCallback, exportCallback );
}
-GtkWidget* appendEntry( const char* name, float& data ){
+ui::Widget appendEntry( const char* name, float& data ){
return m_dialog.addEntry( m_vbox, name, data );
}
-GtkWidget* appendPathEntry( const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback ){
+ui::Widget appendPathEntry( const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback ){
return m_dialog.addPathEntry( m_vbox, name, browse_directory, importCallback, exportCallback );
}
-GtkWidget* appendPathEntry( const char* name, std::string& data, bool directory ){
+ui::Widget appendPathEntry( const char* name, std::string& data, bool directory ){
return m_dialog.addPathEntry( m_vbox, name, data, directory );
}
-GtkWidget* appendSpinner( const char* name, int& data, double value, double lower, double upper ){
+ui::SpinButton appendSpinner( const char* name, int& data, double value, double lower, double upper ){
return m_dialog.addSpinner( m_vbox, name, data, value, lower, upper );
}
-GtkWidget* appendSpinner( const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
+ui::SpinButton appendSpinner( const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
return m_dialog.addSpinner( m_vbox, name, value, lower, upper, importCallback, exportCallback );
}
-GtkWidget* appendSpinner( const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
+ui::SpinButton appendSpinner( const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
return m_dialog.addSpinner( m_vbox, name, value, lower, upper, importCallback, exportCallback );
}
};
extern CGameDescription *g_pGameDescription;
-typedef struct _GtkWidget GtkWidget;
class PrefsDlg;
class PreferencesPage;
Dialog API
this is only called when the dialog is built at startup for main engine select
*/
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
void GameFileImport( int value );
void GameFileExport( const IntImportCallback& importCallback ) const;
public:
-GtkWidget *m_notebook;
+ui::Widget m_notebook;
virtual ~PrefsDlg(){
g_string_free( m_rc_path, true );
void Init();
/*! Utility function for swapping notebook pages for tree list selections */
-void showPrefPage( GtkWidget* prefpage );
+void showPrefPage( ui::Widget prefpage );
protected:
/*! Dialog API */
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
void PostModal( EMessageBoxReturn code );
};
};
extern preferences_globals_t g_preferences_globals;
-typedef struct _GtkWindow GtkWindow;
-void PreferencesDialog_constructWindow( GtkWindow* main_window );
+void PreferencesDialog_constructWindow( ui::Window main_window );
void PreferencesDialog_destroyWindow();
void PreferencesDialog_showDialog();
#include <map>
#include <gtk/gtktearoffmenuitem.h>
+#include <uilib/uilib.h>
#include "stream/textfilestream.h"
#include "cmdlib.h"
return true;
}
- EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "The current map has changed since it was last saved.\nDo you want to save the current map before continuing?", title, eMB_YESNOCANCEL, eMB_ICONQUESTION );
- if ( result == eIDCANCEL ) {
+ auto result = MainFrame_getWindow().alert( "The current map has changed since it was last saved.\nDo you want to save the current map before continuing?", title, ui::alert_type::YESNOCANCEL, ui::alert_icon::QUESTION );
+ if ( result == ui::alert_response::CANCEL ) {
return false;
}
- if ( result == eIDYES ) {
+ if ( result == ui::alert_response::YES ) {
if ( Map_Unnamed( g_map ) ) {
return Map_SaveAs();
}
title << " *";
}
- gtk_window_set_title( MainFrame_getWindow(), title.c_str() );
+ gtk_window_set_title(MainFrame_getWindow(), title.c_str() );
}
bool g_bWaitCursor = false;
GtkSpinButton* x;
GtkSpinButton* y;
GtkSpinButton* z;
- GtkWindow *window;
+ ui::Window window;
};
-static gboolean rotatedlg_apply( GtkWidget *widget, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_apply( ui::Widget widget, RotateDialog* rotateDialog ){
Vector3 eulerXYZ;
eulerXYZ[0] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->x ) );
return TRUE;
}
-static gboolean rotatedlg_cancel( GtkWidget *widget, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_cancel( ui::Widget widget, RotateDialog* rotateDialog ){
gtk_widget_hide( GTK_WIDGET( rotateDialog->window ) );
gtk_spin_button_set_value( rotateDialog->x, 0.0f ); // reset to 0 on close
return TRUE;
}
-static gboolean rotatedlg_ok( GtkWidget *widget, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_ok( ui::Widget widget, RotateDialog* rotateDialog ){
rotatedlg_apply( widget, rotateDialog );
gtk_widget_hide( GTK_WIDGET( rotateDialog->window ) );
return TRUE;
}
-static gboolean rotatedlg_delete( GtkWidget *widget, GdkEventAny *event, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_delete( ui::Widget widget, GdkEventAny *event, RotateDialog* rotateDialog ){
rotatedlg_cancel( widget, rotateDialog );
return TRUE;
}
RotateDialog g_rotate_dialog;
void DoRotateDlg(){
- if ( g_rotate_dialog.window == NULL ) {
- g_rotate_dialog.window = create_dialog_window( MainFrame_getWindow(), "Arbitrary rotation", G_CALLBACK( rotatedlg_delete ), &g_rotate_dialog );
+ 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 = gtk_accel_group_new();
gtk_window_add_accel_group( g_rotate_dialog.window, accel );
GtkTable* table = create_dialog_table( 3, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkWidget* label = gtk_label_new( " X " );
+ ui::Widget label = ui::Label( " X " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 0, 1,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( " Y " );
+ ui::Widget label = ui::Label( " Y " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 1, 2,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( " Z " );
+ ui::Widget label = ui::Label( " Z " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 2, 3,
(GtkAttachOptions) ( 0 ),
struct ScaleDialog
{
- GtkWidget* x;
- GtkWidget* y;
- GtkWidget* z;
- GtkWindow *window;
+ ui::Widget x;
+ ui::Widget y;
+ ui::Widget z;
+ ui::Window window;
};
-static gboolean scaledlg_apply( GtkWidget *widget, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_apply( ui::Widget widget, ScaleDialog* scaleDialog ){
float sx, sy, sz;
sx = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( scaleDialog->x ) ) ) );
return TRUE;
}
-static gboolean scaledlg_cancel( GtkWidget *widget, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_cancel( ui::Widget widget, ScaleDialog* scaleDialog ){
gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) );
gtk_entry_set_text( GTK_ENTRY( scaleDialog->x ), "1.0" );
return TRUE;
}
-static gboolean scaledlg_ok( GtkWidget *widget, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_ok( ui::Widget widget, ScaleDialog* scaleDialog ){
scaledlg_apply( widget, scaleDialog );
gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) );
return TRUE;
}
-static gboolean scaledlg_delete( GtkWidget *widget, GdkEventAny *event, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_delete( ui::Widget widget, GdkEventAny *event, ScaleDialog* scaleDialog ){
scaledlg_cancel( widget, scaleDialog );
return TRUE;
}
ScaleDialog g_scale_dialog;
void DoScaleDlg(){
- if ( g_scale_dialog.window == NULL ) {
- g_scale_dialog.window = create_dialog_window( MainFrame_getWindow(), "Arbitrary scale", G_CALLBACK( scaledlg_delete ), &g_scale_dialog );
+ 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 = gtk_accel_group_new();
gtk_window_add_accel_group( g_scale_dialog.window, accel );
GtkTable* table = create_dialog_table( 3, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkWidget* label = gtk_label_new( " X " );
+ ui::Widget label = ui::Label( " X " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 0, 1,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( " Y " );
+ ui::Widget label = ui::Label( " Y " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 1, 2,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( " Z " );
+ ui::Widget label = ui::Label( " Z " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 2, 3,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* entry = gtk_entry_new();
+ ui::Widget entry = ui::Widget(gtk_entry_new());
gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
gtk_widget_show( entry );
gtk_table_attach( table, entry, 1, 2, 0, 1,
g_scale_dialog.x = entry;
}
{
- GtkWidget* entry = gtk_entry_new();
+ ui::Widget entry = ui::Widget(gtk_entry_new());
gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
gtk_widget_show( entry );
gtk_table_attach( table, entry, 1, 2, 1, 2,
g_scale_dialog.y = entry;
}
{
- GtkWidget* entry = gtk_entry_new();
+ ui::Widget entry = ui::Widget(gtk_entry_new());
gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
gtk_widget_show( entry );
gtk_table_attach( table, entry, 1, 2, 2, 3,
{
//Shamus: Textool function prototypes
-gboolean size_allocate( GtkWidget *, GtkAllocation *, gpointer );
-gboolean expose( GtkWidget *, GdkEventExpose *, gpointer );
-gboolean button_press( GtkWidget *, GdkEventButton *, gpointer );
-gboolean button_release( GtkWidget *, GdkEventButton *, gpointer );
-gboolean motion( GtkWidget *, GdkEventMotion *, gpointer );
+gboolean size_allocate( ui::Widget, GtkAllocation *, gpointer );
+gboolean expose( ui::Widget, GdkEventExpose *, gpointer );
+gboolean button_press( ui::Widget, GdkEventButton *, gpointer );
+gboolean button_release( ui::Widget, GdkEventButton *, gpointer );
+gboolean motion( ui::Widget, GdkEventMotion *, gpointer );
void flipX( GtkToggleButton *, gpointer );
void flipY( GtkToggleButton *, gpointer );
//End Textool function prototypes
//Shamus: Textool globals
-GtkWidget * g_textoolWin;
+ui::Widget g_textoolWin;
//End Textool globals
void queueDraw(){
class SurfaceInspector : public Dialog
{
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
NonModalEntry m_textureEntry;
NonModalSpinner m_hshiftSpinner;
m_positionTracker.setPosition( c_default_window_pos );
}
-void constructWindow( GtkWindow* main_window ){
+void constructWindow( ui::Window main_window ){
m_parent = main_window;
Create();
AddGridChangeCallback( FreeCaller<SurfaceInspector_GridChange>() );
Destroy();
}
bool visible() const {
- return GTK_WIDGET_VISIBLE( const_cast<GtkWindow*>( GetWidget() ) );
+ return GTK_WIDGET_VISIBLE( GetWidget() );
}
void queueDraw(){
if ( visible() ) {
}
}
-void SurfaceInspector_constructWindow( GtkWindow* main_window ){
+void SurfaceInspector_constructWindow( ui::Window main_window ){
getSurfaceInspector().constructWindow( main_window );
}
void SurfaceInspector_destroyWindow(){
// we move the textures in pixels, not world units. (i.e. increment values are in pixel)
// depending on the texture scale it doesn't take the same amount of pixels to move of GetGridSize()
// increment * scale = gridsize
-static void OnBtnMatchGrid( GtkWidget *widget, gpointer data ){
+static void OnBtnMatchGrid( ui::Widget widget, gpointer data ){
float hscale, vscale;
hscale = static_cast<float>( gtk_spin_button_get_value_as_float( getSurfaceInspector().m_hscaleIncrement.m_spin ) );
vscale = static_cast<float>( gtk_spin_button_get_value_as_float( getSurfaceInspector().m_vscaleIncrement.m_spin ) );
// or update it because something new has been selected
// Shamus: It does get called when the SI is hidden, but not when you select something new. ;-)
void DoSurface( void ){
- if ( getSurfaceInspector().GetWidget() == 0 ) {
+ if ( !getSurfaceInspector().GetWidget() ) {
getSurfaceInspector().Create();
}
Select_FitTexture( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical );
}
-static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
Patch_CapTexture();
}
-static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchnatural( ui::Widget widget, gpointer data ){
Patch_NaturalTexture();
}
-static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchreset( ui::Widget widget, gpointer data ){
Patch_ResetTexture();
}
-static void OnBtnPatchFit( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchFit( ui::Widget widget, gpointer data ){
Patch_FitTexture();
}
-static void OnBtnAxial( GtkWidget *widget, gpointer data ){
+static void OnBtnAxial( ui::Widget widget, gpointer data ){
//globalOutputStream() << "--> [OnBtnAxial]...\n";
UndoableCommand undo( "textureDefault" );
TextureProjection projection;
Select_SetTexdef( projection );
}
-static void OnBtnFaceFit( GtkWidget *widget, gpointer data ){
+static void OnBtnFaceFit( ui::Widget widget, gpointer data ){
getSurfaceInspector().exportData();
SurfaceInspector_FitTexture();
}
return g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
}
-GtkWindow* SurfaceInspector::BuildDialog(){
- GtkWindow* window = create_floating_window( "Surface Inspector", m_parent );
+ui::Window SurfaceInspector::BuildDialog(){
+ ui::Window window = ui::Window(create_floating_window( "Surface Inspector", m_parent ));
m_positionTracker.connect( window );
{
// replaced by only the vbox:
- GtkWidget* vbox = gtk_vbox_new( FALSE, 5 );
+ ui::Widget vbox = ui::Widget(gtk_vbox_new( FALSE, 5 ));
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
{
- GtkWidget* hbox2 = gtk_hbox_new( FALSE, 5 );
+ ui::Widget hbox2 = ui::Widget(gtk_hbox_new( FALSE, 5 ));
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 );
{
- GtkWidget* label = gtk_label_new( "Texture" );
+ ui::Widget label = ui::Label( "Texture" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
}
{
- GtkWidget* table = gtk_table_new( 6, 4, FALSE );
+ ui::Widget table = ui::Widget(gtk_table_new( 6, 4, FALSE ));
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), FALSE, FALSE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
{
- GtkWidget* label = gtk_label_new( "Horizontal shift" );
+ ui::Widget label = ui::Label( "Horizontal shift" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
}
{
- GtkWidget* label = gtk_label_new( "Step" );
+ ui::Widget label = ui::Label( "Step" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
m_hshiftEntry.connect( entry );
}
{
- GtkWidget* label = gtk_label_new( "Vertical shift" );
+ ui::Widget label = ui::Label( "Vertical shift" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
}
{
- GtkWidget* label = gtk_label_new( "Step" );
+ ui::Widget label = ui::Label( "Step" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
m_vshiftEntry.connect( entry );
}
{
- GtkWidget* label = gtk_label_new( "Horizontal stretch" );
+ ui::Widget label = ui::Label( "Horizontal stretch" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
}
{
- GtkWidget* label = gtk_label_new( "Step" );
+ ui::Widget label = ui::Label( "Step" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
m_hscaleEntry.connect( entry );
}
{
- GtkWidget* label = gtk_label_new( "Vertical stretch" );
+ ui::Widget label = ui::Label( "Vertical stretch" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4,
gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
}
{
- GtkWidget* label = gtk_label_new( "Step" );
+ ui::Widget label = ui::Label( "Step" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4,
m_vscaleEntry.connect( entry );
}
{
- GtkWidget* label = gtk_label_new( "Rotate" );
+ ui::Widget label = ui::Label( "Rotate" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5,
gtk_spin_button_set_wrap( spin, TRUE );
}
{
- GtkWidget* label = gtk_label_new( "Step" );
+ ui::Widget label = ui::Label( "Step" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5,
}
{
// match grid button
- GtkWidget* button = gtk_button_new_with_label( "Match Grid" );
+ ui::Widget button = ui::Widget(gtk_button_new_with_label( "Match Grid" ));
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
}
{
- GtkWidget* frame = gtk_frame_new( "Texturing" );
+ ui::Widget frame = ui::Widget(gtk_frame_new( "Texturing" ));
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
{
- GtkWidget* table = gtk_table_new( 4, 4, FALSE );
+ ui::Widget table = ui::Widget(gtk_table_new( 4, 4, FALSE ));
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
{
- GtkWidget* label = gtk_label_new( "Brush" );
+ ui::Widget label = ui::Label( "Brush" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( "Patch" );
+ ui::Widget label = ui::Label( "Patch" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( "Width" );
+ ui::Widget label = ui::Label( "Width" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( "Height" );
+ ui::Widget label = ui::Label( "Height" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* button = gtk_button_new_with_label( "Axial" );
+ ui::Widget button = ui::Widget(gtk_button_new_with_label( "Axial" ));
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- GtkWidget* button = gtk_button_new_with_label( "Fit" );
+ ui::Widget button = ui::Widget(gtk_button_new_with_label( "Fit" ));
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- GtkWidget* button = gtk_button_new_with_label( "CAP" );
+ ui::Widget button = ui::Widget(gtk_button_new_with_label( "CAP" ));
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- GtkWidget* button = gtk_button_new_with_label( "Set..." );
+ ui::Widget button = ui::Widget(gtk_button_new_with_label( "Set..." ));
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- GtkWidget* button = gtk_button_new_with_label( "Natural" );
+ ui::Widget button = ui::Widget(gtk_button_new_with_label( "Natural" ));
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- GtkWidget* button = gtk_button_new_with_label( "Fit" );
+ ui::Widget button = ui::Widget(gtk_button_new_with_label( "Fit" ));
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 );
+ ui::Widget spin = ui::Widget(gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 ));
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
}
{
- GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 );
+ ui::Widget spin = ui::Widget(gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 ));
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
#if TEXTOOL_ENABLED
if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_BRUSHPRIMITIVES ) {
// Shamus: Textool goodies...
- GtkWidget * frame = gtk_frame_new( "Textool" );
+ ui::Widget frame = gtk_frame_new( "Textool" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
{
g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "motion_notify_event", G_CALLBACK( TexTool::motion ), NULL );
}
{
- GtkWidget * hbox = gtk_hbox_new( FALSE, 5 );
+ ui::Widget hbox = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, FALSE, 0 );
// Checkboxes go here... (Flip X/Y)
- GtkWidget * flipX = gtk_check_button_new_with_label( "Flip X axis" );
- GtkWidget * flipY = gtk_check_button_new_with_label( "Flip Y axis" );
+ ui::Widget flipX = gtk_check_button_new_with_label( "Flip X axis" );
+ ui::Widget flipY = gtk_check_button_new_with_label( "Flip Y axis" );
gtk_widget_show( flipX );
gtk_widget_show( flipY );
gtk_box_pack_start( GTK_BOX( hbox ), flipX, FALSE, FALSE, 0 );
// << extents.maxX << ", " << extents.minY << ", " << extents.maxY << "\n";
}
-gboolean size_allocate( GtkWidget * win, GtkAllocation * a, gpointer ){
+gboolean size_allocate( ui::Widget win, GtkAllocation * a, gpointer ){
windowSize.x() = a->width;
windowSize.y() = a->height;
queueDraw();
return false;
}
-gboolean expose( GtkWidget * win, GdkEventExpose * e, gpointer ){
+gboolean expose( ui::Widget win, GdkEventExpose * e, gpointer ){
// globalOutputStream() << "--> Textool Window was exposed!\n";
// globalOutputStream() << " (window width/height: " << cc << "/" << e->area.height << ")\n";
Vector2 trans2;
Vector2 dragPoint; // Defined in terms of window space (+x/-y)
Vector2 oldTrans;
-gboolean button_press( GtkWidget * win, GdkEventButton * e, gpointer ){
+gboolean button_press( ui::Widget win, GdkEventButton * e, gpointer ){
// globalOutputStream() << "--> Textool button press...\n";
if ( e->button == 1 ) {
return false;
}
-gboolean button_release( GtkWidget * win, GdkEventButton * e, gpointer ){
+gboolean button_release( ui::Widget win, GdkEventButton * e, gpointer ){
// globalOutputStream() << "--> Textool button release...\n";
if ( e->button == 1 ) {
c[1] = ((float)(y))/((float)(m_rect.bottom-m_rect.top))*(m_Maxs[1]-m_Mins[1])+m_Mins[1];
}
*/
-gboolean motion( GtkWidget * win, GdkEventMotion * e, gpointer ){
+gboolean motion( ui::Widget win, GdkEventMotion * e, gpointer ){
// globalOutputStream() << "--> Textool motion...\n";
if ( lButtonDown ) {
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_SURFACEDIALOG_H )
#define INCLUDED_SURFACEDIALOG_H
void SurfaceInspector_Construct();
void SurfaceInspector_Destroy();
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-void SurfaceInspector_constructWindow( GtkWindow* widget );
+void SurfaceInspector_constructWindow( ui::Window widget );
void SurfaceInspector_destroyWindow();
bool SelectedFaces_empty();
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkvscrollbar.h>
+#include <uilib/uilib.h>
#include "signal/signal.h"
#include "math/vector.h"
std::string shader;
-GtkWindow* m_parent;
-GtkWidget* m_gl_widget;
-GtkWidget* m_texture_scroll;
-GtkWidget* m_treeViewTree;
-GtkWidget* m_treeViewTags;
-GtkWidget* m_tag_frame;
+ui::Window m_parent;
+ui::Widget m_gl_widget;
+ui::Widget m_texture_scroll;
+ui::Widget m_treeViewTree;
+ui::Widget m_treeViewTags;
+ui::Widget m_tag_frame;
GtkListStore* m_assigned_store;
GtkListStore* m_available_store;
-GtkWidget* m_assigned_tree;
-GtkWidget* m_available_tree;
-GtkWidget* m_scr_win_tree;
-GtkWidget* m_scr_win_tags;
-GtkWidget* m_tag_notebook;
-GtkWidget* m_search_button;
-GtkWidget* m_shader_info_item;
+ui::Widget m_assigned_tree;
+ui::Widget m_available_tree;
+ui::Widget m_scr_win_tree;
+ui::Widget m_scr_win_tags;
+ui::Widget m_tag_notebook;
+ui::Widget m_search_button;
+ui::Widget m_shader_info_item;
std::set<std::string> m_all_tags;
GtkListStore* m_all_tags_list;
void TextureBrowser_SetHideUnused( TextureBrowser& textureBrowser, bool hideUnused );
-GtkWidget* g_page_textures;
+ui::Widget g_page_textures;
void TextureBrowser_toggleShow(){
GroupDialog_showPage( g_page_textures );
}
}
-gboolean TextureBrowser_button_press( GtkWidget* widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_button_press( ui::Widget widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
if ( event->type == GDK_BUTTON_PRESS ) {
if ( event->button == 3 ) {
if ( GlobalTextureBrowser().m_tags ) {
return FALSE;
}
-gboolean TextureBrowser_button_release( GtkWidget* widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_button_release( ui::Widget widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
if ( event->type == GDK_BUTTON_RELEASE ) {
if ( event->button == 3 ) {
if ( !GlobalTextureBrowser().m_tags ) {
return FALSE;
}
-gboolean TextureBrowser_motion( GtkWidget *widget, GdkEventMotion *event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_motion( ui::Widget widget, GdkEventMotion *event, TextureBrowser* textureBrowser ){
return FALSE;
}
-gboolean TextureBrowser_scroll( GtkWidget* widget, GdkEventScroll* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_scroll( ui::Widget widget, GdkEventScroll* event, TextureBrowser* textureBrowser ){
if ( event->direction == GDK_SCROLL_UP ) {
TextureBrowser_MouseWheel( *textureBrowser, true );
}
}
}
-gboolean TextureBrowser_size_allocate( GtkWidget* widget, GtkAllocation* allocation, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_size_allocate( ui::Widget widget, GtkAllocation* allocation, TextureBrowser* textureBrowser ){
textureBrowser->width = allocation->width;
textureBrowser->height = allocation->height;
TextureBrowser_heightChanged( *textureBrowser );
return FALSE;
}
-gboolean TextureBrowser_expose( GtkWidget* widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_expose( ui::Widget widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){
if ( glwidget_make_current( textureBrowser->m_gl_widget ) != FALSE ) {
GlobalOpenGL_debugAssertNoErrors();
TextureBrowser_evaluateHeight( *textureBrowser );
void TextureBrowser_createTreeViewTree(){
GtkCellRenderer* renderer;
- g_TextureBrowser.m_treeViewTree = GTK_WIDGET( gtk_tree_view_new() );
+ g_TextureBrowser.m_treeViewTree = ui::Widget(GTK_WIDGET( gtk_tree_view_new() ));
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
void TextureBrowser_renameTag();
void TextureBrowser_deleteTag();
-void TextureBrowser_createContextMenu( GtkWidget *treeview, GdkEventButton *event ){
- GtkWidget* menu = gtk_menu_new();
+void TextureBrowser_createContextMenu( ui::Widget treeview, GdkEventButton *event ){
+ ui::Widget menu = ui::Widget(gtk_menu_new());
- GtkWidget* menuitem = gtk_menu_item_new_with_label( "Add tag" );
+ ui::Widget menuitem = ui::Widget(gtk_menu_item_new_with_label( "Add tag" ));
g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_addTag, treeview );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
- menuitem = gtk_menu_item_new_with_label( "Rename tag" );
+ menuitem = ui::Widget(gtk_menu_item_new_with_label( "Rename tag" ));
g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_renameTag, treeview );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
- menuitem = gtk_menu_item_new_with_label( "Delete tag" );
+ menuitem = ui::Widget(gtk_menu_item_new_with_label( "Delete tag" ));
g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_deleteTag, treeview );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
gdk_event_get_time( (GdkEvent*)event ) );
}
-gboolean TreeViewTags_onButtonPressed( GtkWidget *treeview, GdkEventButton *event ){
+gboolean TreeViewTags_onButtonPressed( ui::Widget treeview, GdkEventButton *event ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
GtkTreePath *path;
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( treeview ) );
void TextureBrowser_createTreeViewTags(){
GtkCellRenderer* renderer;
- g_TextureBrowser.m_treeViewTags = GTK_WIDGET( gtk_tree_view_new() );
+ g_TextureBrowser.m_treeViewTags = ui::Widget(GTK_WIDGET( gtk_tree_view_new() ));
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE );
g_signal_connect( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), "button-press-event", (GCallback)TreeViewTags_onButtonPressed, NULL );
TextureBrowser_constructTreeStoreTags();
}
-GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){
- GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "_View" );
+ui::MenuItem TextureBrowser_constructViewMenu( GtkMenu* menu ){
+ ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_View" ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
if ( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
menu_separator( menu );
- g_TextureBrowser.m_shader_info_item = GTK_WIDGET( create_menu_item_with_mnemonic( menu, "Shader Info", "ShaderInfo" ) );
+ g_TextureBrowser.m_shader_info_item = ui::Widget(GTK_WIDGET( create_menu_item_with_mnemonic( menu, "Shader Info", "ShaderInfo" ) ));
gtk_widget_set_sensitive( g_TextureBrowser.m_shader_info_item, FALSE );
}
return textures_menu_item;
}
-GtkMenuItem* TextureBrowser_constructToolsMenu( GtkMenu* menu ){
- GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "_Tools" );
+ui::MenuItem TextureBrowser_constructToolsMenu( GtkMenu* menu ){
+ ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_Tools" ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
return textures_menu_item;
}
-GtkMenuItem* TextureBrowser_constructTagsMenu( GtkMenu* menu ){
- GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "T_ags" );
+ui::MenuItem TextureBrowser_constructTagsMenu( GtkMenu* menu ){
+ ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "T_ags" ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
}
void TextureBrowser_constructTagNotebook(){
- g_TextureBrowser.m_tag_notebook = gtk_notebook_new();
- GtkWidget* labelTags = gtk_label_new( "Tags" );
- GtkWidget* labelTextures = gtk_label_new( "Textures" );
+ g_TextureBrowser.m_tag_notebook = ui::Widget(gtk_notebook_new());
+ ui::Widget labelTags = ui::Label( "Tags" );
+ ui::Widget labelTextures = ui::Label( "Textures" );
gtk_notebook_append_page( GTK_NOTEBOOK( g_TextureBrowser.m_tag_notebook ), g_TextureBrowser.m_scr_win_tree, labelTextures );
gtk_notebook_append_page( GTK_NOTEBOOK( g_TextureBrowser.m_tag_notebook ), g_TextureBrowser.m_scr_win_tags, labelTags );
void TextureBrowser_constructSearchButton(){
GtkTooltips* tooltips = gtk_tooltips_new();
- GtkWidget* image = gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR );
- g_TextureBrowser.m_search_button = gtk_button_new();
+ ui::Widget image = ui::Widget(gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR ));
+ g_TextureBrowser.m_search_button = ui::Widget(gtk_button_new());
g_signal_connect( G_OBJECT( g_TextureBrowser.m_search_button ), "clicked", G_CALLBACK( TextureBrowser_searchTags ), NULL );
gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), g_TextureBrowser.m_search_button, "Search with selected tags", "Search with selected tags" );
gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_search_button ), image );
g_shadernotex = name.c_str();
}
-GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
+ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){
// The gl_widget and the tag assignment frame should be packed into a GtkVPaned with the slider
// position stored in local.pref. gtk_paned_get_position() and gtk_paned_set_position() don't
// seem to work in gtk 2.4 and the arrow buttons don't handle GTK_FILL, so here's another thing
g_TextureBrowser.m_parent = toplevel;
- GtkWidget* table = gtk_table_new( 3, 3, FALSE );
- GtkWidget* frame_table = NULL;
- GtkWidget* vbox = gtk_vbox_new( FALSE, 0 );
+ ui::Widget table = ui::Widget(gtk_table_new( 3, 3, FALSE ));
+ ui::Widget frame_table;
+ ui::Widget vbox = ui::Widget(gtk_vbox_new( FALSE, 0 ));
gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
gtk_widget_show( vbox );
- GtkWidget* menu_bar;
+ ui::Widget menu_bar;
{ // menu bar
- menu_bar = gtk_menu_bar_new();
- GtkWidget* menu_view = gtk_menu_new();
- GtkWidget* view_item = (GtkWidget*)TextureBrowser_constructViewMenu( GTK_MENU( menu_view ) );
+ menu_bar = ui::Widget(gtk_menu_bar_new());
+ ui::Widget menu_view = ui::Widget(gtk_menu_new());
+ auto view_item = TextureBrowser_constructViewMenu( GTK_MENU( menu_view ) );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view );
gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), view_item );
- GtkWidget* menu_tools = gtk_menu_new();
- GtkWidget* tools_item = (GtkWidget*)TextureBrowser_constructToolsMenu( GTK_MENU( menu_tools ) );
+ ui::Widget menu_tools = ui::Widget(gtk_menu_new());
+ auto tools_item = TextureBrowser_constructToolsMenu( GTK_MENU( menu_tools ) );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools_item ), menu_tools );
gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tools_item );
gtk_widget_show( menu_bar );
}
{ // Texture TreeView
- g_TextureBrowser.m_scr_win_tree = gtk_scrolled_window_new( NULL, NULL );
+ g_TextureBrowser.m_scr_win_tree = ui::Widget(gtk_scrolled_window_new( NULL, NULL ));
gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tree ), 0 );
// vertical only scrolling for treeview
gtk_widget_show( GTK_WIDGET( g_TextureBrowser.m_treeViewTree ) );
}
{ // gl_widget scrollbar
- GtkWidget* w = gtk_vscrollbar_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,0,1,1,0 ) ) );
+ ui::Widget w = ui::Widget(gtk_vscrollbar_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,0,1,1,0 ) ) ));
gtk_table_attach( GTK_TABLE( table ), w, 2, 3, 1, 2, GTK_SHRINK, GTK_FILL, 0, 0 );
gtk_widget_show( w );
g_TextureBrowser.m_texture_scroll = w;
widget_set_visible( g_TextureBrowser.m_texture_scroll, g_TextureBrowser.m_showTextureScrollbar );
}
{ // gl_widget
- g_TextureBrowser.m_gl_widget = glwidget_new( FALSE );
+ g_TextureBrowser.m_gl_widget = ui::Widget(glwidget_new( FALSE ));
gtk_widget_ref( g_TextureBrowser.m_gl_widget );
gtk_widget_set_events( g_TextureBrowser.m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK );
TextureBrowser_buildTagList();
}
{ // tag menu bar
- GtkWidget* menu_tags = gtk_menu_new();
- GtkWidget* tags_item = (GtkWidget*)TextureBrowser_constructTagsMenu( GTK_MENU( menu_tags ) );
+ ui::Widget menu_tags = ui::Widget(gtk_menu_new());
+ auto tags_item = TextureBrowser_constructTagsMenu( GTK_MENU( menu_tags ) );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( tags_item ), menu_tags );
gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tags_item );
}
{ // Tag TreeView
- g_TextureBrowser.m_scr_win_tags = gtk_scrolled_window_new( NULL, NULL );
+ g_TextureBrowser.m_scr_win_tags = ui::Widget(gtk_scrolled_window_new( NULL, NULL ));
gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tags ), 0 );
// vertical only scrolling for treeview
gtk_box_pack_end( GTK_BOX( vbox ), g_TextureBrowser.m_search_button, FALSE, FALSE, 0 );
}
{ // Tag frame
- frame_table = gtk_table_new( 3, 3, FALSE );
+ frame_table = ui::Widget(gtk_table_new( 3, 3, FALSE ));
- g_TextureBrowser.m_tag_frame = gtk_frame_new( "Tag assignment" );
+ g_TextureBrowser.m_tag_frame = ui::Widget(gtk_frame_new( "Tag assignment" ));
gtk_frame_set_label_align( GTK_FRAME( g_TextureBrowser.m_tag_frame ), 0.5, 0.5 );
gtk_frame_set_shadow_type( GTK_FRAME( g_TextureBrowser.m_tag_frame ), GTK_SHADOW_NONE );
gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_tag_frame ), frame_table );
}
{ // assigned tag list
- GtkWidget* scrolled_win = gtk_scrolled_window_new( NULL, NULL );
+ ui::Widget scrolled_win = ui::Widget(gtk_scrolled_window_new( NULL, NULL ));
gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- g_TextureBrowser.m_assigned_tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) );
+ g_TextureBrowser.m_assigned_tree = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) ));
g_object_unref( G_OBJECT( g_TextureBrowser.m_assigned_store ) );
g_signal_connect( g_TextureBrowser.m_assigned_tree, "row-activated", (GCallback) TextureBrowser_removeTags, NULL );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), FALSE );
gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
}
{ // available tag list
- GtkWidget* scrolled_win = gtk_scrolled_window_new( NULL, NULL );
+ ui::Widget scrolled_win = ui::Widget(gtk_scrolled_window_new( NULL, NULL ));
gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- g_TextureBrowser.m_available_tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) );
+ g_TextureBrowser.m_available_tree = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) ));
g_object_unref( G_OBJECT( g_TextureBrowser.m_available_store ) );
g_signal_connect( g_TextureBrowser.m_available_tree, "row-activated", (GCallback) TextureBrowser_assignTags, NULL );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), FALSE );
gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 2, 3, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
}
{ // tag arrow buttons
- GtkWidget* m_btn_left = gtk_button_new();
- GtkWidget* m_btn_right = gtk_button_new();
- GtkWidget* m_arrow_left = gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT );
- GtkWidget* m_arrow_right = gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT );
+ ui::Widget m_btn_left = ui::Widget(gtk_button_new());
+ ui::Widget m_btn_right = ui::Widget(gtk_button_new());
+ ui::Widget m_arrow_left = ui::Widget(gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT ));
+ ui::Widget m_arrow_right = ui::Widget(gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT ));
gtk_container_add( GTK_CONTAINER( m_btn_left ), m_arrow_left );
gtk_container_add( GTK_CONTAINER( m_btn_right ), m_arrow_right );
gtk_widget_show( m_arrow_right );
}
{ // tag fram labels
- GtkWidget* m_lbl_assigned = gtk_label_new( "Assigned" );
- GtkWidget* m_lbl_unassigned = gtk_label_new( "Available" );
+ ui::Widget m_lbl_assigned = ui::Label( "Assigned" );
+ ui::Widget m_lbl_unassigned = ui::Label( "Available" );
gtk_table_attach( GTK_TABLE( frame_table ), m_lbl_assigned, 0, 1, 0, 1, GTK_EXPAND, GTK_SHRINK, 0, 0 );
gtk_table_attach( GTK_TABLE( frame_table ), m_lbl_unassigned, 2, 3, 0, 1, GTK_EXPAND, GTK_SHRINK, 0, 0 );
}
else
{
- gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Select a single tag for renaming." );
+ ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Select a single tag for renaming." );
}
}
gtk_tree_selection_selected_foreach( selection, GtkTreeSelectionForeachFunc( TextureBrowser_selectionHelper ), &selected );
if ( g_slist_length( selected ) == 1 ) { // we only delete a single tag
- EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Are you sure you want to delete the selected tag?", "Delete Tag", eMB_YESNO, eMB_ICONQUESTION );
+ auto result = ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Are you sure you want to delete the selected tag?", "Delete Tag", ui::alert_type::YESNO, ui::alert_icon::QUESTION );
- if ( result == eIDYES ) {
+ if ( result == ui::alert_response::YES ) {
GtkTreeIter iterSelected;
gchar *rowTag;
}
}
else {
- gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Select a single tag for deletion." );
+ ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Select a single tag for deletion." );
}
}
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
GlobalShaderSystem().refresh();
UpdateAllWindows();
- GtkTreeSelection* selection = gtk_tree_view_get_selection((GtkTreeView*)GlobalTextureBrowser().m_treeViewTree);
+ GtkTreeSelection* selection = gtk_tree_view_get_selection((GtkTreeView*) GlobalTextureBrowser().m_treeViewTree.handle());
GtkTreeModel* model = NULL;
GtkTreeIter iter;
if ( gtk_tree_selection_get_selected (selection, &model, &iter) )
}
void TextureBrowser_showUntagged(){
- EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "WARNING! This function might need a lot of memory and time. Are you sure you want to use it?", "Show Untagged", eMB_YESNO, eMB_ICONWARNING );
+ auto result = ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "WARNING! This function might need a lot of memory and time. Are you sure you want to use it?", "Show Untagged", ui::alert_type::YESNO, ui::alert_icon::WARNING );
- if ( result == eIDYES ) {
+ if ( result == ui::alert_response::YES ) {
g_TextureBrowser.m_found_shaders.clear();
TagBuilder.GetUntagged( g_TextureBrowser.m_found_shaders );
std::set<std::string>::iterator iter;
#if !defined( INCLUDED_TEXWINDOW_H )
#define INCLUDED_TEXWINDOW_H
+#include <uilib/uilib.h>
#include "math/vector.h"
#include "generic/callbackfwd.h"
#include "signal/signalfwd.h"
#include "xml/xmltextags.h"
-typedef struct _GtkWidget GtkWidget;
-
class TextureBrowser;
TextureBrowser& GlobalTextureBrowser();
-typedef struct _GtkWindow GtkWindow;
-GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel );
+ui::Widget TextureBrowser_constructWindow( ui::Window toplevel );
void TextureBrowser_destroyWindow();
template<typename FirstArgument, void( *func ) (FirstArgument)>
class FreeCaller1;
-extern GtkWidget* g_page_textures;
+extern ui::Widget g_page_textures;
void TextureBrowser_exportTitle( const StringImportCallback& importer );
typedef FreeCaller1<const StringImportCallback&, TextureBrowser_exportTitle> TextureBrowserExportTitleCaller;
#if defined( __linux__ ) || defined( __FreeBSD__ )
#include <cstdlib>
+#include <uilib/uilib.h>
+
bool open_url( const char* url ){
// \todo FIXME: the way we open URLs on *nix should be improved. A script is good (see how I do on RTCW)
char command[2 * PATH_MAX];
// let's put a little comment
globalOutputStream() << "OpenURL: " << url << "\n";
if ( !open_url( url ) ) {
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "Failed to launch browser!" );
+ MainFrame_getWindow().alert( "Failed to launch browser!" );
}
}
#include <glib.h>
+#include <uilib/uilib.h>
#include "xmlstuff.h"
class CWatchBSP
void Build_constructPreferences( PreferencesPage& page ){
- GtkWidget* monitorbsp = page.appendCheckBox( "", "Enable Build Process Monitoring", g_WatchBSP_Enabled );
- GtkWidget* leakstop = page.appendCheckBox( "", "Stop Compilation on Leak", g_WatchBSP_LeakStop );
- GtkWidget* runengine = page.appendCheckBox( "", "Run Engine After Compile", g_WatchBSP_RunQuake );
- GtkWidget* sleep = page.appendCheckBox ( "", "Sleep When Running the Engine", g_WatchBSP_DoSleep );
+ ui::CheckButton monitorbsp = page.appendCheckBox( "", "Enable Build Process Monitoring", g_WatchBSP_Enabled );
+ ui::CheckButton leakstop = page.appendCheckBox( "", "Stop Compilation on Leak", g_WatchBSP_LeakStop );
+ ui::CheckButton runengine = page.appendCheckBox( "", "Run Engine After Compile", g_WatchBSP_RunQuake );
+ ui::CheckButton sleep = page.appendCheckBox ( "", "Sleep When Running the Engine", g_WatchBSP_DoSleep );
Widget_connectToggleDependency( leakstop, monitorbsp );
Widget_connectToggleDependency( runengine, monitorbsp );
Widget_connectToggleDependency( sleep, runengine );
if ( SetupListening() == false ) {
const char* msg = "Failed to get a listening socket on port 39000.\nTry running with Build monitoring disabled if you can't fix this.\n";
globalOutputStream() << msg;
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), msg, "Build monitoring", eMB_OK, eMB_ICONERROR );
+ MainFrame_getWindow().alert( msg, "Build monitoring", ui::alert_type::OK, ui::alert_icon::ERROR );
return;
}
// set the timer for timeouts and step cancellation
msg << reinterpret_cast<const char*>( g_ptr_array_index( m_pCmd, m_iCurrentStep ) );
msg << "\nCheck that the file exists and that you don't run out of system resources.\n";
globalOutputStream() << msg.c_str();
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), msg.c_str(), "Build monitoring", eMB_OK, eMB_ICONERROR );
+ MainFrame_getWindow().alert( msg.c_str(), "Build monitoring", ui::alert_type::OK, ui::alert_icon::ERROR );
return;
}
// re-initialise the debug window
case EBeginStep:
// timeout: if we don't get an incoming connection fast enough, go back to idle
if ( g_timer_elapsed( m_pTimer, NULL ) > g_WatchBSP_Timeout ) {
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "The connection timed out, assuming the build process failed\nMake sure you are using a networked version of Q3Map?\nOtherwise you need to disable BSP Monitoring in prefs.", "BSP process monitoring", eMB_OK );
+ MainFrame_getWindow().alert( "The connection timed out, assuming the build process failed\nMake sure you are using a networked version of Q3Map?\nOtherwise you need to disable BSP Monitoring in prefs.", "BSP process monitoring", ui::alert_type::OK );
EndMonitoringLoop();
#if 0
if ( m_bBSPPlugin ) {
StringOutputStream msg;
msg << "Failed to execute the following command: " << cmd.c_str() << cmdline.c_str();
globalOutputStream() << msg.c_str();
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), msg.c_str(), "Build monitoring", eMB_OK, eMB_ICONERROR );
+ MainFrame_getWindow().alert( msg.c_str(), "Build monitoring", ui::alert_type::OK, ui::alert_icon::ERROR );
}
}
EndMonitoringLoop();
if ( m_eState != EIdle ) {
globalOutputStream() << "WatchBSP got a monitoring request while not idling...\n";
// prompt the user, should we cancel the current process and go ahead?
- if ( gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "I am already monitoring a Build process.\nDo you want me to override and start a new compilation?",
- "Build process monitoring", eMB_YESNO ) == eIDYES ) {
+ if ( MainFrame_getWindow().alert( "I am already monitoring a Build process.\nDo you want me to override and start a new compilation?",
+ "Build process monitoring", ui::alert_type::YESNO ) == ui::alert_response::YES ) {
// disconnect and set EIdle state
Reset();
}
#include <gdk/gdkkeysyms.h>
-gboolean selection_modifier_key_press( GtkWidget* widget, GdkEventKey* event, WindowObservers& observers ){
+gboolean selection_modifier_key_press( ui::Widget widget, GdkEventKey* event, WindowObservers& observers ){
switch ( event->keyval )
{
case GDK_Alt_L:
return FALSE;
}
-gboolean selection_modifier_key_release( GtkWidget* widget, GdkEventKey* event, WindowObservers& observers ){
+gboolean selection_modifier_key_release( ui::Widget widget, GdkEventKey* event, WindowObservers& observers ){
switch ( event->keyval )
{
case GDK_Alt_L:
WindowObservers_UpdateModifier( observers, modifiers, c_modifierControl );
}
-gboolean modifiers_button_press( GtkWidget* widget, GdkEventButton* event, WindowObservers* observers ){
+gboolean modifiers_button_press( ui::Widget widget, GdkEventButton* event, WindowObservers* observers ){
if ( event->type == GDK_BUTTON_PRESS ) {
WindowObservers_UpdateModifiers( *observers, modifiers_for_state( event->state ) );
}
return FALSE;
}
-gboolean modifiers_button_release( GtkWidget* widget, GdkEventButton* event, WindowObservers* observers ){
+gboolean modifiers_button_release( ui::Widget widget, GdkEventButton* event, WindowObservers* observers ){
if ( event->type == GDK_BUTTON_RELEASE ) {
WindowObservers_UpdateModifiers( *observers, modifiers_for_state( event->state ) );
}
return FALSE;
}
-gboolean modifiers_motion( GtkWidget *widget, GdkEventMotion *event, WindowObservers* observers ){
+gboolean modifiers_motion( ui::Widget widget, GdkEventMotion *event, WindowObservers* observers ){
WindowObservers_UpdateModifiers( *observers, modifiers_for_state( event->state ) );
return FALSE;
}
g_window_observers.push_back( observer );
}
-void GlobalWindowObservers_connectTopLevel( GtkWindow* window ){
+void GlobalWindowObservers_connectTopLevel( ui::Window window ){
g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( selection_modifier_key_press ), &g_window_observers );
g_signal_connect( G_OBJECT( window ), "key_release_event", G_CALLBACK( selection_modifier_key_release ), &g_window_observers );
}
-void GlobalWindowObservers_connectWidget( GtkWidget* widget ){
+void GlobalWindowObservers_connectWidget( ui::Widget widget ){
g_signal_connect( G_OBJECT( widget ), "button_press_event", G_CALLBACK( modifiers_button_press ), &g_window_observers );
g_signal_connect( G_OBJECT( widget ), "button_release_event", G_CALLBACK( modifiers_button_release ), &g_window_observers );
g_signal_connect( G_OBJECT( widget ), "motion_notify_event", G_CALLBACK( modifiers_motion ), &g_window_observers );
#include "windowobserver.h"
#include <gdk/gdktypes.h>
+#include <uilib/uilib.h>
#include "math/vector.h"
class WindowObserver;
void GlobalWindowObservers_add( WindowObserver* observer );
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-void GlobalWindowObservers_connectWidget( GtkWidget* widget );
-void GlobalWindowObservers_connectTopLevel( GtkWindow* window );
+void GlobalWindowObservers_connectWidget( ui::Widget widget );
+void GlobalWindowObservers_connectTopLevel( ui::Window window );
inline ButtonIdentifier button_for_button( unsigned int button ){
switch ( button )
#include <gtk/gtklabel.h>
#include <gtk/gtkmenuitem.h>
+#include <uilib/uilib.h>
#include "generic/callback.h"
#include "string/string.h"
unsigned char* img;
const char* filename;
- filename = file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, "Save Image", 0, FILTER_BMP );
+ filename = ui::file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, "Save Image", 0, FILTER_BMP );
if ( !filename ) {
return;
}
}
}
-gboolean xywnd_button_press( GtkWidget* widget, GdkEventButton* event, XYWnd* xywnd ){
+gboolean xywnd_button_press( ui::Widget widget, GdkEventButton* event, XYWnd* xywnd ){
if ( event->type == GDK_BUTTON_PRESS ) {
g_pParentWnd->SetActiveXY( xywnd );
return FALSE;
}
-gboolean xywnd_button_release( GtkWidget* widget, GdkEventButton* event, XYWnd* xywnd ){
+gboolean xywnd_button_release( ui::Widget widget, GdkEventButton* event, XYWnd* xywnd ){
if ( event->type == GDK_BUTTON_RELEASE ) {
xywnd->XY_MouseUp( static_cast<int>( event->x ), static_cast<int>( event->y ), buttons_for_event_button( event ) );
return FALSE;
}
-gboolean xywnd_focus_in( GtkWidget* widget, GdkEventFocus* event, XYWnd* xywnd ){
+gboolean xywnd_focus_in( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){
if ( event->type == GDK_FOCUS_CHANGE ) {
if ( event->in ) {
g_pParentWnd->SetActiveXY( xywnd );
reinterpret_cast<XYWnd*>( data )->XY_MouseMoved( static_cast<int>( x ), static_cast<int>( y ), buttons_for_state( state ) );
}
-gboolean xywnd_wheel_scroll( GtkWidget* widget, GdkEventScroll* event, XYWnd* xywnd ){
+gboolean xywnd_wheel_scroll( ui::Widget widget, GdkEventScroll* event, XYWnd* xywnd ){
if ( event->direction == GDK_SCROLL_UP ) {
XYWnd_ZoomIn( xywnd );
}
return FALSE;
}
-gboolean xywnd_size_allocate( GtkWidget* widget, GtkAllocation* allocation, XYWnd* xywnd ){
+gboolean xywnd_size_allocate( ui::Widget widget, GtkAllocation* allocation, XYWnd* xywnd ){
xywnd->m_nWidth = allocation->width;
xywnd->m_nHeight = allocation->height;
xywnd->updateProjection();
return FALSE;
}
-gboolean xywnd_expose( GtkWidget* widget, GdkEventExpose* event, XYWnd* xywnd ){
+gboolean xywnd_expose( ui::Widget widget, GdkEventExpose* event, XYWnd* xywnd ){
if ( glwidget_make_current( xywnd->GetWidget() ) != FALSE ) {
if ( Map_Valid( g_map ) && ScreenUpdates_Enabled() ) {
GlobalOpenGL_debugAssertNoErrors();
if ( ClipMode() && GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ) {
GdkCursor *cursor;
cursor = gdk_cursor_new( GDK_CROSSHAIR );
- gdk_window_set_cursor( m_gl_widget->window, cursor );
+ gdk_window_set_cursor( m_gl_widget.handle()->window, cursor );
gdk_cursor_unref( cursor );
}
else
{
- gdk_window_set_cursor( m_gl_widget->window, 0 );
+ gdk_window_set_cursor( m_gl_widget.handle()->window, 0 );
}
}
"textures/common/caulk" : TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) );
}
-void entitycreate_activated( GtkWidget* item ){
+void entitycreate_activated( ui::Widget item ){
scene::Node* world_node = Map_FindWorldspawn( g_map );
const char* entity_name = gtk_label_get_text( GTK_LABEL( GTK_BIN( item )->child ) );
g_pParentWnd->ActiveXY()->OnEntityCreate( entity_name );
}
else {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( MainFrame_getWindow() ), "There's already a worldspawn in your map!"
+ GlobalRadiant().m_pfnMessageBox( MainFrame_getWindow(), "There's already a worldspawn in your map!"
"",
"Info",
eMB_OK,
reinterpret_cast<XYWnd*>( data )->Scroll( -x, y );
}
-gboolean XYWnd_Move_focusOut( GtkWidget* widget, GdkEventFocus* event, XYWnd* xywnd ){
+gboolean XYWnd_Move_focusOut( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){
xywnd->Move_End();
return FALSE;
}
Move_End();
}
m_move_started = true;
- g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), XYWnd_moveDelta, this );
+ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_moveDelta, this );
m_move_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
}
void XYWnd::Move_End(){
m_move_started = false;
- g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow() );
+ g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow() );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_move_focusOut );
}
}
}
-gboolean XYWnd_Zoom_focusOut( GtkWidget* widget, GdkEventFocus* event, XYWnd* xywnd ){
+gboolean XYWnd_Zoom_focusOut( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){
xywnd->Zoom_End();
return FALSE;
}
}
m_zoom_started = true;
g_dragZoom = 0;
- g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
+ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
m_zoom_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
}
void XYWnd::Zoom_End(){
m_zoom_started = false;
- g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow() );
+ g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow() );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_zoom_focusOut );
}
m_viewType = viewType;
updateModelview();
- if ( m_parent != 0 ) {
+ if ( m_parent ) {
gtk_window_set_title( m_parent, ViewType_getTitle( m_viewType ) );
}
}
void WXY_BackgroundSelect( void ){
bool brushesSelected = Scene_countSelectedBrushes( GlobalSceneGraph() ) != 0;
if ( !brushesSelected ) {
- gtk_MessageBox( 0, "You have to select some brushes to get the bounding box for.\n",
- "No selection", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( "You have to select some brushes to get the bounding box for.\n",
+ "No selection", ui::alert_type::OK, ui::alert_icon::ERROR );
return;
}
- const char *filename = file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, "Background Image", NULL, NULL );
+ const char *filename = MainFrame_getWindow().file_dialog( TRUE, "Background Image", NULL, NULL );
g_pParentWnd->ActiveXY()->XY_DisableBackground();
if ( filename ) {
g_pParentWnd->ActiveXY()->XY_LoadBackgroundImage( filename );
ToggleShown g_xy_top_shown( true );
-void XY_Top_Shown_Construct( GtkWindow* parent ){
+void XY_Top_Shown_Construct( ui::Window parent ){
g_xy_top_shown.connect( GTK_WIDGET( parent ) );
}
ToggleShown g_yz_side_shown( false );
-void YZ_Side_Shown_Construct( GtkWindow* parent ){
+void YZ_Side_Shown_Construct( ui::Window parent ){
g_yz_side_shown.connect( GTK_WIDGET( parent ) );
}
ToggleShown g_xz_front_shown( false );
-void XZ_Front_Shown_Construct( GtkWindow* parent ){
+void XZ_Front_Shown_Construct( ui::Window parent ){
g_xz_front_shown.connect( GTK_WIDGET( parent ) );
}
{
class Node;
}
-typedef struct _GtkWindow GtkWindow;
typedef struct _GtkMenu GtkMenu;
class XYWnd
{
-GtkWidget* m_gl_widget;
+ui::Widget m_gl_widget;
guint m_sizeHandler;
guint m_exposeHandler;
DeferredDraw m_deferredDraw;
DeferredMotion m_deferred_motion;
public:
-GtkWindow* m_parent;
+ui::Window m_parent;
XYWnd();
~XYWnd();
void queueDraw(){
m_deferredDraw.draw();
}
-GtkWidget* GetWidget(){
+ui::Widget GetWidget(){
return m_gl_widget;
}
VIEWTYPE GlobalXYWnd_getCurrentViewType();
-typedef struct _GtkWindow GtkWindow;
-void XY_Top_Shown_Construct( GtkWindow* parent );
-void YZ_Side_Shown_Construct( GtkWindow* parent );
-void XZ_Front_Shown_Construct( GtkWindow* parent );
+void XY_Top_Shown_Construct( ui::Window parent );
+void YZ_Side_Shown_Construct( ui::Window parent );
+void XZ_Front_Shown_Construct( ui::Window parent );
void XYWindow_Construct();
void XYWindow_Destroy();