/[svn]/gigedit/trunk/src/gigedit/compat.h
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/compat.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2170 by persson, Sun Mar 6 07:52:43 2011 UTC revision 3450 by schoenebeck, Wed Jan 2 16:39:20 2019 UTC
# Line 1  Line 1 
1  /*                                                         -*- c++ -*-  /*                                                         -*- c++ -*-
2   * Copyright (C) 2011 Andreas Persson   * Copyright (C) 2011-2017 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 20  Line 20 
20  #ifndef GIGEDIT_COMPAT_H  #ifndef GIGEDIT_COMPAT_H
21  #define GIGEDIT_COMPAT_H  #define GIGEDIT_COMPAT_H
22    
23    #ifdef GTK_HEADER_FILE
24    # include GTK_HEADER_FILE(gtk.h)
25    #else
26    # include <gtk/gtk.h>
27    #endif
28    
29    #ifdef GLIBMM_HEADER_FILE
30    # include GLIBMM_HEADER_FILE(glibmmconfig.h)
31    #else
32    # include <glibmmconfig.h>
33    #endif
34    
35    #ifdef PANGOMM_HEADER_FILE
36    # include PANGOMM_HEADER_FILE(pangommconfig.h)
37    #else
38    # include <pangommconfig.h>
39    #endif
40    
41    #ifdef CAIROMM_HEADER_FILE
42    # include CAIROMM_HEADER_FILE(cairommconfig.h)
43    #else
44    # include <cairommconfig.h>
45    #endif
46    
47    #ifdef GTKMM_HEADER_FILE
48    # include GTKMM_HEADER_FILE(gtkmmconfig.h)
49    #else
50    # include <gtkmmconfig.h>
51    #endif
52    
53    #ifndef HAS_PANGOMM_CPP11_ENUMS // pangomm > 2.40 : <- just a "guess"
54    # if PANGOMM_MAJOR_VERSION > 2 || (PANGOMM_MAJOR_VERSION == 2 && PANGOMM_MINOR_VERSION > 40)
55    #  define HAS_PANGOMM_CPP11_ENUMS 1
56    # else
57    #  define HAS_PANGOMM_CPP11_ENUMS 0
58    # endif
59    #endif
60    
61    // Gtk::UIManager had been replaced by Gtk::Builder in GTKMM 3 and removed in GTKMM 4
62    // Gtk::ActionGroup had been replaced by Gio::ActionGroup in GTKMM 3 and removed in GTKMM 4
63    #if !defined(USE_GTKMM_BUILDER) || !defined(USE_GLIB_ACTION) // gtkmm > 3.22 :
64    # if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
65    #  define USE_GTKMM_BUILDER 1
66    #  define USE_GLIB_ACTION 1
67    # else
68    #  define USE_GTKMM_BUILDER 0
69    #  define USE_GLIB_ACTION 0
70    # endif
71    #endif
72    
73    #ifndef HAS_GDKMM_SEAT
74    # if GTKMM_MAJOR_VERSION > 2 || (GTKMM_MAJOR_VERSION == 2 && (GTKMM_MINOR_VERSION > 99 || (GTKMM_MINOR_VERSION == 99 && GTKMM_MICRO_VERSION >= 1))) // GTKM >= 2.99.1
75    #  define HAS_GDKMM_SEAT 1
76    # else
77    #  define HAS_GDKMM_SEAT 0
78    # endif
79    #endif
80    
81    #ifndef HAS_GTKMM_CPP11_ENUMS // gtkmm > 3.22
82    # if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
83    #  define HAS_GTKMM_CPP11_ENUMS 1
84    # else
85    #  define HAS_GTKMM_CPP11_ENUMS 0
86    # endif
87    #endif
88    
89    // alignment.h had been removed in GTKMM 4
90    #ifndef HAS_GTKMM_ALIGNMENT // gtkmm > 3.22 :
91    # if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
92    #  define HAS_GTKMM_ALIGNMENT 0
93    # else
94    #  define HAS_GTKMM_ALIGNMENT 1
95    # endif
96    #endif
97    
98    // Gtk::Table had been replaced by Gtk::Grid in GTKMM 3 and removed in GTKMM 4
99    // stock.h had been removed in GTKMM 4
100    // Gtk::VBox, Gtk::HBox and Gtk::HButtonBox had been replaced by Gtk::Box in GTKMM 3 and removed in GTKMM 4
101    #if !defined(USE_GTKMM_GRID) || !defined(HAS_GTKMM_STOCK) || !defined(USE_GTKMM_BOX) || !defined(USE_GTKMM_PANED) // gtkmm > 3.22 :
102    # if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
103    #  define USE_GTKMM_GRID 1
104    #  define HAS_GTKMM_STOCK 0
105    #  define USE_GTKMM_BOX 1
106    #  define USE_GTKMM_PANED 1
107    # else
108    #  define USE_GTKMM_GRID 0
109    #  define HAS_GTKMM_STOCK 1
110    #  define USE_GTKMM_BOX 0
111    #  define USE_GTKMM_PANED 0
112    # endif
113    #endif
114    
115    // Gtk::Widget::show_all_children() had been removed in GTKMM 3.89.4
116    #ifndef HAS_GTKMM_SHOW_ALL_CHILDREN
117    # if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 89 || (GTKMM_MINOR_VERSION == 89 && GTKMM_MICRO_VERSION >= 4)))
118    #  define HAS_GTKMM_SHOW_ALL_CHILDREN 0
119    # else
120    #  define HAS_GTKMM_SHOW_ALL_CHILDREN 1
121    # endif
122    #endif
123    
124    // enums have been renamed in cairomm 1.15.4
125    #ifndef HAS_CAIROMM_CPP11_ENUMS // cairomm >= 1.15.4 :
126    # if CAIROMM_MAJOR_VERSION > 1 || (CAIROMM_MAJOR_VERSION == 1 && (CAIROMM_MINOR_VERSION > 15 || (CAIROMM_MINOR_VERSION == 15 && CAIROMM_MICRO_VERSION >= 4)))
127    #  define HAS_CAIROMM_CPP11_ENUMS 1
128    # else
129    #  define HAS_CAIROMM_CPP11_ENUMS 0
130    # endif
131    #endif
132    
133    #include <gtkmm/buttonbox.h>
134    #include <gtkmm/scale.h>
135    
136    #if USE_GTKMM_BOX
137    # include <gtkmm/box.h>
138    class HBox : public Gtk::Box {
139    public:
140        HBox() : Gtk::Box(Gtk::Orientation::HORIZONTAL) {}
141    };
142    
143    class VBox : public Gtk::Box {
144    public:
145        VBox() : Gtk::Box(Gtk::Orientation::VERTICAL) {}
146    };
147    
148    class HButtonBox : public Gtk::ButtonBox {
149    public:
150        HButtonBox() : Gtk::ButtonBox(Gtk::Orientation::HORIZONTAL) {}
151    };
152    
153    class HScale : public Gtk::Scale {
154    public:
155        HScale() : Gtk::Scale(Gtk::Orientation::HORIZONTAL) {}
156        HScale(const Glib::RefPtr<Gtk::Adjustment>& adjustment) : Gtk::Scale(adjustment, Gtk::Orientation::HORIZONTAL) {}
157    };
158    #else
159    # if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 1 || (GTKMM_MINOR_VERSION == 1 && GTKMM_MICRO_VERSION >= 6))) // GTKMM >= 3.1.6
160    #  include <gtkmm/hvbox.h>
161    #endif
162    typedef Gtk::HBox HBox;
163    typedef Gtk::VBox VBox;
164    typedef Gtk::HButtonBox HButtonBox;
165    typedef Gtk::HScale HScale;
166    #endif // USE_GTKMM_BOX
167    
168    #if USE_GTKMM_PANED
169    # include <gtkmm/paned.h>
170    namespace Gtk {
171        class HPaned : public Paned {
172        public:
173            HPaned() : Paned(Orientation::HORIZONTAL) {}
174        };
175    }
176    #endif // USE_GTKMM_PANED
177    
178    #if USE_GLIB_ACTION
179    # include <giomm/simpleactiongroup.h>
180    # include <giomm/simpleaction.h>
181    typedef Gio::SimpleActionGroup ActionGroup;
182    typedef Gio::SimpleAction Action;
183    #else
184    # include <gtkmm/actiongroup.h>
185    # include <gtkmm/action.h>
186    typedef Gtk::ActionGroup ActionGroup;
187    typedef Gtk::Action Action;
188    #endif // USE_GLIB_ACTION
189    
190    #if HAS_PANGOMM_CPP11_ENUMS
191    # include <pangomm/layout.h>
192    namespace Pango {
193        const Alignment ALIGN_LEFT = Alignment::LEFT;
194        const Alignment ALIGN_CENTER = Alignment::CENTER;
195        const Alignment ALIGN_RIGHT = Alignment::RIGHT;
196    }
197    #endif // HAS_PANGOMM_CPP11_ENUMS
198    
199    #if HAS_GTKMM_CPP11_ENUMS
200    # include <gdkmm/types.h>
201    # include <gdkmm/cursor.h>
202    # include <gdkmm/pixbuf.h>
203    # include <gtkmm/enums.h>
204    # include <gtkmm/box.h>
205    # include <gtkmm/icontheme.h>
206    # include <gtkmm/messagedialog.h>
207    # include <gtkmm/dialog.h>
208    # include <gtkmm/textview.h>
209    # include <gtkmm/filechooser.h>
210    namespace Gdk {
211        const Cursor::Type SB_H_DOUBLE_ARROW = Cursor::Type::SB_H_DOUBLE_ARROW;
212        const Cursor::Type FLEUR = Cursor::Type::FLEUR;
213        const InterpType INTERP_NEAREST = InterpType::NEAREST;
214        const InterpType INTERP_TILES = InterpType::TILES;
215        const InterpType INTERP_BILINEAR = InterpType::BILINEAR;
216        const InterpType INTERP_HYPER = InterpType::HYPER;
217        const ModifierType SHIFT_MASK = ModifierType::SHIFT_MASK;
218        const ModifierType LOCK_MASK = ModifierType::LOCK_MASK;
219        const ModifierType CONTROL_MASK = ModifierType::CONTROL_MASK;
220        const ModifierType MOD1_MASK = ModifierType::MOD1_MASK;
221        const ModifierType MOD2_MASK = ModifierType::MOD2_MASK;
222        const ModifierType MOD3_MASK = ModifierType::MOD3_MASK;
223        const ModifierType MOD4_MASK = ModifierType::MOD4_MASK;
224        const ModifierType MOD5_MASK = ModifierType::MOD5_MASK;
225        const ModifierType BUTTON1_MASK = ModifierType::BUTTON1_MASK;
226        const ModifierType BUTTON2_MASK = ModifierType::BUTTON2_MASK;
227        const ModifierType BUTTON3_MASK = ModifierType::BUTTON3_MASK;
228        const ModifierType BUTTON4_MASK = ModifierType::BUTTON4_MASK;
229        const ModifierType BUTTON5_MASK = ModifierType::BUTTON5_MASK;
230        const ModifierType SUPER_MASK = ModifierType::SUPER_MASK;
231        const ModifierType HYPER_MASK = ModifierType::HYPER_MASK;
232        const ModifierType META_MASK = ModifierType::META_MASK;
233        const ModifierType RELEASE_MASK = ModifierType::RELEASE_MASK;
234        const ModifierType MODIFIER_MASK = ModifierType::MODIFIER_MASK;
235    }
236    namespace Gtk {
237        const PackOptions SHRINK = PackOptions::SHRINK;
238        const PackOptions PACK_SHRINK = PackOptions::SHRINK;
239        const PackOptions PACK_EXPAND_PADDING = PackOptions::EXPAND_PADDING;
240        const PackOptions PACK_EXPAND_WIDGET = PackOptions::EXPAND_WIDGET;
241        const ButtonBoxStyle BUTTONBOX_SPREAD = ButtonBoxStyle::SPREAD;
242        const ButtonBoxStyle BUTTONBOX_EDGE = ButtonBoxStyle::EDGE;
243        const ButtonBoxStyle BUTTONBOX_START = ButtonBoxStyle::START;
244        const ButtonBoxStyle BUTTONBOX_END = ButtonBoxStyle::END;
245        const ButtonBoxStyle BUTTONBOX_CENTER = ButtonBoxStyle::CENTER;
246        const ButtonBoxStyle BUTTONBOX_EXPAND = ButtonBoxStyle::EXPAND;
247        const MessageType MESSAGE_INFO = MessageType::INFO;
248        const MessageType MESSAGE_WARNING = MessageType::WARNING;
249        const MessageType MESSAGE_QUESTION = MessageType::QUESTION;
250        const MessageType MESSAGE_ERROR = MessageType::ERROR;
251        const MessageType MESSAGE_OTHER = MessageType::OTHER;
252        const ButtonsType BUTTONS_NONE = ButtonsType::NONE;
253        const ButtonsType BUTTONS_OK = ButtonsType::OK;
254        const ButtonsType BUTTONS_CLOSE = ButtonsType::CLOSE;
255        const ButtonsType BUTTONS_CANCEL = ButtonsType::CANCEL;
256        const ButtonsType BUTTONS_YES_NO = ButtonsType::YES_NO;
257        const ButtonsType BUTTONS_OK_CANCEL = ButtonsType::OK_CANCEL;
258        const ResponseType RESPONSE_NONE = ResponseType::NONE;
259        const ResponseType RESPONSE_REJECT = ResponseType::REJECT;
260        const ResponseType RESPONSE_ACCEPT = ResponseType::ACCEPT;
261        const ResponseType RESPONSE_DELETE_EVENT = ResponseType::DELETE_EVENT;
262        const ResponseType RESPONSE_OK = ResponseType::OK;
263        const ResponseType RESPONSE_CANCEL = ResponseType::CANCEL;
264        const ResponseType RESPONSE_CLOSE = ResponseType::CLOSE;
265        const ResponseType RESPONSE_YES = ResponseType::YES;
266        const ResponseType RESPONSE_NO = ResponseType::NO;
267        const ResponseType RESPONSE_APPLY = ResponseType::APPLY;
268        const ResponseType RESPONSE_HELP = ResponseType::HELP;
269        const ShadowType SHADOW_NONE = ShadowType::NONE;
270        const ShadowType SHADOW_IN = ShadowType::IN;
271        const ShadowType SHADOW_OUT = ShadowType::OUT;
272        const ShadowType SHADOW_ETCHED_IN = ShadowType::ETCHED_IN;
273        const ShadowType SHADOW_ETCHED_OUT = ShadowType::ETCHED_OUT;
274        const Align ALIGN_FILL = Align::FILL;
275        const Align ALIGN_START = Align::START;
276        const Align ALIGN_END = Align::END;
277        const Align ALIGN_CENTER = Align::CENTER;
278        const Align ALIGN_BASELINE = Align::BASELINE;
279        const WindowPosition WIN_POS_NONE = WindowPosition::NONE;
280        const WindowPosition WIN_POS_CENTER = WindowPosition::CENTER;
281        const WindowPosition WIN_POS_MOUSE = WindowPosition::MOUSE;
282        const WindowPosition WIN_POS_CENTER_ALWAYS = WindowPosition::CENTER_ALWAYS;
283        const WindowPosition WIN_POS_CENTER_ON_PARENT = WindowPosition::CENTER_ON_PARENT;
284        const PolicyType POLICY_ALWAYS = PolicyType::ALWAYS;
285        const PolicyType POLICY_AUTOMATIC = PolicyType::AUTOMATIC;
286        const PolicyType POLICY_NEVER = PolicyType::NEVER;
287        const PolicyType POLICY_EXTERNAL = PolicyType::EXTERNAL;
288        const ToolbarStyle TOOLBAR_ICONS = ToolbarStyle::ICONS;
289        const ToolbarStyle TOOLBAR_TEXT = ToolbarStyle::TEXT;
290        const ToolbarStyle TOOLBAR_BOTH = ToolbarStyle::BOTH;
291        const ToolbarStyle TOOLBAR_BOTH_HORIZ = ToolbarStyle::BOTH_HORIZ;
292        const DirectionType DIR_TAB_FORWARD = DirectionType::TAB_FORWARD;
293        const DirectionType DIR_TAB_BACKWARD = DirectionType::TAB_BACKWARD;
294        const DirectionType DIR_UP = DirectionType::UP;
295        const DirectionType DIR_DOWN = DirectionType::DOWN;
296        const DirectionType DIR_LEFT = DirectionType::LEFT;
297        const DirectionType DIR_RIGHT = DirectionType::RIGHT;
298        const SelectionMode SELECTION_NONE = SelectionMode::NONE;
299        const SelectionMode SELECTION_SINGLE = SelectionMode::SINGLE;
300        const SelectionMode SELECTION_BROWSE = SelectionMode::BROWSE;
301        const SelectionMode SELECTION_MULTIPLE = SelectionMode::MULTIPLE;
302        const BuiltinIconSize ICON_SIZE_INVALID = BuiltinIconSize::INVALID;
303        const BuiltinIconSize ICON_SIZE_MENU = BuiltinIconSize::MENU;
304        const BuiltinIconSize ICON_SIZE_SMALL_TOOLBAR = BuiltinIconSize::SMALL_TOOLBAR;
305        const BuiltinIconSize ICON_SIZE_LARGE_TOOLBAR = BuiltinIconSize::LARGE_TOOLBAR;
306        const BuiltinIconSize ICON_SIZE_BUTTON = BuiltinIconSize::BUTTON;
307        const BuiltinIconSize ICON_SIZE_DND = BuiltinIconSize::DND;
308        const BuiltinIconSize ICON_SIZE_DIALOG = BuiltinIconSize::DIALOG;
309        const IconLookupFlags ICON_LOOKUP_NO_SVG = IconLookupFlags::NO_SVG;
310        const IconLookupFlags ICON_LOOKUP_FORCE_SVG = IconLookupFlags::FORCE_SVG;
311        const IconLookupFlags ICON_LOOKUP_USE_BUILTIN = IconLookupFlags::USE_BUILTIN;
312        const IconLookupFlags ICON_LOOKUP_GENERIC_FALLBACK = IconLookupFlags::GENERIC_FALLBACK;
313        const IconLookupFlags ICON_LOOKUP_FORCE_SIZE = IconLookupFlags::FORCE_SIZE;
314        const IconLookupFlags ICON_LOOKUP_FORCE_REGULAR = IconLookupFlags::FORCE_REGULAR;
315        const IconLookupFlags ICON_LOOKUP_FORCE_SYMBOLIC = IconLookupFlags::FORCE_SYMBOLIC;
316        const IconLookupFlags ICON_LOOKUP_DIR_LTR = IconLookupFlags::DIR_LTR;
317        const IconLookupFlags ICON_LOOKUP_DIR_RTL = IconLookupFlags::DIR_RTL;
318        const TextWindowType TEXT_WINDOW_PRIVATE = TextWindowType::PRIVATE;
319        const TextWindowType TEXT_WINDOW_WIDGET = TextWindowType::WIDGET;
320        const TextWindowType TEXT_WINDOW_TEXT = TextWindowType::TEXT;
321        const TextWindowType TEXT_WINDOW_LEFT = TextWindowType::LEFT;
322        const TextWindowType TEXT_WINDOW_RIGHT = TextWindowType::RIGHT;
323        const TextWindowType TEXT_WINDOW_TOP = TextWindowType::TOP;
324        const TextWindowType TEXT_WINDOW_BOTTOM = TextWindowType::BOTTOM;
325        const FileChooser::Action FILE_CHOOSER_ACTION_OPEN = FileChooser::Action::OPEN;
326        const FileChooser::Action FILE_CHOOSER_ACTION_SAVE = FileChooser::Action::SAVE;
327        const FileChooser::Action FILE_CHOOSER_ACTION_SELECT_FOLDER = FileChooser::Action::SELECT_FOLDER;
328        const FileChooser::Action FILE_CHOOSER_ACTION_CREATE_FOLDER = FileChooser::Action::CREATE_FOLDER;
329    }
330    #endif // HAS_GTKMM_CPP11_ENUMS
331    
332  // 2.10  // 2.10
333    
# Line 31  Line 339 
339  #endif  #endif
340    
341    
342    // 2.12
343    
344    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 12) || GTKMM_MAJOR_VERSION < 2
345    #include <gtkmm/cellrenderertext.h>
346    namespace Gtk {
347        // this is not a real spin cell renderer, instead it's just text,
348        // extended with a property for storing an adjustment
349        class CellRendererSpin : public CellRendererText {
350        private:
351            Adjustment* adj;
352            struct Proxy {
353                Adjustment*& adj;
354                Proxy(Adjustment*& adj) : adj(adj) { }
355                const Adjustment* get_value() const { return adj; }
356                void operator=(Adjustment* x) { adj = x; }
357            };
358        public:
359            Proxy property_adjustment() const {
360                return const_cast<Adjustment*&>(adj);
361            }
362        };
363    }
364    #endif
365    
366    
367  // 2.18  // 2.18
368    
369  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 18) || GTKMM_MAJOR_VERSION < 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 18) || GTKMM_MAJOR_VERSION < 2
# Line 44  Line 377 
377  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION == 21 && GTKMM_MICRO_VERSION < 9) || \  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION == 21 && GTKMM_MICRO_VERSION < 9) || \
378      (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 21) || GTKMM_MAJOR_VERSION < 2      (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 21) || GTKMM_MAJOR_VERSION < 2
379  #define ALIGN_START ALIGN_LEFT  #define ALIGN_START ALIGN_LEFT
380    #define ALIGN_END ALIGN_RIGHT
381    #endif
382    
383    
384    // 2.24
385    
386    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 24) || GTKMM_MAJOR_VERSION < 2
387    #define get_first_cell() get_first_cell_renderer()
388  #endif  #endif
389    
390    
# Line 63  namespace Gdk { Line 404  namespace Gdk {
404  }  }
405  #endif  #endif
406    
407  #endif  
408    // glibmm 2.31.2
409    
410    #if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION == 31 && GLIBMM_MICRO_VERSION < 2) || \
411        (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION < 31) || GLIBMM_MAJOR_VERSION < 2
412    
413    namespace Glib {
414        namespace Threads {
415            using Glib::Thread;
416            using Glib::Mutex;
417            using Glib::Cond;
418        }
419    }
420    
421    #define OLD_THREADS
422    
423    #endif // glibmm 2.31.2
424    
425    #endif // GIGEDIT_COMPAT_H

Legend:
Removed from v.2170  
changed lines
  Added in v.3450

  ViewVC Help
Powered by ViewVC