]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - libs/gtkutil/window.h
GTK: wrap gtk_widget_set_size_request
[xonotic/netradiant.git] / libs / gtkutil / window.h
1 /*
2    Copyright (C) 2001-2006, William Joseph.
3    All Rights Reserved.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 #if !defined( INCLUDED_GTKUTIL_WINDOW_H )
23 #define INCLUDED_GTKUTIL_WINDOW_H
24
25 #include <uilib/uilib.h>
26
27 #include "debugging/debugging.h"
28 #include "generic/callback.h"
29 #include "widget.h"
30
31 gboolean window_focus_in_clear_focus_widget(ui::Window widget, GdkEventKey *event, gpointer data);
32
33 guint window_connect_focus_in_clear_focus_widget(ui::Window window);
34
35 unsigned int connect_floating(ui::Window main_window, ui::Window floating);
36
37 ui::Window create_floating_window(const char *title, ui::Window parent);
38
39 void destroy_floating_window(ui::Window window);
40
41 ui::Window create_persistent_floating_window(const char *title, ui::Window main_window);
42
43 gboolean persistent_floating_window_delete(ui::Window floating, GdkEvent *event, ui::Window main_window);
44
45 void window_remove_minmax(ui::Window window);
46
47 ui::ScrolledWindow create_scrolled_window(ui::Policy hscrollbar_policy, ui::Policy vscrollbar_policy, int border = 0);
48
49
50 struct WindowPosition {
51     int x, y, w, h;
52
53     WindowPosition()
54     {
55     }
56
57     WindowPosition(int _x, int _y, int _w, int _h)
58             : x(_x), y(_y), w(_w), h(_h)
59     {
60     }
61 };
62
63 const WindowPosition c_default_window_pos(50, 25, 400, 300);
64
65 void window_get_position(ui::Window window, WindowPosition &position);
66
67 void window_set_position(ui::Window window, const WindowPosition &position);
68
69 void WindowPosition_Parse(WindowPosition &position, const char *value);
70
71 typedef ReferenceCaller1<WindowPosition, const char *, WindowPosition_Parse> WindowPositionImportStringCaller;
72
73 void WindowPosition_Write(const WindowPosition &position, const StringImportCallback &importCallback);
74
75 typedef ConstReferenceCaller1<WindowPosition, const StringImportCallback &, WindowPosition_Write> WindowPositionExportStringCaller;
76
77
78 class WindowPositionTracker {
79     WindowPosition m_position;
80
81     static gboolean configure(ui::Widget widget, GdkEventConfigure *event, WindowPositionTracker *self);
82
83 public:
84     WindowPositionTracker()
85             : m_position(c_default_window_pos)
86     {
87     }
88
89     void sync(ui::Window window);
90
91     void connect(ui::Window window);
92
93     const WindowPosition &getPosition() const;
94
95 //hack
96     void setPosition(const WindowPosition &position);
97 };
98
99
100 void WindowPositionTracker_importString(WindowPositionTracker &self, const char *value);
101
102 typedef ReferenceCaller1<WindowPositionTracker, const char *, WindowPositionTracker_importString> WindowPositionTrackerImportStringCaller;
103
104 void WindowPositionTracker_exportString(const WindowPositionTracker &self, const StringImportCallback &importer);
105
106 typedef ConstReferenceCaller1<WindowPositionTracker, const StringImportCallback &, WindowPositionTracker_exportString> WindowPositionTrackerExportStringCaller;
107
108
109 #endif