File: popupwin.h

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (131 lines) | stat: -rw-r--r-- 3,690 bytes parent folder | download | duplicates (4)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/////////////////////////////////////////////////////////////////////////////
// Name:        popupwin.h
// Purpose:     interface of wxPopupWindow
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#define wxPU_CONTAINS_CONTROLS     0x0001

/**
    @class wxPopupWindow

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

    @beginStyleTable
    @style{wxPU_CONTAINS_CONTROLS}
        By default in wxMSW, a popup window will not take focus from its parent
        window. However many standard controls, including common ones such as
        wxTextCtrl, need focus to function correctly and will not work when
        placed on a default popup. This flag can be used to make the popup take
        focus and let all controls work but at the price of not allowing the
        parent window to keep focus while the popup is shown, which can also be
        sometimes desirable. This style is currently only implemented in MSW
        and simply does nothing under the other platforms (it's new since
        wxWidgets 3.1.3).
    @endStyleTable

    @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 focus is non-@NULL, it will be kept focused while this window
        is shown if supported by the current platform, otherwise the popup
        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();

};