gtk_widget_show( label1 );
gtk_box_pack_start( GTK_BOX( vbox2 ), label1, FALSE, FALSE, 0 );
- scrolledwindow1 = gtk_scrolled_window_new( NULL, NULL );
+ scrolledwindow1 = ui::ScrolledWindow();
gtk_widget_set_name( scrolledwindow1, "scrolledwindow1" );
gtk_widget_show( scrolledwindow1 );
gtk_box_pack_start( GTK_BOX( vbox2 ), scrolledwindow1, TRUE, TRUE, 0 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_scrolled_window_new( NULL, NULL );
+ w = ui::ScrolledWindow();
gtk_widget_set_usize( w, 0, 150 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( w ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
#include "window.h"
#include <gtk/gtkscrolledwindow.h>
+#include <uilib/uilib.h>
#include "pointer.h"
#include "accelerator.h"
GtkScrolledWindow* create_scrolled_window( GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, int border ){
- GtkScrolledWindow* scr = GTK_SCROLLED_WINDOW( gtk_scrolled_window_new( 0, 0 ) );
+ GtkScrolledWindow* scr = ui::ScrolledWindow();
gtk_widget_show( GTK_WIDGET( scr ) );
gtk_scrolled_window_set_policy( scr, hscrollbar_policy, vscrollbar_policy );
gtk_scrolled_window_set_shadow_type( scr, GTK_SHADOW_IN );
CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label)))
{ }
+ ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr)))
+ { }
+
Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
{ }
using ui_label = struct _GtkLabel;
using ui_menuitem = struct _GtkMenuItem;
using ui_modal = struct ModalDialog;
+using ui_scrolledwindow = struct _GtkScrolledWindow;
using ui_treemodel = struct _GtkTreeModel;
using ui_treeview = struct _GtkTreeView;
using ui_typeinst = struct _GTypeInstance;
#define WRAP(name, impl, methods) \
class name : public Widget, public Convertible<name, impl> { \
public: \
- explicit name(impl *h = nullptr) : Widget(reinterpret_cast<ui_widget *>(h)) {} \
+ explicit name(impl *h) : Widget(reinterpret_cast<ui_widget *>(h)) {} \
methods \
}; \
static_assert(sizeof(name) == sizeof(Widget), "object slicing")
WRAP(MenuItem, ui_menuitem,);
+ WRAP(ScrolledWindow, ui_scrolledwindow,
+ ScrolledWindow();
+ );
+
WRAP(SpinButton, ui_widget,);
WRAP(TreeModel, ui_treemodel,);
);
WRAP(Window, ui_window,
+ Window() : Window(nullptr) {};
+
Window create_dialog_window(const char *title, void func(), void *data, int default_w = -1,
int default_h = -1);
WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" );
ui::Widget Console_constructWindow( ui::Window toplevel ){
- ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
+ ui::Widget scr = ui::ScrolledWindow();
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 );
{
// class list
- ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
+ ui::Widget scr = ui::ScrolledWindow();
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 );
}
{
- ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
+ ui::Widget scr = ui::ScrolledWindow();
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 );
{
// key/value list
- ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
+ ui::Widget scr = ui::ScrolledWindow();
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 );
}
{
- ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
+ ui::Widget scr = ui::ScrolledWindow();
gtk_widget_show( scr );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
ui::Window CDbgDlg::BuildDialog(){
ui::Window window = MainFrame_getWindow().create_floating_window("Q3Map debug window" );
- ui::Widget scr = ui::Widget(gtk_scrolled_window_new( NULL, NULL ));
+ ui::Widget scr = ui::ScrolledWindow();
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 );
gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( vbox ) );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- scr = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
+ scr = ui::ScrolledWindow();
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_widget_show( hbox );
{
- ui::Widget sc_win = ui::Widget(gtk_scrolled_window_new( 0, 0 ));
+ ui::Widget sc_win = ui::ScrolledWindow();
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_widget_show( menu_bar );
}
{ // Texture TreeView
- g_TextureBrowser.m_scr_win_tree = ui::Widget(gtk_scrolled_window_new( NULL, NULL ));
+ g_TextureBrowser.m_scr_win_tree = ui::ScrolledWindow();
gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tree ), 0 );
// vertical only scrolling for treeview
gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tags_item );
}
{ // Tag TreeView
- g_TextureBrowser.m_scr_win_tags = ui::Widget(gtk_scrolled_window_new( NULL, NULL ));
+ g_TextureBrowser.m_scr_win_tags = ui::ScrolledWindow();
gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tags ), 0 );
// vertical only scrolling for treeview
gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_tag_frame ), frame_table );
}
{ // assigned tag list
- ui::Widget scrolled_win = ui::Widget(gtk_scrolled_window_new( NULL, NULL ));
+ ui::Widget scrolled_win = ui::ScrolledWindow();
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 );
gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
}
{ // available tag list
- ui::Widget scrolled_win = ui::Widget(gtk_scrolled_window_new( NULL, NULL ));
+ ui::Widget scrolled_win = ui::ScrolledWindow();
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 );