File: popupwin.h

package info (click to toggle)
wxwidgets3.0 3.0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 120,464 kB
  • sloc: cpp: 896,633; makefile: 52,303; ansic: 21,971; sh: 5,713; python: 2,940; xml: 1,534; perl: 264; javascript: 33
file content (116 lines) | stat: -rw-r--r-- 2,899 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/////////////////////////////////////////////////////////////////////////////
// Name:        popupwin.h
// Purpose:     interface of wxPopupWindow
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxPopupWindow

    A special kind of top level window used for popup menus,
    combobox popups and such.

    @library{wxcore}
    @category{managedwnd}

    @see wxDialog, wxFrame
*/

class wxPopupWindow: public wxNonOwnedWindow
{
public:

    /**
      Default constructor
    */
    wxPopupWindow();
    
    /**
      Constructor
    */
    wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);

    /**
      Create method for two-step creation
    */
    bool Create(wxWindow *parent, int flags = wxBORDER_NONE);

    /**
        Move the popup window to the right position, i.e.\ such that it is
        entirely visible.

        The popup is positioned at ptOrigin + size if it opens below and to the
        right (default), at ptOrigin - sizePopup if it opens above and to the
        left etc.

        @param ptOrigin
            Must be given in screen coordinates!
        @param sizePopup
            The size of the popup window
    */
    virtual void Position(const wxPoint& ptOrigin,
                          const wxSize& sizePopup);
};

/**
    @class wxPopupTransientWindow

    A wxPopupWindow which disappears automatically when the user clicks mouse
    outside it or if it loses focus in any other way.

    This window can be useful for implementing custom combobox-like controls
    for example.

    @library{wxcore}
    @category{managedwnd}

    @see wxPopupWindow
*/

class wxPopupTransientWindow : public wxPopupWindow
{
public:
    /**
        Default constructor.
    */
    wxPopupTransientWindow();

    /**
        Constructor.
    */
    wxPopupTransientWindow(wxWindow *parent, int flags = wxBORDER_NONE);

    /**
        Popup the window (this will show it too).

        If @a winFocus is non-@NULL, it will be kept focused while this window
        is shown, otherwise this window itself will receive focus. In any case,
        the popup will disappear automatically if it loses focus because of a
        user action.

        @see Dismiss()
    */
    virtual void Popup(wxWindow *focus = NULL);

    /**
        Hide the window.
    */
    virtual void Dismiss();

    /**
        Called when a mouse is pressed while the popup is shown.

        Return @true from here to prevent its normal processing by the popup
        (which consists in dismissing it if the mouse is clicked outside it).
    */
    virtual bool ProcessLeftDown(wxMouseEvent& event);

protected:
    /**
       This is called when the popup is disappeared because of anything
       else but direct call to Dismiss().
    */
    virtual void OnDismiss();
    
};