gboolean project_cell_edited( GtkCellRendererText* cell, gchar* path_string, gchar* new_text, ProjectList* projectList ){
Project& project = projectList->m_project;
- GtkTreePath* path = ui::TreePath( path_string );
+ auto path = ui::TreePath( path_string );
ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" );
Project& project = projectList->m_project;
if ( event->keyval == GDK_KEY_Delete ) {
- GtkTreeSelection* selection = gtk_tree_view_get_selection(widget );
+ auto selection = ui::TreeSelection(gtk_tree_view_get_selection(widget));
GtkTreeIter iter;
GtkTreeModel* model;
if ( gtk_tree_selection_get_selected( selection, &model, &iter ) ) {
- GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
+ auto path = gtk_tree_model_get_path( model, &iter );
Project::iterator x = Project_find( project, gtk_tree_path_get_indices( path )[0] );
gtk_tree_path_free( path );
Build* g_current_build = 0;
-gboolean project_selection_changed( GtkTreeSelection* selection, ui::ListStore store ){
+gboolean project_selection_changed( ui::TreeSelection selection, ui::ListStore store ){
Project& project = g_build_project;
store.clear();
GtkTreeIter iter;
GtkTreeModel* model;
if ( gtk_tree_selection_get_selected( selection, &model, &iter ) ) {
- GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
+ auto path = gtk_tree_model_get_path( model, &iter );
Project::iterator x = Project_find( project, gtk_tree_path_get_indices( path )[0] );
gtk_tree_path_free( path );
}
Build& build = *g_current_build;
- GtkTreePath* path = ui::TreePath( path_string );
+ auto path = ui::TreePath( path_string );
ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" );
Build& build = *g_current_build;
if ( event->keyval == GDK_KEY_Delete ) {
- GtkTreeSelection* selection = gtk_tree_view_get_selection(widget );
+ auto selection = gtk_tree_view_get_selection(widget );
GtkTreeIter iter;
GtkTreeModel* model;
if ( gtk_tree_selection_get_selected( selection, &model, &iter ) ) {
- GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
+ auto path = gtk_tree_model_get_path( model, &iter );
Build::iterator i = Build_find( build, gtk_tree_path_get_indices( path )[0] );
gtk_tree_path_free( path );
object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
renderer.connect("edited", G_CALLBACK( project_cell_edited ), &projectList );
- GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
+ auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column(view, column );
- GtkTreeSelection* selection = gtk_tree_view_get_selection(view );
+ auto selection = gtk_tree_view_get_selection(view );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_BROWSE );
view.show();
object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
renderer.connect( "edited", G_CALLBACK( commands_cell_edited ), store );
- GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
+ auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column(view, column );
- GtkTreeSelection* selection = gtk_tree_view_get_selection(view );
+ auto selection = gtk_tree_view_get_selection(view );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_BROWSE );
view.show();
{
const char* m_name;
public:
-GtkMenuItem* m_item;
-BuildMenuItem( const char* name, GtkMenuItem* item )
+ui::MenuItem m_item;
+BuildMenuItem( const char* name, ui::MenuItem item )
: m_name( name ), m_item( item ){
}
void run(){
void Build_constructMenu( ui::Menu menu ){
for ( Project::iterator i = g_build_project.begin(); i != g_build_project.end(); ++i )
{
- g_BuildMenuItems.push_back( BuildMenuItem( ( *i ).first.c_str(), 0 ) );
+ g_BuildMenuItems.push_back( BuildMenuItem( ( *i ).first.c_str(), ui::MenuItem(ui::null) ) );
if ( is_separator( *i ) ) {
g_BuildMenuItems.back().m_item = menu_separator( menu );
}
ui::TreeView m_list;
GtkTreeIter m_command_iter;
- GtkTreeModel *m_model;
+ ui::TreeModel m_model;
bool m_waiting_for_key;
};
-void accelerator_clear_button_clicked( GtkButton *btn, gpointer dialogptr ){
+void accelerator_clear_button_clicked( ui::Button btn, gpointer dialogptr ){
command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr;
if ( dialog.m_waiting_for_key ) {
dialog.m_waiting_for_key = false;
gtk_list_store_set( ui::ListStore::from( dialog.m_model ), &dialog.m_command_iter, 2, false, -1 );
gtk_widget_set_sensitive( dialog.m_list , true );
- dialog.m_model = NULL;
+ dialog.m_model = ui::TreeModel(ui::null);
return;
}
- GtkTreeSelection *sel = gtk_tree_view_get_selection( dialog.m_list );
+ auto sel = gtk_tree_view_get_selection( dialog.m_list );
GtkTreeModel *model;
GtkTreeIter iter;
if ( !gtk_tree_selection_get_selected( sel, &model, &iter ) ) {
g_value_unset( &val );
}
-void accelerator_edit_button_clicked( GtkButton *btn, gpointer dialogptr ){
+void accelerator_edit_button_clicked( ui::Button btn, gpointer dialogptr ){
command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr;
// 1. find selected row
- GtkTreeSelection *sel = gtk_tree_view_get_selection( dialog.m_list );
+ auto sel = gtk_tree_view_get_selection( dialog.m_list );
GtkTreeModel *model;
GtkTreeIter iter;
if ( !gtk_tree_selection_get_selected( sel, &model, &iter ) ) {
return;
}
dialog.m_command_iter = iter;
- dialog.m_model = model;
+ dialog.m_model = ui::TreeModel(model);
// 2. disallow changing the row
//gtk_widget_set_sensitive(dialog.m_list, false);
const char *commandName;
const Accelerator &newAccel;
ui::Widget widget;
- GtkTreeModel *model;
+ ui::TreeModel model;
public:
bool allow;
- VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, ui::Widget w, GtkTreeModel *m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){
+ VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, ui::Widget w, ui::TreeModel m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){
}
void visit( const char* name, Accelerator& accelerator ){
if ( !strcmp( name, commandName ) ) {
g_value_unset( &val );
- dialog.m_model = NULL;
+ dialog.m_model = ui::TreeModel(ui::null);
return true;
}
{
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = ui::TreeViewColumn( "Command", renderer, {{"text", 0}, {"weight-set", 2}, {"weight", 3}} );
+ auto column = ui::TreeViewColumn( "Command", renderer, {{"text", 0}, {"weight-set", 2}, {"weight", 3}} );
gtk_tree_view_append_column(view, column );
}
{
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 1}, {"weight-set", 2}, {"weight", 3}} );
+ auto column = ui::TreeViewColumn( "Key", renderer, {{"text", 1}, {"weight-set", 2}, {"weight", 3}} );
gtk_tree_view_append_column(view, column );
}
if ( level != SYS_NOCON ) {
if ( g_console ) {
- GtkTextBuffer* buffer = gtk_text_view_get_buffer( g_console );
+ auto buffer = gtk_text_view_get_buffer( g_console );
GtkTextIter iter;
gtk_text_buffer_get_end_iter( buffer, &iter );
- static GtkTextMark* end = gtk_text_buffer_create_mark( buffer, "end", &iter, FALSE );
+ static auto end = gtk_text_buffer_create_mark( buffer, "end", &iter, FALSE );
const GdkColor yellow = { 0, 0xb0ff, 0xb0ff, 0x0000 };
const GdkColor red = { 0, 0xffff, 0x0000, 0x0000 };
- static GtkTextTag* error_tag = gtk_text_buffer_create_tag( buffer, "red_foreground", "foreground-gdk", &red, NULL );
- static GtkTextTag* warning_tag = gtk_text_buffer_create_tag( buffer, "yellow_foreground", "foreground-gdk", &yellow, NULL );
- static GtkTextTag* standard_tag = gtk_text_buffer_create_tag( buffer, "black_foreground", NULL );
+ static auto error_tag = gtk_text_buffer_create_tag( buffer, "red_foreground", "foreground-gdk", &red, NULL );
+ static auto warning_tag = gtk_text_buffer_create_tag( buffer, "yellow_foreground", "foreground-gdk", &yellow, NULL );
+ static auto standard_tag = gtk_text_buffer_create_tag( buffer, "black_foreground", NULL );
GtkTextTag* tag;
switch ( level )
{
class DialogSpinnerRow
{
public:
-DialogSpinnerRow( ui::Widget row, GtkSpinButton* spin ) : m_row( row ), m_spin( spin ){
+DialogSpinnerRow( ui::Widget row, ui::SpinButton spin ) : m_row( row ), m_spin( spin ){
}
ui::Widget m_row;
ui::SpinButton m_spin;
Callback m_changed;
guint m_changedHandler;
-static gboolean changed( GtkComboBox *widget, NonModalComboBox* self ){
+static gboolean changed( ui::ComboBox widget, NonModalComboBox* self ){
self->m_changed();
return FALSE;
}
bool g_entityInspector_windowConstructed = false;
-GtkTreeView* g_entityClassList;
+ui::TreeView g_entityClassList{ui::null};
ui::TextView g_entityClassComment{ui::null};
GtkCheckButton* g_entitySpawnflagsCheck[MAX_FLAGS];
}
void EntityClassList_selectEntityClass( EntityClass* eclass ){
- GtkTreeModel* model = g_entlist_store;
+ auto model = g_entlist_store;
GtkTreeIter iter;
for ( gboolean good = gtk_tree_model_get_iter_first( model, &iter ); good != FALSE; good = gtk_tree_model_iter_next( model, &iter ) )
{
gtk_tree_model_get( model, &iter, 0, &text, -1 );
if ( strcmp( text, eclass->name() ) == 0 ) {
auto view = ui::TreeView(g_entityClassList);
- GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
+ auto path = gtk_tree_model_get_path( model, &iter );
gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path );
if ( gtk_widget_get_realized( view ) ) {
gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 );
// Creates a new entity based on the currently selected brush and entity type.
//
void EntityClassList_createEntity(){
- auto view = ui::Widget::from(g_entityClassList);
+ auto view = g_entityClassList;
// find out what type of entity we are trying to create
GtkTreeModel* model;
// =============================================================================
// callbacks
-static void EntityClassList_selection_changed( GtkTreeSelection* selection, gpointer data ){
+static void EntityClassList_selection_changed( ui::TreeSelection selection, gpointer data ){
GtkTreeModel* model;
GtkTreeIter selected;
if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) {
gtk_tree_model_get( model, &iter, 0, &text, -1 );
if ( toupper( text[0] ) == (int)code ) {
- GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
+ auto path = gtk_tree_model_get_path( model, &iter );
gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path );
if ( gtk_widget_get_realized( view ) ) {
gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 );
return FALSE;
}
-static void EntityProperties_selection_changed( GtkTreeSelection* selection, gpointer data ){
+static void EntityProperties_selection_changed( ui::TreeSelection selection, gpointer data ){
// find out what type of entity we are trying to create
GtkTreeModel* model;
GtkTreeIter iter;
{
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} );
+ auto column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} );
gtk_tree_view_append_column( view, column );
}
{
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
+ auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column(view, column );
}
{
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 1}} );
+ auto column = ui::TreeViewColumn( "", renderer, {{"text", 1}} );
gtk_tree_view_append_column(view, column );
}
WindowPositionTracker m_positionTracker;
ui::Window m_window;
-GtkTreeView* m_tree_view;
+ui::TreeView m_tree_view{ui::null};
ui::TreeModel m_tree_model{ui::null};
bool m_selection_disabled;
}
template<typename value_type>
-inline void gtk_tree_model_get_pointer( GtkTreeModel* model, GtkTreeIter* iter, gint column, value_type** pointer ){
+inline void gtk_tree_model_get_pointer( ui::TreeModel model, GtkTreeIter* iter, gint column, value_type** pointer ){
GValue value = GValue_default();
gtk_tree_model_get_value( model, iter, column, &value );
*pointer = (value_type*)g_value_get_pointer( &value );
-void entitylist_treeviewcolumn_celldatafunc( GtkTreeViewColumn* column, GtkCellRenderer* renderer, GtkTreeModel* model, GtkTreeIter* iter, gpointer data ){
+void entitylist_treeviewcolumn_celldatafunc( ui::TreeViewColumn column, GtkCellRenderer* renderer, ui::TreeModel model, GtkTreeIter* iter, gpointer data ){
scene::Node* node;
gtk_tree_model_get_pointer( model, iter, 0, &node );
scene::Instance* instance;
g_object_set( G_OBJECT( renderer ), "text", name, "visible", TRUE, NULL );
//globalOutputStream() << "rendering cell " << makeQuoted(name) << "\n";
- GtkStyle* style = gtk_widget_get_style( ui::TreeView( getEntityList().m_tree_view ) );
+ auto style = gtk_widget_get_style( ui::TreeView( getEntityList().m_tree_view ) );
if ( instance->childSelected() ) {
g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_ACTIVE], NULL );
}
}
}
-static gboolean entitylist_tree_select( GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer data ){
+static gboolean entitylist_tree_select( ui::TreeSelection selection, ui::TreeModel model, ui::TreePath path, gboolean path_currently_selected, gpointer data ){
GtkTreeIter iter;
gtk_tree_model_get_iter( model, &iter, path );
scene::Node* node;
return FALSE;
}
-static gboolean entitylist_tree_select_null( GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer data ){
+static gboolean entitylist_tree_select_null( ui::TreeSelection selection, ui::TreeModel model, ui::TreePath path, gboolean path_currently_selected, gpointer data ){
return TRUE;
}
-void EntityList_ConnectSignals( GtkTreeView* view ){
- GtkTreeSelection* select = gtk_tree_view_get_selection( view );
- gtk_tree_selection_set_select_function( select, entitylist_tree_select, NULL, 0 );
+void EntityList_ConnectSignals( ui::TreeView view ){
+ auto select = gtk_tree_view_get_selection( view );
+ gtk_tree_selection_set_select_function(select, reinterpret_cast<GtkTreeSelectionFunc>(entitylist_tree_select), NULL, 0 );
}
-void EntityList_DisconnectSignals( GtkTreeView* view ){
- GtkTreeSelection* select = gtk_tree_view_get_selection( view );
- gtk_tree_selection_set_select_function( select, entitylist_tree_select_null, 0, 0 );
+void EntityList_DisconnectSignals( ui::TreeView view ){
+ auto select = gtk_tree_view_get_selection( view );
+ gtk_tree_selection_set_select_function(select, reinterpret_cast<GtkTreeSelectionFunc>(entitylist_tree_select_null), 0, 0 );
}
-gboolean treemodel_update_selection( GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, gpointer data ){
- GtkTreeView* view = reinterpret_cast<GtkTreeView*>( data );
+gboolean treemodel_update_selection( ui::TreeModel model, ui::TreePath path, GtkTreeIter* iter, gpointer data ){
+ auto view = reinterpret_cast<GtkTreeView*>( data );
scene::Instance* instance;
gtk_tree_model_get_pointer( model, iter, 1, &instance );
Selectable* selectable = Instance_getSelectable( *instance );
if ( selectable != 0 ) {
- GtkTreeSelection* selection = gtk_tree_view_get_selection( view );
+ auto selection = gtk_tree_view_get_selection( view );
if ( selectable->isSelected() ) {
gtk_tree_selection_select_path( selection, path );
}
return FALSE;
}
-void EntityList_UpdateSelection( ui::TreeModel model, GtkTreeView* view ){
+void EntityList_UpdateSelection( ui::TreeModel model, ui::TreeView view ){
EntityList_DisconnectSignals( view );
- gtk_tree_model_foreach( model, treemodel_update_selection, view );
+ gtk_tree_model_foreach(model, reinterpret_cast<GtkTreeModelForeachFunc>(treemodel_update_selection), view._handle );
EntityList_ConnectSignals( view );
}
EntityList_SelectionUpdate();
}
-void entitylist_treeview_rowcollapsed( GtkTreeView* view, GtkTreeIter* iter, GtkTreePath* path, gpointer user_data ){
+void entitylist_treeview_rowcollapsed( ui::TreeView view, GtkTreeIter* iter, ui::TreePath path, gpointer user_data ){
}
-void entitylist_treeview_row_expanded( GtkTreeView* view, GtkTreeIter* iter, GtkTreePath* path, gpointer user_data ){
+void entitylist_treeview_row_expanded( ui::TreeView view, GtkTreeIter* iter, ui::TreePath path, gpointer user_data ){
EntityList_SelectionUpdate();
}
EntityList_SetShown( !getEntityList().visible() );
}
-gint graph_tree_model_compare_name( GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data ){
+gint graph_tree_model_compare_name( ui::TreeModel model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data ){
scene::Node* first;
gtk_tree_model_get( model, a, 0, (gpointer*)&first, -1 );
scene::Node* second;
gtk_tree_view_set_headers_visible(view, FALSE );
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = gtk_tree_view_column_new();
+ auto column = gtk_tree_view_column_new();
gtk_tree_view_column_pack_start( column, renderer, TRUE );
- gtk_tree_view_column_set_cell_data_func( column, renderer, entitylist_treeviewcolumn_celldatafunc, 0, 0 );
+ gtk_tree_view_column_set_cell_data_func(column, renderer, reinterpret_cast<GtkTreeCellDataFunc>(entitylist_treeviewcolumn_celldatafunc), 0, 0 );
- GtkTreeSelection* select = gtk_tree_view_get_selection(view );
+ auto select = gtk_tree_view_get_selection(view );
gtk_tree_selection_set_mode( select, GTK_SELECTION_MULTIPLE );
view.connect( "row_expanded", G_CALLBACK( entitylist_treeview_row_expanded ), 0 );
}
// triggered when the user selects an entry in the feedback box
-static void feedback_selection_changed( GtkTreeSelection* selection, gpointer data ){
+static void feedback_selection_changed( ui::TreeSelection selection, gpointer data ){
g_DbgDlg.DropHighlight();
GtkTreeModel* model;
GtkTreeIter selected;
if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) {
- GtkTreePath* path = gtk_tree_model_get_path( model, &selected );
+ auto path = gtk_tree_model_get_path( model, &selected );
g_DbgDlg.SetHighlight( gtk_tree_path_get_indices( path )[0] );
gtk_tree_path_free( path );
}
{
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
+ auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column(view, column );
}
FindTextureDialog_apply();
}
-static void OnFind( GtkWidget* widget, gpointer data ){
+static void OnFind( ui::Widget widget, gpointer data ){
g_FindTextureDialog.exportData();
FindTextureDialog_apply();
}
-static void OnOK( GtkWidget* widget, gpointer data ){
+static void OnOK( ui::Widget widget, gpointer data ){
g_FindTextureDialog.exportData();
FindTextureDialog_apply();
g_FindTextureDialog.HideDlg();
{
public:
GameCombo game_combo;
-GtkComboBox* gamemode_combo;
+ui::ComboBox gamemode_combo{ui::null};
};
ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
OpenURL( cred.c_str() );
}
-void about_button_issues( GtkWidget *widget, gpointer data ){
+void about_button_issues( ui::Widget widget, gpointer data ){
StringOutputStream cred( 256 );
cred << "https://gitlab.com/xonotic/netradiant/issues";
OpenURL( cred.c_str() );
gtk_window_set_title( text_editor, filename );
- GtkTextBuffer *text_buffer = gtk_text_view_get_buffer(ui::TextView::from(text_widget));
+ auto text_buffer = gtk_text_view_get_buffer(ui::TextView::from(text_widget));
gtk_text_buffer_set_text( text_buffer, (char*)buf, len );
old_filename = g_object_get_data( G_OBJECT( text_editor ), "filename" );
/* win32 is dodgy here, just use courier new then */
g_font = glfont_create( "arial 9" );
#else
- GtkSettings *settings = gtk_settings_get_default();
+ auto settings = gtk_settings_get_default();
gchar *fontname;
g_object_get( settings, "gtk-font-name", &fontname, NULL );
g_font = glfont_create( fontname );
{
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = ui::TreeViewColumn( "Entity", renderer, {{"text", 0}} );
+ auto column = ui::TreeViewColumn( "Entity", renderer, {{"text", 0}} );
gtk_tree_view_append_column(view, column );
gtk_tree_view_column_set_sort_column_id( column, 0 );
}
{
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = ui::TreeViewColumn( "Count", renderer, {{"text", 1}} );
+ auto column = ui::TreeViewColumn( "Count", renderer, {{"text", 1}} );
gtk_tree_view_append_column(view, column );
gtk_tree_view_column_set_sort_column_id( column, 1 );
}
}
}
-void MRU_AddWidget( GtkMenuItem *widget, std::size_t pos ){
+void MRU_AddWidget( ui::MenuItem widget, std::size_t pos ){
if ( pos < MRU_MAX ) {
MRU_items[pos] = widget;
if ( pos < MRU_used ) {
);
}
typedef MemberCaller<Subdivisions, &Subdivisions::apply> ApplyCaller;
-static void applyGtk( GtkToggleButton* toggle, Subdivisions* self ){
+static void applyGtk( ui::ToggleButton toggle, Subdivisions* self ){
self->apply();
}
};
}
ui::Menu g_plugins_menu{ui::null};
-GtkMenuItem* g_plugins_menu_separator = 0;
+ui::MenuItem g_plugins_menu_separator{ui::null};
void PluginsMenu_populate(){
class PluginsMenuConstructor : public PluginsVisitor
void PluginsMenu_clear(){
m_nNextPlugInID = 0;
- GList* lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), g_plugins_menu_separator );
+ GList* lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), g_plugins_menu_separator._handle );
while ( lst->next )
{
g_plugins_menu.remove(ui::Widget::from(lst->next->data));
- lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), g_plugins_menu_separator );
+ lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), g_plugins_menu_separator._handle );
}
}
ERROR_MESSAGE( "invalid toolbar button type" );
}
-void ActivateToolbarButton( GtkToolButton *widget, gpointer data ){
+void ActivateToolbarButton( ui::ToolButton widget, gpointer data ){
(const_cast<const IToolbarButton *>( reinterpret_cast<IToolbarButton *>( data )))->activate();
}
return;
}
-static void treeSelection( GtkTreeSelection* selection, gpointer data ){
+static void treeSelection( ui::TreeSelection selection, gpointer data ){
PrefsDlg *dlg = (PrefsDlg*)data;
GtkTreeModel* model;
{
auto renderer = ui::CellRendererText(ui::New);
- GtkTreeViewColumn* column = ui::TreeViewColumn( "Preferences", renderer, {{"text", 0}} );
+ auto column = ui::TreeViewColumn( "Preferences", renderer, {{"text", 0}} );
gtk_tree_view_append_column(view, column );
}
PreferencesPage preferencesPage( *this, getVBox( global ) );
Global_constructPreferences( preferencesPage );
}
- GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Global", global );
+ auto group = PreferenceTree_appendPage( store, 0, "Global", global );
{
auto game = PreferencePages_addPage( m_notebook, "Game" );
PreferencesPage preferencesPage( *this, getVBox( game ) );
PreferencesPageCallbacks_constructPage( g_interfacePreferences, preferencesPage );
}
- GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Interface", interfacePage );
+ auto group = PreferenceTree_appendPage( store, 0, "Interface", interfacePage );
PreferenceTreeGroup preferenceGroup( *this, m_notebook, store, group );
PreferenceGroupCallbacks_constructGroup( g_interfaceCallbacks, preferenceGroup );
PreferencesPage preferencesPage( *this, getVBox( display ) );
PreferencesPageCallbacks_constructPage( g_displayPreferences, preferencesPage );
}
- GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Display", display );
+ auto group = PreferenceTree_appendPage( store, 0, "Display", display );
PreferenceTreeGroup preferenceGroup( *this, m_notebook, store, group );
PreferenceGroupCallbacks_constructGroup( g_displayCallbacks, preferenceGroup );
PreferencesPageCallbacks_constructPage( g_settingsPreferences, preferencesPage );
}
- GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Settings", settings );
+ auto group = PreferenceTree_appendPage( store, 0, "Settings", settings );
PreferenceTreeGroup preferenceGroup( *this, m_notebook, store, group );
PreferenceGroupCallbacks_constructGroup( g_settingsCallbacks, preferenceGroup );
struct RotateDialog
{
- GtkSpinButton* x;
- GtkSpinButton* y;
- GtkSpinButton* z;
+ ui::SpinButton x{ui::null};
+ ui::SpinButton y{ui::null};
+ ui::SpinButton z{ui::null};
ui::Window window{ui::null};
};
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 );
+void flipX( ui::ToggleButton, gpointer );
+void flipY( ui::ToggleButton, gpointer );
//End Textool function prototypes
#endif
-inline void spin_button_set_step( GtkSpinButton* spin, gfloat step ){
+inline void spin_button_set_step( ui::SpinButton spin, gfloat step ){
#if 1
gtk_adjustment_set_step_increment(gtk_spin_button_get_adjustment( spin ), step);
#else
{
float& m_f;
public:
-GtkSpinButton* m_spin;
+ui::SpinButton m_spin;
ui::Entry m_entry;
Increment( float& f ) : m_f( f ), m_spin( 0 ), m_entry( ui::null ){
}
// =============================================================================
// SurfaceInspector class
-guint togglebutton_connect_toggled( GtkToggleButton* button, const Callback& callback ){
+guint togglebutton_connect_toggled( ui::ToggleButton button, const Callback& callback ){
return g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
}
check.show();
table.attach(check, {c, c + 1, r, r + 1}, {GTK_EXPAND | GTK_FILL, 0});
*p++ = check;
- guint handler_id = togglebutton_connect_toggled( GTK_TOGGLE_BUTTON( check ), ApplyFlagsCaller( *this ) );
+ guint handler_id = togglebutton_connect_toggled( check, ApplyFlagsCaller( *this ) );
g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
}
}
check.show();
table.attach(check, {c, c + 1, r, r + 1}, {GTK_EXPAND | GTK_FILL, 0});
*p++ = check;
- guint handler_id = togglebutton_connect_toggled( GTK_TOGGLE_BUTTON( check ), ApplyFlagsCaller( *this ) );
+ guint handler_id = togglebutton_connect_toggled( check, ApplyFlagsCaller( *this ) );
g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
}
}
===============
*/
-void spin_button_set_value_no_signal( GtkSpinButton* spin, gdouble value ){
+void spin_button_set_value_no_signal( ui::SpinButton spin, gdouble value ){
guint handler_id = gpointer_to_int( g_object_get_data( G_OBJECT( spin ), "handler" ) );
g_signal_handler_block( G_OBJECT( gtk_spin_button_get_adjustment( spin ) ), handler_id );
gtk_spin_button_set_value( spin, value );
g_signal_handler_unblock( G_OBJECT( gtk_spin_button_get_adjustment( spin ) ), handler_id );
}
-void spin_button_set_step_increment( GtkSpinButton* spin, gdouble value ){
- GtkAdjustment* adjust = gtk_spin_button_get_adjustment( spin );
+void spin_button_set_step_increment( ui::SpinButton spin, gdouble value ){
+ auto adjust = gtk_spin_button_get_adjustment( spin );
gtk_adjustment_set_step_increment(adjust, value);
}
//It seems the fake tex coords conversion is screwing this stuff up... !!! FIX !!!
//This is still wrong... Prolly need to do something with the oldScaleX/Y stuff...
-void flipX( GtkToggleButton *, gpointer ){
+void flipX( ui::ToggleButton, gpointer ){
// globalOutputStream() << "--> Flip X...\n";
//Shamus:
// SurfaceInspector_GetSelectedBPTexdef(); // Refresh g_selectedBrushPrimitTexdef...
UpdateControlPoints();
}
-void flipY( GtkToggleButton *, gpointer ){
+void flipY( ui::ToggleButton, gpointer ){
// globalOutputStream() << "--> Flip Y...\n";
// tm.coords[0][1] = -tm.coords[0][1];
// tm.coords[1][1] = -tm.coords[1][1];
totalHeight = std::max( totalHeight, textureBrowser.height );
- GtkAdjustment *vadjustment = gtk_range_get_adjustment( GTK_RANGE( textureBrowser.m_texture_scroll ) );
+ auto vadjustment = gtk_range_get_adjustment( GTK_RANGE( textureBrowser.m_texture_scroll ) );
gtk_adjustment_set_value(vadjustment, -TextureBrowser_getOriginY( textureBrowser ));
gtk_adjustment_set_page_size(vadjustment, textureBrowser.height);
void TextureBrowser_constructTreeStoreTags(){
TextureGroups groups;
auto store = ui::TreeStore(gtk_tree_store_new( 1, G_TYPE_STRING ));
- GtkTreeModel* model = g_TextureBrowser.m_all_tags_list;
+ auto model = g_TextureBrowser.m_all_tags_list;
gtk_tree_view_set_model(g_TextureBrowser.m_treeViewTags, model );
g_object_unref( G_OBJECT( store ) );
}
-void TreeView_onRowActivated( GtkTreeView* treeview, GtkTreePath* path, GtkTreeViewColumn* col, gpointer userdata ){
+void TreeView_onRowActivated( ui::TreeView treeview, GtkTreePath* path, ui::TreeViewColumn col, gpointer userdata ){
GtkTreeIter iter;
- GtkTreeModel* model = gtk_tree_view_get_model(treeview );
+ auto model = gtk_tree_view_get_model(treeview );
if ( gtk_tree_model_get_iter( model, &iter, path ) ) {
gchar dirName[1024];
gboolean TreeViewTags_onButtonPressed( ui::TreeView treeview, GdkEventButton *event ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
GtkTreePath *path;
- GtkTreeSelection* selection = gtk_tree_view_get_selection(treeview );
+ auto selection = gtk_tree_view_get_selection(treeview );
if ( gtk_tree_view_get_path_at_pos(treeview, event->x, event->y, &path, NULL, NULL, NULL ) ) {
gtk_tree_selection_unselect_all( selection );
return textures_menu_item;
}
-gboolean TextureBrowser_tagMoveHelper( GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, GSList** selected ){
+gboolean TextureBrowser_tagMoveHelper( ui::TreeModel model, ui::TreePath path, GtkTreeIter* iter, GSList** selected ){
g_assert( selected != NULL );
- GtkTreeRowReference* rowref = gtk_tree_row_reference_new( model, path );
+ auto rowref = gtk_tree_row_reference_new( model, path );
*selected = g_slist_append( *selected, rowref );
return FALSE;
GSList* node;
gchar* tag_assigned;
- GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree );
+ auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree );
gtk_tree_selection_selected_foreach( selection, (GtkTreeSelectionForeachFunc)TextureBrowser_tagMoveHelper, &selected );
if ( selected != NULL ) {
for ( node = selected; node != NULL; node = node->next )
{
- GtkTreePath* path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data );
+ auto path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data );
if ( path ) {
GtkTreeIter iter;
GSList* node;
gchar* tag;
- GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_assigned_tree );
+ auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_assigned_tree );
gtk_tree_selection_selected_foreach( selection, (GtkTreeSelectionForeachFunc)TextureBrowser_tagMoveHelper, &selected );
if ( selected != NULL ) {
for ( node = selected; node != NULL; node = node->next )
{
- GtkTreePath* path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data );
+ auto path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data );
if ( path ) {
GtkTreeIter iter;
char buffer[256];
char tags_searched[256];
- GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags );
+ auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags );
gtk_tree_selection_selected_foreach( selection, (GtkTreeSelectionForeachFunc)TextureBrowser_tagMoveHelper, &selected );
for ( node = selected; node != NULL; node = node->next )
{
- GtkTreePath* path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data );
+ auto path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data );
if ( path ) {
GtkTreeIter iter;
if ( g_TextureBrowser.m_tags ) {
{ // fill tag GtkListStore
g_TextureBrowser.m_all_tags_list = ui::ListStore(gtk_list_store_new( N_COLUMNS, G_TYPE_STRING ));
- GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_all_tags_list );
+ auto sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_all_tags_list );
gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING );
TagBuilder.GetAllTags( g_TextureBrowser.m_all_tags );
TextureBrowser_createTreeViewTags();
- GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags );
+ auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tags ), g_TextureBrowser.m_treeViewTags );
g_TextureBrowser.m_assigned_store = ui::ListStore(gtk_list_store_new( N_COLUMNS, G_TYPE_STRING ));
- GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_assigned_store );
+ auto sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_assigned_store );
gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING );
auto renderer = ui::CellRendererText(ui::New);
g_TextureBrowser.m_assigned_tree.connect( "row-activated", (GCallback) TextureBrowser_removeTags, NULL );
gtk_tree_view_set_headers_visible(g_TextureBrowser.m_assigned_tree, FALSE );
- GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_assigned_tree );
+ auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_assigned_tree );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
- GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} );
+ auto column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} );
gtk_tree_view_append_column(g_TextureBrowser.m_assigned_tree, column );
g_TextureBrowser.m_assigned_tree.show();
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
g_TextureBrowser.m_available_store = ui::ListStore(gtk_list_store_new( N_COLUMNS, G_TYPE_STRING ));
- GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store );
+ auto sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store );
gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING );
auto renderer = ui::CellRendererText(ui::New);
g_TextureBrowser.m_available_tree.connect( "row-activated", (GCallback) TextureBrowser_assignTags, NULL );
gtk_tree_view_set_headers_visible(g_TextureBrowser.m_available_tree, FALSE );
- GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree );
+ auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
- GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} );
+ auto column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} );
gtk_tree_view_append_column(g_TextureBrowser.m_available_tree, column );
g_TextureBrowser.m_available_tree.show();
TextureBrowser_queueDraw( textureBrowser );
}
-void TextureBrowser_selectionHelper( GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, GSList** selected ){
+void TextureBrowser_selectionHelper( ui::TreeModel model, ui::TreePath path, GtkTreeIter* iter, GSList** selected ){
g_assert( selected != NULL );
gchar* name;
gtk_list_store_set( g_TextureBrowser.m_available_store, &iter, TAG_COLUMN, tag.c_str(), -1 );
// Select the currently added tag in the available list
- GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree );
+ auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree );
gtk_tree_selection_select_iter( selection, &iter );
g_TextureBrowser.m_all_tags_list.append(TAG_COLUMN, tag.c_str());
GSList* selected = NULL;
- GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags );
+ auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags );
gtk_tree_selection_selected_foreach( selection, GtkTreeSelectionForeachFunc( TextureBrowser_selectionHelper ), &selected );
if ( g_slist_length( selected ) == 1 ) { // we only rename a single tag
void TextureBrowser_deleteTag(){
GSList* selected = NULL;
- GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags );
+ auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags );
gtk_tree_selection_selected_foreach( selection, GtkTreeSelectionForeachFunc( TextureBrowser_selectionHelper ), &selected );
if ( g_slist_length( selected ) == 1 ) { // we only delete a single tag
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
GlobalShaderSystem().refresh();
UpdateAllWindows();
- GtkTreeSelection* selection = gtk_tree_view_get_selection(GlobalTextureBrowser().m_treeViewTree);
+ auto selection = gtk_tree_view_get_selection(GlobalTextureBrowser().m_treeViewTree);
GtkTreeModel* model = NULL;
GtkTreeIter iter;
if ( gtk_tree_selection_get_selected (selection, &model, &iter) )
#include "gtkutil/gtktreestore.h"
template<typename value_type>
-inline void gtk_tree_model_get_pointer( GtkTreeModel* model, GtkTreeIter* iter, gint column, value_type** pointer ){
+inline void gtk_tree_model_get_pointer( ui::TreeModel model, GtkTreeIter* iter, gint column, value_type** pointer ){
GValue value = GValue_default();
gtk_tree_model_get_value( model, iter, column, &value );
*pointer = (value_type*)g_value_get_pointer( &value );
return GTK_TREE_MODEL_ITERS_PERSIST;
}
-static gint graph_tree_model_get_n_columns( GtkTreeModel* tree_model ){
+static gint graph_tree_model_get_n_columns( ui::TreeModel tree_model ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
GraphTreeModel* graph_tree_model = (GraphTreeModel*) tree_model;
ASSERT_MESSAGE( iter->user_data != 0, "tree model error" );
}
-static GType graph_tree_model_get_column_type( GtkTreeModel *tree_model, gint index ){
+static GType graph_tree_model_get_column_type( ui::TreeModel tree_model, gint index ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
GraphTreeModel *graph_tree_model = (GraphTreeModel *) tree_model;
return G_TYPE_POINTER;
}
-static gboolean graph_tree_model_get_iter( GtkTreeModel* tree_model, GtkTreeIter* iter, GtkTreePath* path ){
+static gboolean graph_tree_model_get_iter( ui::TreeModel tree_model, GtkTreeIter* iter, ui::TreePath path ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
gint* indices = gtk_tree_path_get_indices( path );
gint depth = gtk_tree_path_get_depth( path );
return TRUE;
}
-static GtkTreePath* graph_tree_model_get_path( GtkTreeModel* tree_model, GtkTreeIter* iter ){
+static ui::TreePath graph_tree_model_get_path( ui::TreeModel tree_model, GtkTreeIter* iter ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph;
graph_type::iterator i = graph_iterator_read_tree_iter( iter );
- GtkTreePath* path = ui::TreePath();
+ auto path = ui::TreePath();
for ( std::size_t depth = ( *i ).first.get().size(); depth != 0; --depth )
{
}
-static void graph_tree_model_get_value( GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value ){
+static void graph_tree_model_get_value( ui::TreeModel tree_model, GtkTreeIter *iter, gint column, GValue *value ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
ASSERT_MESSAGE( column == 0 || column == 1, "tree model error" );
}
}
-static gboolean graph_tree_model_iter_next( GtkTreeModel *tree_model, GtkTreeIter *iter ){
+static gboolean graph_tree_model_iter_next( ui::TreeModel tree_model, GtkTreeIter *iter ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph;
graph_type::iterator i = graph_iterator_read_tree_iter( iter );
return TRUE;
}
-static gboolean graph_tree_model_iter_children( GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent ){
+static gboolean graph_tree_model_iter_children( ui::TreeModel tree_model, GtkTreeIter *iter, GtkTreeIter *parent ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph;
graph_type::iterator i = ( parent == 0 ) ? graph.begin() : graph_iterator_read_tree_iter( parent );
return FALSE;
}
-static gboolean graph_tree_model_iter_has_child( GtkTreeModel *tree_model, GtkTreeIter *iter ){
+static gboolean graph_tree_model_iter_has_child( ui::TreeModel tree_model, GtkTreeIter *iter ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph;
graph_type::iterator i = graph_iterator_read_tree_iter( iter );
return ++i != graph.end() && ( *i ).first.get().size() == depth;
}
-static gint graph_tree_model_iter_n_children( GtkTreeModel *tree_model, GtkTreeIter *parent ){
+static gint graph_tree_model_iter_n_children( ui::TreeModel tree_model, GtkTreeIter *parent ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph;
graph_type::iterator i = ( parent == 0 ) ? graph.begin() : graph_iterator_read_tree_iter( parent );
return count;
}
-static gboolean graph_tree_model_iter_nth_child( GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n ){
+static gboolean graph_tree_model_iter_nth_child( ui::TreeModel tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph;
graph_type::iterator i = ( parent == 0 ) ? graph.begin() : graph_iterator_read_tree_iter( parent );
return FALSE;
}
-static gboolean graph_tree_model_iter_parent( GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child ){
+static gboolean graph_tree_model_iter_parent( ui::TreeModel tree_model, GtkTreeIter *iter, GtkTreeIter *child ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph;
graph_type::iterator i = graph_iterator_read_tree_iter( child );
iface->iter_parent = graph_tree_model_iter_parent;
}
-static gboolean graph_tree_model_row_draggable( GtkTreeDragSource *drag_source, GtkTreePath *path ){
+static gboolean graph_tree_model_row_draggable( GtkTreeDragSource *drag_source, ui::TreePath path ){
#if GDEF_DEBUG
gint depth = gtk_tree_path_get_depth( path );
#endif
return gtk_tree_path_get_depth( path ) > 1;
}
-static gboolean graph_tree_model_drag_data_delete( GtkTreeDragSource *drag_source, GtkTreePath *path ){
+static gboolean graph_tree_model_drag_data_delete( GtkTreeDragSource *drag_source, ui::TreePath path ){
GtkTreeIter iter;
if ( gtk_tree_model_get_iter( drag_source, &iter, path ) ) {
}
}
-static gboolean graph_tree_model_drag_data_get( GtkTreeDragSource *drag_source, GtkTreePath *path, GtkSelectionData *selection_data ){
+static gboolean graph_tree_model_drag_data_get( GtkTreeDragSource *drag_source, ui::TreePath path, GtkSelectionData *selection_data ){
if ( gtk_tree_set_row_drag_data( selection_data, drag_source, path ) ) {
return TRUE;
}
iface->drag_data_get = graph_tree_model_drag_data_get;
}
-static gboolean graph_tree_model_drag_data_received( GtkTreeDragDest *drag_dest, GtkTreePath *dest, GtkSelectionData *selection_data ){
- GtkTreeModel *tree_model = drag_dest;
+static gboolean graph_tree_model_drag_data_received( GtkTreeDragDest *drag_dest, ui::TreePath dest, GtkSelectionData *selection_data ){
+ auto tree_model = drag_dest;
GtkTreeModel *src_model = 0;
GtkTreePath *src_path = 0;
return FALSE;
}
-static gboolean graph_tree_model_row_drop_possible( GtkTreeDragDest *drag_dest, GtkTreePath *dest_path, GtkSelectionData *selection_data ){
+static gboolean graph_tree_model_row_drop_possible( GtkTreeDragDest *drag_dest, ui::TreePath dest_path, GtkSelectionData *selection_data ){
gboolean retval = FALSE;
GtkTreeModel *src_model = 0;
if ( !gtk_tree_path_is_ancestor( src_path, dest_path ) ) {
/* Can't drop if dest_path's parent doesn't exist */
if ( gtk_tree_path_get_depth( dest_path ) > 1 ) {
- GtkTreePath* tmp = gtk_tree_path_copy( dest_path );
+ auto tmp = gtk_tree_path_copy( dest_path );
gtk_tree_path_up( tmp );
GtkTreeIter iter;
GtkTreeIter iter;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* tree_path = graph_tree_model_get_path( model, &iter );
+ auto tree_path = graph_tree_model_get_path( model, &iter );
gint depth = gtk_tree_path_get_depth( tree_path );
gint* indices = gtk_tree_path_get_indices( tree_path );
GtkTreeIter iter;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* tree_path = graph_tree_model_get_path( model, &iter );
+ auto tree_path = graph_tree_model_get_path( model, &iter );
gtk_tree_model_row_deleted( model, tree_path );
GObjectClass parent_class;
};
-static GtkTreeModelFlags graph_tree_model_get_flags( GtkTreeModel* tree_model ){
+static GtkTreeModelFlags graph_tree_model_get_flags( ui::TreeModel tree_model ){
return GTK_TREE_MODEL_ITERS_PERSIST;
}
-static gint graph_tree_model_get_n_columns( GtkTreeModel* tree_model ){
- ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
+static gint graph_tree_model_get_n_columns( ui::TreeModel tree_model ){
+ ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" );
//GraphTreeModel* graph_tree_model = (GraphTreeModel*) tree_model;
return 2;
ASSERT_MESSAGE( iter->user_data != 0, "tree model error" );
}
-static GType graph_tree_model_get_column_type( GtkTreeModel *tree_model, gint index ){
- ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
+static GType graph_tree_model_get_column_type( ui::TreeModel tree_model, gint index ){
+ ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" );
//GraphTreeModel *graph_tree_model = (GraphTreeModel *) tree_model;
return G_TYPE_POINTER;
}
-static gboolean graph_tree_model_get_iter( GraphTreeModel* tree_model, GtkTreeIter* iter, GtkTreePath* path ){
+static gboolean graph_tree_model_get_iter( GraphTreeModel* tree_model, GtkTreeIter* iter, ui::TreePath path ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
gint* indices = gtk_tree_path_get_indices( path );
gint depth = gtk_tree_path_get_depth( path );
return TRUE;
}
-static GtkTreePath* graph_tree_model_get_path( GraphTreeModel* tree_model, GtkTreeIter* iter ){
- ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
+static ui::TreePath graph_tree_model_get_path( GraphTreeModel *tree_model, GtkTreeIter* iter ){
+ ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" );
GraphTreeNode* graph = tree_model->m_graph;
- GtkTreePath* path = ui::TreePath(ui::New);
+ auto path = ui::TreePath(ui::New);
for ( GraphTreeNode* node = ( *graph_iterator_read_tree_iter( iter ) ).second; node != graph; node = node->m_parent )
{
}
-static void graph_tree_model_get_value( GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value ){
- ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
+static void graph_tree_model_get_value( ui::TreeModel tree_model, GtkTreeIter *iter, gint column, GValue *value ){
+ ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" );
ASSERT_MESSAGE( column == 0 || column == 1, "tree model error" );
GraphTreeNode::iterator i = graph_iterator_read_tree_iter( iter );
}
}
-static gboolean graph_tree_model_iter_next( GtkTreeModel *tree_model, GtkTreeIter *iter ){
- ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
+static gboolean graph_tree_model_iter_next( ui::TreeModel tree_model, GtkTreeIter *iter ){
+ ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" );
GraphTreeNode::iterator i = graph_iterator_read_tree_iter( iter );
GraphTreeNode& parent = *( *i ).second->m_parent;
return FALSE;
}
-static gboolean graph_tree_model_iter_has_child( GtkTreeModel *tree_model, GtkTreeIter *iter ){
- ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
+static gboolean graph_tree_model_iter_has_child( ui::TreeModel tree_model, GtkTreeIter *iter ){
+ ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" );
GraphTreeNode& node = *( *graph_iterator_read_tree_iter( iter ) ).second;
return !node.empty();
}
}
static void graph_tree_model_tree_model_init( GtkTreeModelIface *iface ){
- iface->get_flags = graph_tree_model_get_flags;
- iface->get_n_columns = graph_tree_model_get_n_columns;
- iface->get_column_type = graph_tree_model_get_column_type;
+ iface->get_flags = reinterpret_cast<GtkTreeModelFlags (*)(GtkTreeModel *)>(graph_tree_model_get_flags);
+ iface->get_n_columns = reinterpret_cast<gint (*)(GtkTreeModel *)>(graph_tree_model_get_n_columns);
+ iface->get_column_type = reinterpret_cast<GType (*)(GtkTreeModel *, gint)>(graph_tree_model_get_column_type);
iface->get_iter = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreePath *)>(graph_tree_model_get_iter);
iface->get_path = reinterpret_cast<GtkTreePath *(*)(GtkTreeModel *, GtkTreeIter *)>(graph_tree_model_get_path);
- iface->get_value = graph_tree_model_get_value;
- iface->iter_next = graph_tree_model_iter_next;
+ iface->get_value = reinterpret_cast<void (*)(GtkTreeModel *, GtkTreeIter *, gint, GValue *)>(graph_tree_model_get_value);
+ iface->iter_next = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *)>(graph_tree_model_iter_next);
iface->iter_children = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *)>(graph_tree_model_iter_children);
- iface->iter_has_child = graph_tree_model_iter_has_child;
+ iface->iter_has_child = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *)>(graph_tree_model_iter_has_child);
iface->iter_n_children = reinterpret_cast<gint (*)(GtkTreeModel *, GtkTreeIter *)>(graph_tree_model_iter_n_children);
iface->iter_nth_child = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *, gint)>(graph_tree_model_iter_nth_child);
iface->iter_parent = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *)>(graph_tree_model_iter_parent);
GtkTreeIter iter;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter );
+ auto tree_path = graph_tree_model_get_path(model, &iter );
gtk_tree_model_row_changed( GTK_TREE_MODEL( model ), tree_path, &iter );
GtkTreeIter iter;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter );
+ auto tree_path = graph_tree_model_get_path(model, &iter );
gtk_tree_model_row_inserted( GTK_TREE_MODEL( model ), tree_path, &iter );
GtkTreeIter iter;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter );
+ auto tree_path = graph_tree_model_get_path(model, &iter );
gtk_tree_model_row_deleted( GTK_TREE_MODEL( model ), tree_path );
rootpath.pop();
rootpath.pop();
- GtkTreeModel* model = graph_tree_model_new( &graph );
+ auto model = graph_tree_model_new( &graph );
{
gint n_columns = gtk_tree_model_get_n_columns( model );
{
GtkTreeIter iter;
- GtkTreePath* path = ui::TreePath( "0" );
+ auto path = ui::TreePath( "0" );
gtk_tree_model_get_iter( model, &iter, path );
gtk_tree_path_free( path );
{
GtkTreeIter iter;
- GtkTreePath* path = ui::TreePath( "1" );
+ auto path = ui::TreePath( "1" );
gtk_tree_model_get_iter( model, &iter, path );
gtk_tree_path_free( path );
++i;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
+ auto path = gtk_tree_model_get_path( model, &iter );
gint depth = gtk_tree_path_get_depth( path );
gint* indices = gtk_tree_path_get_indices( path );
++i;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
+ auto path = gtk_tree_model_get_path( model, &iter );
gint depth = gtk_tree_path_get_depth( path );
gint* indices = gtk_tree_path_get_indices( path );