~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to library/forms/mforms/popup.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Copyright (c) 2010, 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
 
 
29
/**
 
30
 * This class implements a popup window class which can be used for context menus or drop down menus.
 
31
 * A popup is always a modal window and cannot be used to embed other controls nor can itself be embedded.
 
32
 */
 
33
namespace mforms 
 
34
{
 
35
  enum PopupStyle
 
36
  {
 
37
    PopupPlain, // A simple popup window, similar to context menus.
 
38
    PopupBezel, // A semi-transparent black 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 (__stdcall *create)(Popup *, PopupStyle);
 
48
    void (__stdcall *set_needs_repaint)(Popup *);
 
49
    void (__stdcall *set_size)(Popup *, int, int);
 
50
    int (__stdcall *show)(Popup *, int, int);
 
51
    MySQL::Geometry::Rect (__stdcall *get_content_rect)(Popup *);
 
52
    void (__stdcall *set_modal_result)(Popup *, int result);
 
53
  };
 
54
#endif
 
55
#endif
 
56
  
 
57
  class MFORMS_EXPORT Popup : public Object
 
58
  {
 
59
  public:
 
60
    Popup(PopupStyle style);
 
61
 
 
62
    void set_needs_repaint();
 
63
    void set_size(int width, int height);
 
64
    int show(int spot_x, int spot_y);
 
65
    MySQL::Geometry::Rect get_content_rect();
 
66
    void set_modal_result(int result);
 
67
 
 
68
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
69
#ifndef SWIG
 
70
    virtual void repaint(cairo_t *cr, int x, int y, int w, int h) {}
 
71
 
 
72
    virtual void mouse_down(int button, int x, int y) {}
 
73
    virtual void mouse_up(int button, int x, int y) {}
 
74
    virtual void mouse_click(int button, int x, int y) {}
 
75
    virtual void mouse_double_click(int button, int x, int y) {}
 
76
    virtual void mouse_enter() {}
 
77
    virtual void mouse_leave() {}
 
78
    virtual void mouse_move(int x, int y) {}
 
79
#endif
 
80
#endif
 
81
  protected:
 
82
    PopupImplPtrs *_popup_impl;
 
83
  };
 
84
};
 
85
 
 
86
#endif // _MFORMS_POPUP_H_