MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
popover.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, 2014, 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_POPOVER_H_
21 #define _MFORMS_POPOVER_H_
22 
23 #include "mforms/container.h"
24 
33 namespace mforms {
34  class Popover;
35 
36  // Determines the initial position of the popover with respect to the reference point.
38  Left, // The popover is initially left to the ref point, having its arrow pointing to the right.
39  Right, // Similar for the other positions.
42  };
43 
44  enum PopoverStyle {
45  PopoverStyleNormal, // With large rounded corners, tip (arrow) etc.
46  PopoverStyleTooltip // Simplified version with now tip, smaller corners etc.
47  };
48 
49 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 #ifndef SWIG
51  struct MFORMS_EXPORT PopoverImplPtrs
52  {
53  bool (*create)(Popover* self, PopoverStyle style);
54  void (*destroy)(Popover* self);
55  void (*set_content)(Popover *self, View *content);
56  void (*set_size)(Popover *self, int, int);
57  void (*show)(Popover *self, int, int, StartPosition); // Position of the popover's tip in screen coordinates.
58  void (*close)(Popover* self);
59  };
60 #endif
61 #endif
62 
63  class MFORMS_EXPORT Popover : public Object
64  {
65  PopoverImplPtrs *_popover_impl;
66 
67  public:
69  virtual ~Popover();
70 
71  void set_content(View* content);
72 
73  // Size of the main body. The arrow is added implicitly and is not part of the size
74  // (nor is the shadow or other decoration, if any). Size must be set before showing the
75  // popover as it determines the overall shape.
76  void set_size(int width, int height);
77 
78  // Displays the popover so that its arrow tip is at the given screen position. The popover itself
79  // will be arranged to not overlap screen borders.
80  // Parameter position indicates how the popover is to position initially, with respect to the
81  // reference point. The actual screen position also depends on the size of the popover and the given location.
82  // The position parameter applies only to the normal popover style. The tooltip style has no
83  // arrow and is positioned with the left upper corner at the given position.
84  void show(int x, int y, StartPosition position);
85  void close();
86 
87  };
88 };
89 
90 #endif
PopoverStyle
Definition: popover.h:44
#define MFORMS_EXPORT
Definition: base.h:33
StartPosition
Definition: popover.h:37
PopoverImplPtrs * _popover_impl
Definition: popover.h:65
MySQL Workbench 6.1 documentation