1 |
/* |
/* |
2 |
Copyright (c) 2016 Christian Schoenebeck |
Copyright (c) 2016 - 2017 Christian Schoenebeck |
3 |
|
|
4 |
This file is part of "gigedit" and released under the terms of the |
This file is part of "gigedit" and released under the terms of the |
5 |
GNU General Public License version 2. |
GNU General Public License version 2. |
8 |
#ifndef MANAGED_WINDOW_H |
#ifndef MANAGED_WINDOW_H |
9 |
#define MANAGED_WINDOW_H |
#define MANAGED_WINDOW_H |
10 |
|
|
11 |
|
#include "compat.h" |
12 |
#include <glibmm/object.h> |
#include <glibmm/object.h> |
13 |
#include <gtkmm/window.h> |
#include <gtkmm/window.h> |
14 |
|
#if USE_GTKMM_BUILDER |
15 |
|
# include <gtkmm/applicationwindow.h> |
16 |
|
#endif |
17 |
#include <gtkmm/dialog.h> |
#include <gtkmm/dialog.h> |
18 |
#include <glibmm/main.h> |
#include <glibmm/main.h> |
19 |
#include "Settings.h" |
#include "Settings.h" |
30 |
* user moves or resizes the window. And it automatically restores the window's |
* user moves or resizes the window. And it automatically restores the window's |
31 |
* position and size when it is created. |
* position and size when it is created. |
32 |
*/ |
*/ |
33 |
class ManagedWindow : public Gtk::Window { |
class ManagedWindow : |
34 |
|
#if USE_GTKMM_BUILDER |
35 |
|
public Gtk::ApplicationWindow |
36 |
|
#else |
37 |
|
public Gtk::Window |
38 |
|
#endif |
39 |
|
{ |
40 |
public: |
public: |
41 |
ManagedWindow(); |
ManagedWindow(); |
42 |
|
|
47 |
virtual Settings::Property<int>* windowSettingHeight() = 0; |
virtual Settings::Property<int>* windowSettingHeight() = 0; |
48 |
|
|
49 |
protected: |
protected: |
50 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
51 |
|
bool on_configure_event(Gdk::EventConfigure& event); |
52 |
|
#else |
53 |
bool on_configure_event(GdkEventConfigure* e); |
bool on_configure_event(GdkEventConfigure* e); |
54 |
|
#endif |
55 |
void enableListeningConfigureEvents() { m_listenOnConfigureEvents = true; } |
void enableListeningConfigureEvents() { m_listenOnConfigureEvents = true; } |
56 |
bool saveWindowDimensions(int x, int y, int w, int h); |
bool saveWindowDimensions(int x, int y, int w, int h); |
57 |
void restoreWindowDimensions(); |
void restoreWindowDimensions(); |
86 |
virtual Settings::Property<int>* windowSettingHeight() = 0; |
virtual Settings::Property<int>* windowSettingHeight() = 0; |
87 |
|
|
88 |
protected: |
protected: |
89 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
90 |
|
bool on_configure_event(Gdk::EventConfigure& event); |
91 |
|
#else |
92 |
bool on_configure_event(GdkEventConfigure* e); |
bool on_configure_event(GdkEventConfigure* e); |
93 |
|
#endif |
94 |
void enableListeningConfigureEvents() { m_listenOnConfigureEvents = true; } |
void enableListeningConfigureEvents() { m_listenOnConfigureEvents = true; } |
95 |
bool saveWindowDimensions(int x, int y, int w, int h); |
bool saveWindowDimensions(int x, int y, int w, int h); |
96 |
void restoreWindowDimensions(); |
void restoreWindowDimensions(); |