| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 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 |
struct WindowPosition_String { |
| 70 |
|
| 71 |
static void Export(const WindowPosition &self, const Callback<void(const char *)> &returnz); |
| 72 |
|
| 73 |
static void Import(WindowPosition &self, const char *value); |
| 74 |
|
| 75 |
}; |
| 76 |
|
| 77 |
class WindowPositionTracker { |
| 78 |
WindowPosition m_position; |
| 79 |
|
| 80 |
static gboolean configure(ui::Widget widget, GdkEventConfigure *event, WindowPositionTracker *self); |
| 81 |
|
| 82 |
public: |
| 83 |
WindowPositionTracker() |
| 84 |
: m_position(c_default_window_pos) |
| 85 |
{ |
| 86 |
} |
| 87 |
|
| 88 |
void sync(ui::Window window); |
| 89 |
|
| 90 |
void connect(ui::Window window); |
| 91 |
|
| 92 |
const WindowPosition &getPosition() const; |
| 93 |
|
| 94 |
|
| 95 |
void setPosition(const WindowPosition &position); |
| 96 |
}; |
| 97 |
|
| 98 |
|
| 99 |
struct WindowPositionTracker_String { |
| 100 |
static void Export(const WindowPositionTracker &self, const Callback<void(const char *)> &returnz); |
| 101 |
|
| 102 |
static void Import(WindowPositionTracker &self, const char *value); |
| 103 |
}; |
| 104 |
|
| 105 |
#endif |