MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
popup.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, 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_POPUP_H_
21 #define _MFORMS_POPUP_H_
22 
23 #include <mforms/base.h>
24 #include <mforms/view.h>
25 
26 #include "cairo/cairo.h"
27 #include "base/geometry.h"
28 
33 namespace mforms
34 {
36  {
37  PopupPlain, // A simple popup window, similar to context menus, but non-modal.
38  PopupBezel, // A semi-transparent black and modal window with rounded corners and a white border.
39  };
40 
41  class Popup;
42 
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44 #ifndef SWIG
45  struct PopupImplPtrs
46  {
47  bool (*create)(Popup *, PopupStyle);
48  void (*destroy)(Popup *);
49  void (*set_needs_repaint)(Popup *);
50  void (*set_size)(Popup *, int, int);
51  int (*show)(Popup *, int, int);
52  base::Rect (*get_content_rect)(Popup *);
53  void (*set_modal_result)(Popup *, int result);
54  };
55 #endif
56 #endif
57 
58  class MFORMS_EXPORT Popup : public Object
59  {
60  public:
61  Popup(PopupStyle style);
62  ~Popup();
63 
64  void set_needs_repaint();
65  void set_size(int width, int height);
66  int show(int spot_x, int spot_y);
67  base::Rect get_content_rect();
68  void set_modal_result(int result);
69 
70  void closed();
71 
72 #ifndef DOXYGEN_SHOULD_SKIP_THIS
73 #ifndef SWIG
74  boost::signals2::signal<void ()>* on_close() { return &_on_close; }
75 
76  virtual void repaint(cairo_t *cr, int x, int y, int w, int h) {}
77 
78  virtual bool mouse_down(mforms::MouseButton button, int x, int y) { return false; }
79  virtual bool mouse_up(mforms::MouseButton button, int x, int y) { return false; }
80  virtual bool mouse_click(mforms::MouseButton button, int x, int y) { return false; }
81  virtual bool mouse_double_click(mforms::MouseButton button, int x, int y) { return false; }
82  virtual bool mouse_enter() { return false; }
83  virtual bool mouse_leave() { return false; }
84  virtual bool mouse_move(mforms::MouseButton button, int x, int y) { return false; }
85 #endif
86 #endif
87  protected:
88  PopupImplPtrs *_popup_impl;
89  boost::signals2::signal<void ()> _on_close; // Callback for non-modal popups.
90  };
91 };
92 
93 #endif // _MFORMS_POPUP_H_
PopupImplPtrs * _popup_impl
Definition: popup.h:88
boost::signals2::signal< void()> _on_close
Definition: popup.h:89
PopupStyle
Definition: popup.h:35
MouseButton
Definition: view.h:69
#define MFORMS_EXPORT
Definition: base.h:33
MySQL Workbench 6.1 documentation