#include "accelerator.h"
#include "button.h"
-#include "closure.h"
-#include "pointer.h"
+#include "image.h"
-void toolbar_append( GtkToolbar* toolbar, GtkButton* button, const char* description ){
- gtk_widget_show( GTK_WIDGET( button ) );
- gtk_button_set_relief( button, GTK_RELIEF_NONE );
- 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 ), "", description, "", 0, 0, 0 );
+void toolbar_append( ui::Toolbar toolbar, ui::ToolItem button, const char* description ){
+ gtk_widget_show_all(button);
+ gtk_widget_set_tooltip_text(button, description);
+ toolbar.add(button);
}
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback ){
- GtkButton* button = GTK_BUTTON( gtk_button_new() );
- button_set_icon( button, icon );
- button_connect_callback( button, callback );
- toolbar_append( toolbar, button, description );
++ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon ){
++ auto button = ui::ToolButton::from(gtk_tool_button_new(new_local_image(icon), nullptr));
++ toolbar_append(toolbar, button, description);
+ return button;
+ }
+
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback ){
- GtkToggleButton* button = GTK_TOGGLE_BUTTON( gtk_toggle_button_new() );
- button_set_icon( GTK_BUTTON( button ), icon );
- toggle_button_connect_callback( button, callback );
- toolbar_append( toolbar, GTK_BUTTON( button ), description );
+ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon, const Callback<void()>& callback ){
+ auto button = ui::ToolButton::from(gtk_tool_button_new(new_local_image(icon), nullptr));
+ button_connect_callback(button, callback);
+ toolbar_append(toolbar, button, description);
return button;
}
class Command;
class Toggle;
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback );
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Command& command );
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback );
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Toggle& toggle );
++ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon );
+ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon, const Callback<void()>& callback );
+ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon, const Command& command );
+ui::ToggleToolButton toolbar_append_toggle_button( ui::Toolbar toolbar, const char* description, const char* icon, const Callback<void()>& callback );
+ui::ToggleToolButton toolbar_append_toggle_button( ui::Toolbar toolbar, const char* description, const char* icon, const Toggle& toggle );
#endif
#include "generic/callback.h"
#include "warnings.h"
#include "debugging/debugging.h"
+#include "property.h"
+ inline bool widget_is_visible( GtkWidget* widget ){
+ return GTK_WIDGET_VISIBLE( widget ) != FALSE;
+ }
+
+ inline void widget_set_visible( GtkWidget* widget, bool show ){
+ if ( show ) {
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( widget ), "glwidget" ) );
+ if ( glwidget ){
+ //if ( widget_is_visible( glwidget ) )
+ //globalOutputStream() << "glwidget have been already visible :0\n"; /* is not hidden aswell, according to this */
+ gtk_widget_hide( glwidget );
+ gtk_widget_show( glwidget );
+ }
+ gtk_widget_show( widget );
+ }
+ else
+ {
+ gtk_widget_hide( widget );
+ }
+ }
+
+class ToggleItem {
+ Callback<void(const Callback<void(bool)> &)> m_exportCallback;
+ typedef std::list<Callback<void(bool)>> ImportCallbacks;
+ ImportCallbacks m_importCallbacks;
+public:
+ ToggleItem(const Callback<void(const Callback<void(bool)> &)> &exportCallback) : m_exportCallback(exportCallback)
+ {
+ }
+
+ void update()
+ {
+ for (ImportCallbacks::iterator i = m_importCallbacks.begin(); i != m_importCallbacks.end(); ++i) {
+ m_exportCallback(*i);
+ }
+ }
+
+ void addCallback(const Callback<void(bool)> &callback)
+ {
+ m_importCallbacks.push_back(callback);
+ m_exportCallback(callback);
+ }
+
+ typedef MemberCaller<ToggleItem, void(const Callback<void(bool)> &), &ToggleItem::addCallback> AddCallbackCaller;
+};
-inline void widget_toggle_visible( GtkWidget* widget ){
- widget_set_visible( widget, !widget_is_visible( widget ) );
-}
+class ToggleShown {
+ bool m_shownDeferred;
+
+ ToggleShown(const ToggleShown &other); // NOT COPYABLE
+ ToggleShown &operator=(const ToggleShown &other); // NOT ASSIGNABLE
+
+ static gboolean notify_visible(ui::Widget widget, gpointer dummy, ToggleShown *self);
+
+ static gboolean destroy(ui::Widget widget, ToggleShown *self);
-class ToggleItem
-{
-BoolExportCallback m_exportCallback;
-typedef std::list<BoolImportCallback> ImportCallbacks;
-ImportCallbacks m_importCallbacks;
public:
-ToggleItem( const BoolExportCallback& exportCallback ) : m_exportCallback( exportCallback ){
-}
+ ui::Widget m_widget;
+ ToggleItem m_item;
-void update(){
- for ( ImportCallbacks::iterator i = m_importCallbacks.begin(); i != m_importCallbacks.end(); ++i )
- {
- m_exportCallback( *i );
- }
-}
+ ToggleShown(bool shown)
+ : m_shownDeferred(shown), m_widget(ui::null), m_item(ActiveCaller(*this))
+ {
+ }
-void addCallback( const BoolImportCallback& callback ){
- m_importCallbacks.push_back( callback );
- m_exportCallback( callback );
-}
-typedef MemberCaller1<ToggleItem, const BoolImportCallback&, &ToggleItem::addCallback> AddCallbackCaller;
-};
+ void update();
-class ToggleShown
-{
-bool m_shownDeferred;
+ bool active() const;
-ToggleShown( const ToggleShown& other ); // NOT COPYABLE
-ToggleShown& operator=( const ToggleShown& other ); // NOT ASSIGNABLE
+ void exportActive(const Callback<void(bool)> &importCallback);
-static gboolean notify_visible( GtkWidget* widget, gpointer dummy, ToggleShown* self ){
- self->update();
- return FALSE;
-}
-static gboolean destroy( GtkWidget* widget, ToggleShown* self ){
- self->m_shownDeferred = GTK_WIDGET_VISIBLE( self->m_widget ) != FALSE;
- self->m_widget = 0;
- return FALSE;
-}
-public:
-GtkWidget* m_widget;
-ToggleItem m_item;
+ typedef MemberCaller<ToggleShown, void(const Callback<void(bool)> &), &ToggleShown::exportActive> ActiveCaller;
-ToggleShown( bool shown )
- : m_shownDeferred( shown ), m_widget( 0 ), m_item( ActiveCaller( *this ) ){
-}
-void update(){
- m_item.update();
-}
-bool active() const {
- if ( m_widget == 0 ) {
- return m_shownDeferred;
- }
- else
- {
- return GTK_WIDGET_VISIBLE( m_widget ) != FALSE;
- }
-}
-void exportActive( const BoolImportCallback& importCallback ){
- importCallback( active() );
-}
-typedef MemberCaller1<ToggleShown, const BoolImportCallback&, &ToggleShown::exportActive> ActiveCaller;
-void set( bool shown ){
- if ( m_widget == 0 ) {
- m_shownDeferred = shown;
- }
- else
- {
- widget_set_visible( m_widget, shown );
- }
-}
-void toggle(){
- widget_toggle_visible( m_widget );
-}
-typedef MemberCaller<ToggleShown, &ToggleShown::toggle> ToggleCaller;
-void connect( GtkWidget* widget ){
- m_widget = widget;
- widget_set_visible( m_widget, m_shownDeferred );
- g_signal_connect( G_OBJECT( m_widget ), "notify::visible", G_CALLBACK( notify_visible ), this );
- g_signal_connect( G_OBJECT( m_widget ), "destroy", G_CALLBACK( destroy ), this );
- update();
-}
+ void set(bool shown);
+
+ void toggle();
+
+ typedef MemberCaller<ToggleShown, void(), &ToggleShown::toggle> ToggleCaller;
+
+ void connect(ui::Widget widget);
};
#include "pointer.h"
#include "accelerator.h"
-inline void CHECK_RESTORE( GtkWidget* w ){
+inline void CHECK_RESTORE( ui::Widget w ){
if ( gpointer_to_int( g_object_get_data( G_OBJECT( w ), "was_mapped" ) ) != 0 ) {
- gtk_widget_show( w );
+ w.show();
+ /* workaround for gtk 2.24 issue: not displayed glwidget after min/restore */
+ GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( w ), "glwidget" ) );
+ if ( glwidget ){
+ gtk_widget_hide( glwidget );
+ gtk_widget_show( glwidget );
+ }
}
}
gtk_window_set_transient_for( window, parent );
connect_floating_window_destroy_present( window, parent );
g_object_set_data( G_OBJECT( window ), "floating_handler", gint_to_pointer( connect_floating( parent, window ) ) );
- g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy_disconnect_floating ), parent );
+ window.connect( "destroy", G_CALLBACK( destroy_disconnect_floating ), parent );
+ /*
+ //gtk_window_set_type_hint (window,GDK_WINDOW_TYPE_HINT_UTILITY);
+ //gtk_window_set_type_hint (window,GDK_WINDOW_TYPE_HINT_DIALOG);
+ gtk_window_set_keep_above ( window, TRUE );
+ GtkWidget* widget = GTK_WIDGET( window );
+ gtk_widget_realize ( widget );
+ GdkWindow* gdk_window = gtk_widget_get_window( widget );
+ //gdk_window_set_decorations ( gdk_window, (GdkWMDecoration)(GDK_DECOR_BORDER|GDK_DECOR_RESIZEH|GDK_DECOR_TITLE|GDK_DECOR_MENU|GDK_DECOR_MINIMIZE|GDK_DECOR_MAXIMIZE) );
+ //gdk_window_set_functions ( gdk_window, (GdkWMFunction)( GDK_FUNC_RESIZE|GDK_FUNC_MOVE|GDK_FUNC_MINIMIZE|GDK_FUNC_MAXIMIZE|GDK_FUNC_CLOSE ) );
+ //gdk_window_set_decorations ( gdk_window, (GdkWMDecoration)( GDK_DECOR_ALL ) );
+ //gdk_window_set_functions ( gdk_window, (GdkWMFunction)( GDK_FUNC_ALL ) );
+ //gdk_window_set_type_hint ( gdk_window, GDK_WINDOW_TYPE_HINT_DIALOG );
+ //gdk_window_set_type_hint ( gdk_window, GDK_WINDOW_TYPE_HINT_UTILITY );
+ //gdk_window_set_type_hint ( gdk_window, GDK_WINDOW_TYPE_HINT_NORMAL );
+ gdk_window_set_skip_taskbar_hint ( gdk_window, TRUE );
+ gdk_window_set_skip_pager_hint ( gdk_window, TRUE );
+ */
}
return window;
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
m_position_tracker.sync( m_window );
- gtk_widget_show( GTK_WIDGET( m_window ) );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ GtkWidget* glwidget = GTK_WIDGET( g_object_get_data( G_OBJECT( m_window ), "glwidget" ) );
+ if ( glwidget ){
+ //if ( widget_is_visible( glwidget ) )
+ //globalOutputStream() << "glwidget have been already visible :0\n"; /* is not hidden aswell, according to this */
+ gtk_widget_hide( glwidget );
+ gtk_widget_show( glwidget );
+ }
+ m_window.show();
}
void Hide(){
- gtk_widget_hide( GTK_WIDGET( m_window ) );
+ m_window.hide();
}
WindowPositionTracker m_position_tracker;
#include "gtkutil/dialog.h"
#include "gtkutil/filechooser.h"
#include "gtkutil/menu.h"
--#include "gtkutil/toolbar.h"
#include "commands.h"
#if !defined( INCLUDED_GTKMISC_H )
#define INCLUDED_GTKMISC_H
-#include <gtk/gtkmain.h>
-
-inline void process_gui(){
- while ( gtk_events_pending() )
- {
- gtk_main_iteration();
- }
-}
+#include <uilib/uilib.h>
++#include "gtkutil/toolbar.h"
void command_connect_accelerator( const char* commandName );
void command_disconnect_accelerator( const char* commandName );
GlobalCamera_setCamWnd( *m_pCamWnd );
{
- GtkFrame* frame = create_framed_widget( CamWnd_getWidget( *m_pCamWnd ) );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( frame ) );
+ auto frame = create_framed_widget( CamWnd_getWidget( *m_pCamWnd ) );
+ window.add(frame);
}
CamWnd_setParent( *m_pCamWnd, window );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( window ), "glwidget", CamWnd_getWidget( *m_pCamWnd ) );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
{
- GtkFrame* frame = create_framed_widget( m_pXYWnd->GetWidget() );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( frame ) );
+ auto frame = create_framed_widget( m_pXYWnd->GetWidget() );
+ window.add(frame);
}
XY_Top_Shown_Construct( window );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( window ), "glwidget", m_pXYWnd->GetWidget() );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
}
XZ_Front_Shown_Construct( window );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( window ), "glwidget", m_pXZWnd->GetWidget() );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
}
YZ_Side_Shown_Construct( window );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( window ), "glwidget", m_pYZWnd->GetWidget() );
- 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() );
+ auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
+ g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
+
}
GroupDialog_show();
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 );
+ auto split = create_split_views( camera, yz, xy, xz );
+ vbox.pack_start( split, TRUE, TRUE, 0 );
{
- GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
- g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
+ auto frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
+ g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
+ /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+ g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
}
}
void realise(){
m_realiseCallbacks();
/* texturebrowser tree update on vfs restart */
- TextureBrowser_constructTreeStore();
+ // TextureBrowser_constructTreeStore();
}
+
void unrealise(){
}
+
void insert( const SignalHandler& handler ){
m_realiseCallbacks.connectLast( handler );
}
return textures_menu_item;
}
-GtkMenuItem* TextureBrowser_constructToolsMenu( GtkMenu* menu ){
- GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "_Tools" );
+ void Popup_View_Menu( GtkWidget *widget, GtkMenu *menu ){
+ gtk_menu_popup( menu, NULL, NULL, NULL, NULL, 1, gtk_get_current_event_time() );
+ }
+
+ui::MenuItem TextureBrowser_constructToolsMenu( ui::Menu menu ){
+ ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_Tools" ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
g_TextureBrowser.m_parent = toplevel;
- GtkWidget* table = gtk_table_new( 3, 3, FALSE );
- GtkWidget* frame_table = NULL;
- GtkWidget* vbox = gtk_vbox_new( FALSE, 0 );
- gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0 );
- gtk_widget_show( vbox );
+ auto table = ui::Table(3, 3, FALSE);
+ auto vbox = ui::VBox(FALSE, 0);
+ table.attach(vbox, {0, 1, 1, 3}, {GTK_FILL, GTK_FILL});
+ vbox.show();
- ui::Widget menu_bar{ui::null};
- //GtkWidget* menu_bar;
- GtkToolbar* toolbar;
++ // ui::Widget menu_bar{ui::null};
++ auto toolbar = ui::Toolbar::from( gtk_toolbar_new() );
{ // menu bar
- menu_bar = ui::Widget::from(gtk_menu_bar_new());
- //menu_bar = gtk_menu_bar_new();
- GtkWidget* menu_view = gtk_menu_new();
- //GtkWidget* view_item = (GtkWidget*)
- 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 );
++ // menu_bar = ui::Widget::from(gtk_menu_bar_new());
+ auto menu_view = ui::Menu(ui::New);
- auto view_item = TextureBrowser_constructViewMenu( menu_view );
- gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view );
- gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), view_item );
++ // auto view_item = TextureBrowser_constructViewMenu( menu_view );
++ TextureBrowser_constructViewMenu( menu_view );
++ // gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view );
++ // gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), view_item );
-
- toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
+ //gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( toolbar ), 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0 );
+ gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( toolbar ), FALSE, FALSE, 0 );
+
+ //view menu button
- GtkButton* button = GTK_BUTTON( gtk_button_new() );
- button_set_icon( button, "texbro_view.png" );
- 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 ), "", "View", "", 0, 0, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( Popup_View_Menu ), menu_view );
-
-
-
- button = toolbar_append_button( toolbar, "Find / Replace...", "texbro_gtk-find-and-replace.png", "FindReplaceTextures" );
- gtk_widget_set_size_request( GTK_WIDGET( button ), 22, 22 );
-
-
- button = toolbar_append_button( toolbar, "Flush & Reload Shaders", "texbro_refresh.png", "RefreshShaders" );
- gtk_widget_set_size_request( GTK_WIDGET( button ), 22, 22 );
- gtk_widget_show( GTK_WIDGET( toolbar ) );
++ {
++ auto button = toolbar_append_button( toolbar, "View", "texbro_view.png" );
++ button.dimensions( 22, 22 );
++ button.connect( "clicked", G_CALLBACK( Popup_View_Menu ), menu_view );
++ }
++ {
++ auto button = toolbar_append_button( toolbar, "Find / Replace...", "texbro_gtk-find-and-replace.png", "FindReplaceTextures" );
++ button.dimensions( 22, 22 );
++ }
++ {
++ auto button = toolbar_append_button( toolbar, "Flush & Reload Shaders", "texbro_refresh.png", "RefreshShaders" );
++ button.dimensions( 22, 22 );
++ }
++ toolbar.show();
+
+ /*
- GtkWidget* menu_tools = gtk_menu_new();
- GtkWidget* tools_item = (GtkWidget*)TextureBrowser_constructToolsMenu( GTK_MENU( menu_tools ) );
+ auto menu_tools = ui::Menu(ui::New);
+ auto tools_item = TextureBrowser_constructToolsMenu( 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_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tools_item );
-
- table.attach(menu_bar, {0, 3, 0, 1}, {GTK_FILL, GTK_SHRINK});
- menu_bar.show();
+ */
- //gtk_table_attach( GTK_TABLE( table ), menu_bar, 0, 3, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0 );
- //gtk_widget_show( menu_bar );
++ // table.attach(menu_bar, {0, 3, 0, 1}, {GTK_FILL, GTK_SHRINK});
++ // menu_bar.show();
}
{ // Texture TreeView
- g_TextureBrowser.m_scr_win_tree = gtk_scrolled_window_new( NULL, NULL );
+ g_TextureBrowser.m_scr_win_tree = ui::ScrolledWindow(ui::New);
gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tree ), 0 );
// vertical only scrolling for treeview
TextureBrowser_buildTagList();
}
{ // tag menu bar
- GtkWidget* menu_tags = gtk_menu_new();
- //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 menu_tags = ui::Menu(ui::New);
- auto tags_item = 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 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 );
}
{ // 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
else{
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
GlobalShaderSystem().refresh();
+ /* texturebrowser tree update on vfs restart */
+ TextureBrowser_constructTreeStore();
UpdateAllWindows();
}
-
}
void TextureBrowser_ToggleShowShaders(){
void TextureBrowser_Destroy(){
GlobalShaderSystem().detach( g_ShadersObserver );
- Textures_setModeChangedNotify( Callback() );
+ Textures_setModeChangedNotify( Callback<void()>() );
}
-GtkWidget* TextureBrowser_getGLWidget(){
+
++ui::Widget TextureBrowser_getGLWidget(){
+ return GlobalTextureBrowser().m_gl_widget;
+ }
void TextureBrowser_addActiveShadersChangedCallback( const SignalHandler& handler );
void TextureBrowser_addShadersRealiseCallback( const SignalHandler& handler );
-GtkWidget* TextureBrowser_getGLWidget();
+void TextureBrowser_RefreshShaders();
+
++ui::Widget TextureBrowser_getGLWidget();
+
#endif