2 Copyright (C) 2001-2006, William Joseph.
5 This file is part of GtkRadiant.
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.
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.
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
22 #if !defined( INCLUDED_GTKUTIL_WIDGET_H )
23 #define INCLUDED_GTKUTIL_WIDGET_H
26 #include <uilib/uilib.h>
28 #include "generic/callback.h"
30 #include "debugging/debugging.h"
33 BoolExportCallback m_exportCallback;
34 typedef std::list<BoolImportCallback> ImportCallbacks;
35 ImportCallbacks m_importCallbacks;
37 ToggleItem(const BoolExportCallback &exportCallback) : m_exportCallback(exportCallback)
43 for (ImportCallbacks::iterator i = m_importCallbacks.begin(); i != m_importCallbacks.end(); ++i) {
48 void addCallback(const BoolImportCallback &callback)
50 m_importCallbacks.push_back(callback);
51 m_exportCallback(callback);
54 typedef MemberCaller1<ToggleItem, const BoolImportCallback &, &ToggleItem::addCallback> AddCallbackCaller;
60 ToggleShown(const ToggleShown &other); // NOT COPYABLE
61 ToggleShown &operator=(const ToggleShown &other); // NOT ASSIGNABLE
63 static gboolean notify_visible(ui::Widget widget, gpointer dummy, ToggleShown *self);
65 static gboolean destroy(ui::Widget widget, ToggleShown *self);
71 ToggleShown(bool shown)
72 : m_shownDeferred(shown), m_widget(0), m_item(ActiveCaller(*this))
80 void exportActive(const BoolImportCallback &importCallback);
82 typedef MemberCaller1<ToggleShown, const BoolImportCallback &, &ToggleShown::exportActive> ActiveCaller;
88 typedef MemberCaller<ToggleShown, &ToggleShown::toggle> ToggleCaller;
90 void connect(ui::Widget widget);
94 void widget_queue_draw(ui::Widget &widget);
96 typedef ReferenceCaller<ui::Widget, widget_queue_draw> WidgetQueueDrawCaller;
99 void widget_make_default(ui::Widget widget);
101 class WidgetFocusPrinter {
104 static gboolean focus_in(ui::Widget widget, GdkEventFocus *event, WidgetFocusPrinter *self);
106 static gboolean focus_out(ui::Widget widget, GdkEventFocus *event, WidgetFocusPrinter *self);
109 WidgetFocusPrinter(const char *name) : m_name(name)
113 void connect(ui::Widget widget);