20130313
[gdash.git] / src / editor / editorautowidgets.hpp
blob5f46f69c418c73446e1f5a71a384c2b0519f144d
1 /*
2 * Copyright (c) 2007-2013, Czirkos Zoltan http://code.google.com/p/gdash/
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #ifndef _GD_EDITOR_AUTOWIDGETS
17 #define _GD_EDITOR_AUTOWIDGETS
19 #include "config.h"
21 #include <gtk/gtkwidget.h>
23 class Reflective;
24 class PropertyDescription;
26 class EditorAutoUpdate {
27 private:
28 EditorAutoUpdate(EditorAutoUpdate const&); // deliberately not implemented
29 void operator=(EditorAutoUpdate const&); // deliberately not implemented
30 public:
31 Reflective *r; ///< A reflective object to work on
32 Reflective *def; ///< A reflective object, if any, which stores default value
33 PropertyDescription const *descr; ///< A pointer to the description of the property this is working on
34 GtkWidget *widget; ///< A widget to show on the screen. May not be the widget which stores data!
35 bool expand_vertically; ///< For longstrings - fill window with widget.
37 void update_cave() const;
38 void reload() const;
39 EditorAutoUpdate(Reflective *r, Reflective *def, PropertyDescription const *descr, void (*cave_update_cb)());
41 private:
42 void (*cave_update_cb)(); ///< A function to call when update happens
43 void (*reload_cb)(GtkWidget *); ///< A function to call for the widget when values have to be reloaded from the Reflective object
46 #endif