libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
attributepickerdialog.h
1 /* Copyright (C) 2012 G.P. Halkes
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License version 3, as
4  published by the Free Software Foundation.
5 
6  This program is distributed in the hope that it will be useful,
7  but WITHOUT ANY WARRANTY; without even the implied warranty of
8  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  GNU General Public License for more details.
10 
11  You should have received a copy of the GNU General Public License
12  along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14 #ifndef T3_WIDGET_ATTRIBUTEPICKERDIALOG_H
15 #define T3_WIDGET_ATTRIBUTEPICKERDIALOG_H
16 
17 #include <t3widget/interfaces.h>
18 #include <t3widget/dialogs/dialog.h>
19 #include <t3widget/widgets/checkbox.h>
20 #include <t3widget/widgets/expander.h>
21 #include <t3widget/widgets/expandergroup.h>
22 #include <t3widget/widgets/colorpicker.h>
23 
24 namespace t3_widget {
25 
26 class T3_WIDGET_API attribute_test_line_t;
27 
28 class T3_WIDGET_API attribute_picker_dialog_t : public dialog_t {
29  private:
30  struct T3_WIDGET_LOCAL implementation_t {
31  checkbox_t *bold_box, *reverse_box, *blink_box, *underline_box, *dim_box;
32  attribute_test_line_t *test_line;
33  color_picker_base_t *fg_picker, *bg_picker;
34  cleanup_ptr<expander_group_t>::t expander_group;
35  expander_t *fg_expander, *bg_expander;
36  t3_attr_t base_attributes;
37  implementation_t(void) : fg_picker(NULL), bg_picker(NULL), expander_group(NULL), base_attributes(0) {}
38  };
39  pimpl_ptr<implementation_t>::t impl;
40 
41  void attribute_changed(void);
42  void ok_activate(void);
43  void default_activate(void);
44  void group_expanded(bool state);
45  t3_attr_t get_attribute(void);
46 
47  public:
48  attribute_picker_dialog_t(const char *_title = "Attribute", bool with_default = true);
49  virtual void show(void);
50 
51  void set_attribute(t3_attr_t attr);
59  void set_base_attributes(t3_attr_t attr);
60 
61  T3_WIDGET_SIGNAL(attribute_selected, void, t3_attr_t);
62  T3_WIDGET_SIGNAL(default_selected, void);
63 };
64 
65 class T3_WIDGET_API attribute_test_line_t : public widget_t {
66  private:
67  t3_attr_t attr;
68  public:
70  virtual bool process_key(key_t key);
71  virtual bool set_size(optint height, optint width);
72  virtual void update_contents(void);
73  virtual bool accepts_focus(void);
74 
75  void set_attribute(t3_attr_t _attr);
76 };
77 
78 }; // namespace
79 #endif
Definition: attributepickerdialog.h:28
A widget showing an expander, which allows hiding another widget.
Definition: expander.h:23
Definition: attributepickerdialog.h:65
long key_t
Integer type holding a single key symbol.
Definition: key.h:24
t3_attr_t get_attribute(attribute_t attribute)
Retrieve the setting of a default attribute.
Definition: colorscheme.cc:131
Class implementing a checkbox.
Definition: checkbox.h:23
Definition: colorpicker.h:21
Base class for widgets.
Definition: widget.h:24
Class defining values with a separate validity check.
Definition: util.h:29
void set_attribute(attribute_t attribute, t3_attr_t value)
Change the setting of a default attribute.
Definition: colorscheme.cc:70
Base class for dialogs.
Definition: dialog.h:27