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

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

  ViewVC Help
Powered by ViewVC