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

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

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

revision 2150 by persson, Sat Dec 8 12:28:53 2007 UTC revision 2151 by persson, Sun Nov 21 12:38:41 2010 UTC
# Line 1  Line 1 
1  /*                                                         -*- c++ -*-  /*                                                         -*- c++ -*-
2   * Copyright (C) 2006, 2007 Andreas Persson   * Copyright (C) 2006-2010 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 22  Line 22 
22    
23  #include <gig.h>  #include <gig.h>
24    
25  #include <math.h>  #include <cmath>
26    
27  #include <gtkmm/adjustment.h>  #include <gtkmm/adjustment.h>
28  #include <gtkmm/alignment.h>  #include <gtkmm/alignment.h>
# Line 33  Line 33 
33  #include <gtkmm/scale.h>  #include <gtkmm/scale.h>
34  #include <gtkmm/spinbutton.h>  #include <gtkmm/spinbutton.h>
35  #include <gtkmm/textview.h>  #include <gtkmm/textview.h>
36    
37    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 12) || GTKMM_MAJOR_VERSION < 2
38    #define OLD_TOOLTIPS
39  #include <gtkmm/tooltips.h>  #include <gtkmm/tooltips.h>
40    #endif
41    
42  class LabelWidget {  class LabelWidget {
43  public:  public:
# Line 46  public: Line 50  public:
50          return sig_changed;          return sig_changed;
51      }      }
52  protected:  protected:
53    #ifdef OLD_TOOLTIPS
54      Gtk::Tooltips tooltips;      Gtk::Tooltips tooltips;
55    #endif
56      sigc::signal<void> sig_changed;      sigc::signal<void> sig_changed;
57  };  };
58    
# Line 64  public: Line 70  public:
70      NumEntry(const char* labelText, double lower = 0, double upper = 127,      NumEntry(const char* labelText, double lower = 0, double upper = 127,
71               int decimals = 0);               int decimals = 0);
72      void set_tip(const Glib::ustring& tip_text) {      void set_tip(const Glib::ustring& tip_text) {
73    #ifdef OLD_TOOLTIPS
74          tooltips.set_tip(spinbutton, tip_text);          tooltips.set_tip(spinbutton, tip_text);
75    #else
76            spinbutton.set_tooltip_text(tip_text);
77    #endif
78      }      }
79      void set_upper(double upper) {      void set_upper(double upper) {
80          adjust.set_upper(upper);          adjust.set_upper(upper);
# Line 166  public: Line 176  public:
176      void set_choices(const char** texts, const T* values);      void set_choices(const char** texts, const T* values);
177    
178      void set_tip(const Glib::ustring& tip_text) {      void set_tip(const Glib::ustring& tip_text) {
179          tooltips.set_tip(combobox, tip_text); //FIXME: don't Gtk::ComboBoxes support tooltips ???  #ifdef OLD_TOOLTIPS
180            tooltips.set_tip(combobox, tip_text);
181    #else
182            combobox.set_tooltip_text(tip_text);
183    #endif
184      }      }
185  };  };
186    
187  template<typename T>  template<typename T>
188  ChoiceEntry<T>::ChoiceEntry(const char* labelText) :  ChoiceEntry<T>::ChoiceEntry(const char* labelText) :
189      align(0, 0, 0, 0),      LabelWidget(labelText, align),
190      LabelWidget(labelText, align)      align(0, 0, 0, 0)
191  {  {
192      combobox.signal_changed().connect(sig_changed.make_slot());      combobox.signal_changed().connect(sig_changed.make_slot());
193      align.add(combobox);      align.add(combobox);
# Line 229  public: Line 243  public:
243      void set_value(bool value) { checkbutton.set_active(value); }      void set_value(bool value) { checkbutton.set_active(value); }
244    
245      void set_tip(const Glib::ustring& tip_text) {      void set_tip(const Glib::ustring& tip_text) {
246    #ifdef OLD_TOOLTIPS
247          tooltips.set_tip(checkbutton, tip_text);          tooltips.set_tip(checkbutton, tip_text);
248    #else
249            checkbutton.set_tooltip_text(tip_text);
250    #endif
251      }      }
252  };  };
253    

Legend:
Removed from v.2150  
changed lines
  Added in v.2151

  ViewVC Help
Powered by ViewVC