MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sectionbox.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; version 2 of the
7  * License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17  * 02110-1301 USA
18  */
19 
20 #ifndef _MFORMS_SECTIONBOX_H_
21 #define _MFORMS_SECTIONBOX_H_
22 
23 #include "mforms/box.h"
24 #include "mforms/drawbox.h"
25 #include "cairo/cairo.h"
26 
31 namespace mforms {
32 
33  class HeaderBox;
34 
35  class MFORMS_EXPORT SectionBox : public Box
36  {
37  friend class HeaderBox;
38 
39  private:
40  HeaderBox* _header;
42  std::string _title;
44  bool _expanded;
45  cairo_surface_t* _unexpandable_icon;
46  cairo_surface_t* _unexpanded_icon;
47  cairo_surface_t* _expanded_icon;
48 
49  public:
50  SectionBox(bool expandable, const std::string& title, bool header_mode= false);
51  ~SectionBox();
52 
53  void set_content(View* page);
54  void toggle();
55  void set_expanded(bool expanded);
56  bool get_expanded() { return _expanded; }
57  };
58 
59 #ifndef DOXYGEN_SHOULD_SKIP_THIS
60 #ifndef SWIG
61  // Private class, so don't expose it to Python.
62  class HeaderBox : public DrawBox
63  {
64  private:
65  SectionBox* _owner;
66  double _caption_offset;
67  double _icon_left;
68  double _icon_right;
69  double _icon_top;
70  double _icon_bottom;
71  bool _header_mode; // Draw in special style (rounded corners and gradient).
72 
73  void draw_background(cairo_t* cr, int width, int height);
74  public:
75  HeaderBox(SectionBox* owner, bool header_mode);
76 
77  void repaint(cairo_t* cr, int x, int y, int w, int h);
78  bool mouse_down(mforms::MouseButton button, int x, int y);
79  };
80 #endif
81 #endif
82 
83 }
84 
85 #endif // _MFORMS_SECTIONBOX_H_
cairo_surface_t * _unexpandable_icon
Definition: sectionbox.h:45
Places child views sequentially in a vertical or horizontal layout.
Definition: box.h:50
MouseButton
Definition: view.h:69
#define MFORMS_EXPORT
Definition: base.h:33
std::string _title
Definition: sectionbox.h:42
cairo_surface_t * _expanded_icon
Definition: sectionbox.h:47
HeaderBox * _header
Definition: sectionbox.h:40
cairo_surface_t * _unexpanded_icon
Definition: sectionbox.h:46
MySQL Workbench 6.1 documentation