1 // TimerPreferencesPanel.hh --- Preferences widgets for a timer
2 //
3 // Copyright (C) 2002, 2003, 2004, 2006, 2007, 2011 Raymond Penners <raymond@dotsphinx.com>
4 // All rights reserved.
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 //
19 
20 #ifndef TIMERPREFERENCESPANEL_HH
21 #define TIMERPREFERENCESPANEL_HH
22 
23 #include "preinclude.h"
24 
25 #ifdef HAVE_CONFIG
26 #include "config.h"
27 #endif
28 
29 #include <stdio.h>
30 #include <string>
31 
32 #include <gtkmm/box.h>
33 #include <gtkmm/sizegroup.h>
34 #include <gtkmm/adjustment.h>
35 
36 #include "ICore.hh"
37 
38 #define HAVE_MICRO_BREAK_ACTIVITY 1
39 
40 class TimeEntry;
41 class DataConnector;
42 
43 namespace Gtk
44 {
45   class CheckButton;
46   class SpinButton;
47 }
48 
49 using namespace workrave;
50 
51 class TimerPreferencesPanel
52   : public Gtk::VBox
53 {
54 public:
55   TimerPreferencesPanel(BreakId timer,
56                         Glib::RefPtr<Gtk::SizeGroup> hsize_group,
57                         Glib::RefPtr<Gtk::SizeGroup> vsize_group);
58   ~TimerPreferencesPanel();
59 
60 private:
61 #ifdef HAVE_MICRO_BREAK_ACTIVITY
62   bool on_monitor_changed(const std::string &key, bool write);
63 #endif
64   bool on_activity_sensitive_toggled(const std::string &key, bool write);
65   bool on_preludes_changed(const std::string &key, bool write);
66 #ifdef HAVE_EXERCISES
67   void on_exercises_changed();
68 #endif
69   Gtk::Widget *create_prelude_panel();
70   Gtk::Widget *create_options_panel();
71   Gtk::Widget *create_timers_panel(Glib::RefPtr<Gtk::SizeGroup> hsize_group,
72                                    Glib::RefPtr<Gtk::SizeGroup> vsize_group);
73   void set_prelude_sensitivity();
74 
75   void on_enabled_toggled();
76   void enable_buttons();
77 
78   BreakId break_id;
79   DataConnector *connector;
80 
81   Gtk::CheckButton *ignorable_cb;
82   Gtk::CheckButton *skippable_cb;
83   Gtk::CheckButton *activity_sensitive_cb;
84 #ifdef HAVE_MICRO_BREAK_ACTIVITY
85   Gtk::CheckButton *monitor_cb;
86 #endif
87   Gtk::CheckButton *prelude_cb;
88   Gtk::CheckButton *has_max_prelude_cb;
89   TimeEntry *limit_tim, *auto_reset_tim, *snooze_tim;
90   Gtk::SpinButton *max_prelude_spin;
91 #ifdef HAVE_GTK3
92   Glib::RefPtr<Gtk::Adjustment> max_prelude_adjustment;
93 #else
94   Gtk::Adjustment max_prelude_adjustment;
95 #endif
96   Gtk::CheckButton *allow_shutdown_cb;
97   Gtk::CheckButton *enabled_cb;
98   Gtk::CheckButton *auto_natural_cb;
99 #ifdef HAVE_EXERCISES
100   Gtk::SpinButton *exercises_spin;
101 #ifdef HAVE_GTK3
102   Glib::RefPtr<Gtk::Adjustment> exercises_adjustment;
103 #else
104   Gtk::Adjustment exercises_adjustment;
105 #endif
106 #endif
107 };
108 
109 #endif // TIMERPREFERENCESPANEL_HH
110