1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006-2010 Andreas Persson |
* Copyright (C) 2006-2011 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 |
27 |
#include <gtkmm/adjustment.h> |
#include <gtkmm/adjustment.h> |
28 |
#include <gtkmm/alignment.h> |
#include <gtkmm/alignment.h> |
29 |
#include <gtkmm/box.h> |
#include <gtkmm/box.h> |
30 |
|
#include <gtkmm/checkbutton.h> |
31 |
#include <gtkmm/comboboxtext.h> |
#include <gtkmm/comboboxtext.h> |
32 |
#include <gtkmm/frame.h> |
#include <gtkmm/frame.h> |
33 |
#include <gtkmm/label.h> |
#include <gtkmm/label.h> |
59 |
|
|
60 |
class NumEntry : public LabelWidget { |
class NumEntry : public LabelWidget { |
61 |
protected: |
protected: |
62 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
63 |
Gtk::Adjustment adjust; |
Gtk::Adjustment adjust; |
64 |
|
#else |
65 |
|
Glib::RefPtr<Gtk::Adjustment> adjust; |
66 |
|
#endif |
67 |
Gtk::HScale scale; |
Gtk::HScale scale; |
68 |
Gtk::SpinButton spinbutton; |
Gtk::SpinButton spinbutton; |
69 |
Gtk::HBox box; |
Gtk::HBox box; |
82 |
#endif |
#endif |
83 |
} |
} |
84 |
void set_upper(double upper) { |
void set_upper(double upper) { |
85 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
86 |
adjust.set_upper(upper); |
adjust.set_upper(upper); |
87 |
|
#else |
88 |
|
adjust->set_upper(upper); |
89 |
|
#endif |
90 |
} |
} |
91 |
}; |
}; |
92 |
|
|
139 |
template<typename T> |
template<typename T> |
140 |
void NumEntryTemp<T>::set_value(T value) |
void NumEntryTemp<T>::set_value(T value) |
141 |
{ |
{ |
142 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
143 |
if (value > adjust.get_upper()) value = T(adjust.get_upper()); |
if (value > adjust.get_upper()) value = T(adjust.get_upper()); |
144 |
|
#else |
145 |
|
if (value > adjust->get_upper()) value = T(adjust->get_upper()); |
146 |
|
#endif |
147 |
if (this->value != value) { |
if (this->value != value) { |
148 |
this->value = value; |
this->value = value; |
149 |
const double f = pow(10, spinbutton.get_digits()); |
const double f = pow(10, spinbutton.get_digits()); |
210 |
void ChoiceEntry<T>::set_choices(const char** texts, const T* values) |
void ChoiceEntry<T>::set_choices(const char** texts, const T* values) |
211 |
{ |
{ |
212 |
for (int i = 0 ; texts[i] ; i++) { |
for (int i = 0 ; texts[i] ; i++) { |
213 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
214 |
combobox.append_text(texts[i]); |
combobox.append_text(texts[i]); |
215 |
|
#else |
216 |
|
combobox.append(texts[i]); |
217 |
|
#endif |
218 |
} |
} |
219 |
this->values = values; |
this->values = values; |
220 |
} |
} |