TextureBrowser_createTreeViewTree();
- gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tree ), g_TextureBrowser.m_treeViewTree );
- //gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tree ), GTK_WIDGET( g_TextureBrowser.m_treeViewTree ) );
++ //gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tree ), g_TextureBrowser.m_treeViewTree );
+ gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tree ), GTK_WIDGET( g_TextureBrowser.m_treeViewTree ) );
- gtk_widget_show( GTK_WIDGET( g_TextureBrowser.m_treeViewTree ) );
+ g_TextureBrowser.m_treeViewTree.show();
}
{ // gl_widget scrollbar
- GtkWidget* w = 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 );
+ auto w = ui::Widget::from(gtk_vscrollbar_new( ui::Adjustment( 0,0,0,1,1,0 ) ));
+ table.attach(w, {2, 3, 1, 2}, {GTK_SHRINK, GTK_FILL});
+ w.show();
g_TextureBrowser.m_texture_scroll = w;
- GtkAdjustment *vadjustment = gtk_range_get_adjustment( GTK_RANGE( g_TextureBrowser.m_texture_scroll ) );
- g_signal_connect( G_OBJECT( vadjustment ), "value_changed", G_CALLBACK( TextureBrowser_verticalScroll ), &g_TextureBrowser );
+ auto vadjustment = ui::Adjustment::from(gtk_range_get_adjustment( GTK_RANGE( g_TextureBrowser.m_texture_scroll ) ));
+ vadjustment.connect( "value_changed", G_CALLBACK( TextureBrowser_verticalScroll ), &g_TextureBrowser );
- widget_set_visible( g_TextureBrowser.m_texture_scroll, g_TextureBrowser.m_showTextureScrollbar );
+ g_TextureBrowser.m_texture_scroll.visible(g_TextureBrowser.m_showTextureScrollbar);
}
{ // gl_widget
g_TextureBrowser.m_gl_widget = glwidget_new( FALSE );
TextureBrowser_buildTagList();
}
{ // tag menu bar
- GtkWidget* menu_tags = gtk_menu_new();
+ auto menu_tags = ui::Menu(ui::New);
+ gtk_menu_set_title( GTK_MENU( menu_tags ), "Tags" );
- //GtkWidget* tags_item = (GtkWidget*)
- 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 );
-
- GtkButton* button = GTK_BUTTON( gtk_button_new() );
- //button_set_icon( button, "texbro_tags.png" );
- GtkWidget *label = gtk_label_new (">t");
- gtk_container_add (GTK_CONTAINER (button), label);
- gtk_widget_show (label);
-
- gtk_widget_show( GTK_WIDGET( button ) );
- gtk_button_set_relief( button, GTK_RELIEF_NONE );
- gtk_widget_set_size_request( GTK_WIDGET( button ), 22, 22 );
- GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS );
- GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_DEFAULT );
- gtk_toolbar_append_element( toolbar, GTK_TOOLBAR_CHILD_WIDGET, GTK_WIDGET( button ), "", "Tags", "", 0, 0, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( Popup_View_Menu ), menu_tags );
+ // auto tags_item = TextureBrowser_constructTagsMenu( menu_tags );
+ TextureBrowser_constructTagsMenu( menu_tags );
+ // gtk_menu_item_set_submenu( GTK_MENU_ITEM( tags_item ), menu_tags );
+ // gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tags_item );
+
+ auto button = toolbar_append_button( toolbar, "Tags", "texbro_tags.png" );
+ button.dimensions( 22, 22 );
+ button.connect( "clicked", G_CALLBACK( Popup_View_Menu ), menu_tags );
+
+ //to show detached menu over floating tex bro and main wnd...
+ gtk_menu_attach_to_widget( GTK_MENU( menu_tags ), GTK_WIDGET( button ), NULL );
}
{ // Tag TreeView
- g_TextureBrowser.m_scr_win_tags = gtk_scrolled_window_new( NULL, NULL );
+ g_TextureBrowser.m_scr_win_tags = ui::ScrolledWindow(ui::New);
gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tags ), 0 );
// vertical only scrolling for treeview
TextureBrowser_createTreeViewTags();
- GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( 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 );
- //gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tags ), GTK_WIDGET( g_TextureBrowser.m_treeViewTags ) );
++ //gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tags ), g_TextureBrowser.m_treeViewTags );
+ gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tags ), GTK_WIDGET( g_TextureBrowser.m_treeViewTags ) );
- gtk_widget_show( GTK_WIDGET( g_TextureBrowser.m_treeViewTags ) );
+ g_TextureBrowser.m_treeViewTags.show();
}
{ // Texture/Tag notebook
TextureBrowser_constructTagNotebook();
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 );
- g_TextureBrowser.m_assigned_store = gtk_list_store_new( N_COLUMNS, G_TYPE_STRING );
+ g_TextureBrowser.m_assigned_store = ui::ListStore::from(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 );
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText(ui::New);
- g_TextureBrowser.m_assigned_tree = 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 );
+ g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel::from(g_TextureBrowser.m_assigned_store._handle));
+ g_TextureBrowser.m_assigned_store.unref();
+ 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( GTK_TREE_VIEW( 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 = gtk_tree_view_column_new_with_attributes( "", renderer, "text", TAG_COLUMN, NULL );
- gtk_tree_view_append_column( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), column );
- gtk_widget_show( g_TextureBrowser.m_assigned_tree );
+ 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_widget_show( scrolled_win );
- //gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_WIDGET( g_TextureBrowser.m_assigned_tree ) );
- gtk_container_add( GTK_CONTAINER( scrolled_win ), GTK_WIDGET( g_TextureBrowser.m_assigned_tree ) );
+ scrolled_win.show();
- gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), g_TextureBrowser.m_assigned_tree );
++ //gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), g_TextureBrowser.m_assigned_tree );
++ gtk_container_add( GTK_CONTAINER( scrolled_win ), GTK_WIDGET( g_TextureBrowser.m_available_tree ) );
- gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
+ frame_table.attach(scrolled_win, {0, 1, 1, 3}, {GTK_FILL, GTK_FILL});
}
{ // available tag list
- GtkWidget* scrolled_win = gtk_scrolled_window_new( NULL, NULL );
+ ui::Widget scrolled_win = ui::ScrolledWindow(ui::New);
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 );
- g_TextureBrowser.m_available_store = gtk_list_store_new( N_COLUMNS, G_TYPE_STRING );
- GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store );
+ g_TextureBrowser.m_available_store = ui::ListStore::from(gtk_list_store_new( N_COLUMNS, G_TYPE_STRING ));
+ auto sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store );
gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING );
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText(ui::New);
- g_TextureBrowser.m_available_tree = 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 );
+ g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel::from(g_TextureBrowser.m_available_store._handle));
+ g_TextureBrowser.m_available_store.unref();
+ 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( GTK_TREE_VIEW( 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 = gtk_tree_view_column_new_with_attributes( "", renderer, "text", TAG_COLUMN, NULL );
- gtk_tree_view_append_column( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), column );
- gtk_widget_show( g_TextureBrowser.m_available_tree );
+ 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();
- gtk_widget_show( scrolled_win );
- //gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_WIDGET( g_TextureBrowser.m_available_tree ) );
+ scrolled_win.show();
- gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), g_TextureBrowser.m_available_tree );
++ //gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), g_TextureBrowser.m_available_tree );
+ gtk_container_add( GTK_CONTAINER( scrolled_win ), GTK_WIDGET( g_TextureBrowser.m_available_tree ) );
- gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 2, 3, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
+ frame_table.attach(scrolled_win, {2, 3, 1, 3}, {GTK_FILL, GTK_FILL});
}
{ // 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 );
- gtk_container_add( GTK_CONTAINER( m_btn_left ), m_arrow_left );
- gtk_container_add( GTK_CONTAINER( m_btn_right ), m_arrow_right );
+ auto m_btn_left = ui::Button(ui::New);
+ auto m_btn_right = ui::Button(ui::New);
+ auto m_arrow_left = ui::Widget::from(gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT ));
+ auto m_arrow_right = ui::Widget::from(gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT ));
+ m_btn_left.add(m_arrow_left);
+ m_btn_right.add(m_arrow_right);
// workaround. the size of the tag frame depends of the requested size of the arrow buttons.
- gtk_widget_set_size_request( m_arrow_left, -1, 68 );
- gtk_widget_set_size_request( m_arrow_right, -1, 68 );
+ m_arrow_left.dimensions(-1, 68);
+ m_arrow_right.dimensions(-1, 68);
- gtk_table_attach( GTK_TABLE( frame_table ), m_btn_left, 1, 2, 1, 2, GTK_SHRINK, GTK_EXPAND, 0, 0 );
- gtk_table_attach( GTK_TABLE( frame_table ), m_btn_right, 1, 2, 2, 3, GTK_SHRINK, GTK_EXPAND, 0, 0 );
+ frame_table.attach(m_btn_left, {1, 2, 1, 2}, {GTK_SHRINK, GTK_EXPAND});
+ frame_table.attach(m_btn_right, {1, 2, 2, 3}, {GTK_SHRINK, GTK_EXPAND});
- g_signal_connect( G_OBJECT( m_btn_left ), "clicked", G_CALLBACK( TextureBrowser_assignTags ), NULL );
- g_signal_connect( G_OBJECT( m_btn_right ), "clicked", G_CALLBACK( TextureBrowser_removeTags ), NULL );
+ m_btn_left.connect( "clicked", G_CALLBACK( TextureBrowser_assignTags ), NULL );
+ m_btn_right.connect( "clicked", G_CALLBACK( TextureBrowser_removeTags ), NULL );
- gtk_widget_show( m_btn_left );
- gtk_widget_show( m_btn_right );
- gtk_widget_show( m_arrow_left );
- gtk_widget_show( m_arrow_right );
+ m_btn_left.show();
+ m_btn_right.show();
+ m_arrow_left.show();
+ m_arrow_right.show();
}
{ // 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 );
+ frame_table.attach(m_lbl_assigned, {0, 1, 0, 1}, {GTK_EXPAND, GTK_SHRINK});
+ frame_table.attach(m_lbl_unassigned, {2, 3, 0, 1}, {GTK_EXPAND, GTK_SHRINK});
- gtk_widget_show( m_lbl_assigned );
- gtk_widget_show( m_lbl_unassigned );
+ m_lbl_assigned.show();
+ m_lbl_unassigned.show();
}
}
else { // no tag support, show the texture tree only