2008-04-12 11:37:09 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2009-01-11 07:05:05 -05:00
|
|
|
// Name: popupwin.h
|
2011-10-18 17:56:32 -04:00
|
|
|
// Purpose: interface of wxPopupWindow
|
2008-04-12 11:37:09 -04:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-04-12 11:37:09 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2019-05-24 00:26:14 -04:00
|
|
|
#define wxPU_CONTAINS_CONTROLS 0x0001
|
|
|
|
|
2008-04-12 11:37:09 -04:00
|
|
|
/**
|
|
|
|
@class wxPopupWindow
|
|
|
|
|
|
|
|
A special kind of top level window used for popup menus,
|
|
|
|
combobox popups and such.
|
|
|
|
|
2019-01-09 13:09:30 -05:00
|
|
|
@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
|
|
|
|
|
2008-04-12 11:37:09 -04:00
|
|
|
@library{wxcore}
|
|
|
|
@category{managedwnd}
|
|
|
|
|
|
|
|
@see wxDialog, wxFrame
|
|
|
|
*/
|
|
|
|
|
|
|
|
class wxPopupWindow: public wxNonOwnedWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2011-12-19 17:39:02 -05:00
|
|
|
/**
|
|
|
|
Default constructor
|
|
|
|
*/
|
|
|
|
wxPopupWindow();
|
2019-01-30 11:28:08 -05:00
|
|
|
|
2008-04-12 11:37:09 -04:00
|
|
|
/**
|
|
|
|
Constructor
|
|
|
|
*/
|
|
|
|
wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);
|
2008-10-10 15:14:22 -04:00
|
|
|
|
2008-04-12 11:37:09 -04:00
|
|
|
/**
|
|
|
|
Create method for two-step creation
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
|
2008-10-10 15:14:22 -04:00
|
|
|
|
2008-04-12 11:37:09 -04:00
|
|
|
/**
|
2012-11-30 19:14:07 -05:00
|
|
|
Move the popup window to the right position, i.e.\ such that it is
|
2008-04-12 11:37:09 -04:00
|
|
|
entirely visible.
|
2008-10-10 15:14:22 -04:00
|
|
|
|
2008-04-12 11:37:09 -04:00
|
|
|
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.
|
2008-10-10 15:14:22 -04:00
|
|
|
|
2008-04-12 11:37:09 -04:00
|
|
|
@param ptOrigin
|
|
|
|
Must be given in screen coordinates!
|
2008-10-10 15:14:22 -04:00
|
|
|
@param sizePopup
|
|
|
|
The size of the popup window
|
2008-04-12 11:37:09 -04:00
|
|
|
*/
|
|
|
|
virtual void Position(const wxPoint& ptOrigin,
|
2008-10-10 15:14:22 -04:00
|
|
|
const wxSize& sizePopup);
|
2008-04-12 11:37:09 -04:00
|
|
|
};
|
|
|
|
|
2011-03-19 07:57:06 -04:00
|
|
|
/**
|
|
|
|
@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:
|
2011-12-19 17:39:02 -05:00
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
*/
|
|
|
|
wxPopupTransientWindow();
|
|
|
|
|
2011-03-19 07:57:06 -04:00
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
|
|
|
wxPopupTransientWindow(wxWindow *parent, int flags = wxBORDER_NONE);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Popup the window (this will show it too).
|
|
|
|
|
2018-10-27 09:06:42 -04:00
|
|
|
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.
|
2011-03-19 07:57:06 -04:00
|
|
|
|
|
|
|
@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);
|
2011-12-19 17:39:02 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
This is called when the popup is disappeared because of anything
|
|
|
|
else but direct call to Dismiss().
|
|
|
|
*/
|
|
|
|
virtual void OnDismiss();
|
2019-01-30 11:28:08 -05:00
|
|
|
|
2011-03-19 07:57:06 -04:00
|
|
|
};
|