10 |
|
|
11 |
#include <glibmm/object.h> |
#include <glibmm/object.h> |
12 |
#include <gtkmm/window.h> |
#include <gtkmm/window.h> |
13 |
|
#include <gtkmm/dialog.h> |
14 |
#include <glibmm/main.h> |
#include <glibmm/main.h> |
15 |
#include "Settings.h" |
#include "Settings.h" |
16 |
|
|
44 |
private: |
private: |
45 |
Gtk::Window* m_window; |
Gtk::Window* m_window; |
46 |
bool m_listenOnConfigureEvents; |
bool m_listenOnConfigureEvents; |
47 |
|
Glib::RefPtr<Glib::TimeoutSource> m_eventThrottleTimer; |
48 |
|
}; |
49 |
|
|
50 |
|
/** @brief Base class intended to be used for all gigedit dialogs. |
51 |
|
* |
52 |
|
* This class aims to provide common functionalities for all dialogs of the |
53 |
|
* gigedit application. So usually all gigedit dialogs should derive from this |
54 |
|
* class. |
55 |
|
* |
56 |
|
* This class essentially is a copy of ManagedWindow. Due to inheritance |
57 |
|
* issues there is unfortunately not much that could be avoided regarding code |
58 |
|
* duplication by using a common both class for both. That's why all code is |
59 |
|
* simply copied for now. |
60 |
|
*/ |
61 |
|
class ManagedDialog : public Gtk::Dialog { |
62 |
|
public: |
63 |
|
ManagedDialog(); |
64 |
|
ManagedDialog(const Glib::ustring& title, bool modal = false); |
65 |
|
explicit ManagedDialog(const Glib::ustring& title, Gtk::Window& parent, bool modal = false); |
66 |
|
//ManagedDialog(const Glib::ustring& title, Gtk::DialogFlags flags); |
67 |
|
|
68 |
|
// following methods must be implemented by deriving class |
69 |
|
virtual Settings::Property<int>* windowSettingX() = 0; |
70 |
|
virtual Settings::Property<int>* windowSettingY() = 0; |
71 |
|
virtual Settings::Property<int>* windowSettingWidth() = 0; |
72 |
|
virtual Settings::Property<int>* windowSettingHeight() = 0; |
73 |
|
|
74 |
|
protected: |
75 |
|
bool on_configure_event(GdkEventConfigure* e); |
76 |
|
void enableListeningConfigureEvents() { m_listenOnConfigureEvents = true; } |
77 |
|
bool saveWindowDimensions(int x, int y, int w, int h); |
78 |
|
void restoreWindowDimensions(); |
79 |
|
void initManagedDialog(); |
80 |
|
private: |
81 |
|
Gtk::Window* m_window; |
82 |
|
bool m_listenOnConfigureEvents; |
83 |
Glib::RefPtr<Glib::TimeoutSource> m_eventThrottleTimer; |
Glib::RefPtr<Glib::TimeoutSource> m_eventThrottleTimer; |
84 |
}; |
}; |
85 |
|
|