Changed the ultimate fall-back popup window classes: wxMSW now uses wxFrame, wxMAC uses wxNonOwnedWindow
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62254 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,7 +32,6 @@
|
|||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/dialog.h"
|
|
||||||
#include "wx/timer.h"
|
#include "wx/timer.h"
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -59,6 +58,11 @@
|
|||||||
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
|
|
||||||
|
// Let's use wxFrame as a fall-back solution until wxMSW gets wxNonOwnedWindow
|
||||||
|
#include "wx/frame.h"
|
||||||
|
#define wxCC_GENERIC_TLW_IS_FRAME
|
||||||
|
#define wxComboCtrlGenericTLW wxFrame
|
||||||
|
|
||||||
#define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
|
#define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
|
||||||
#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common
|
#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common
|
||||||
// native controls work on it like normal.
|
// native controls work on it like normal.
|
||||||
@@ -71,14 +75,18 @@
|
|||||||
|
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
|
|
||||||
#include "wx/gtk/private.h"
|
|
||||||
|
|
||||||
// NB: It is not recommended to use wxDialog as popup on wxGTK, because of
|
// NB: It is not recommended to use wxDialog as popup on wxGTK, because of
|
||||||
// this bug: If wxDialog is hidden, its position becomes corrupt
|
// this bug: If wxDialog is hidden, its position becomes corrupt
|
||||||
// between hide and next show, but without internal coordinates being
|
// between hide and next show, but without internal coordinates being
|
||||||
// reflected (or something like that - atleast commenting out ->Hide()
|
// reflected (or something like that - atleast commenting out ->Hide()
|
||||||
// seemed to eliminate the position change).
|
// seemed to eliminate the position change).
|
||||||
|
|
||||||
|
#include "wx/dialog.h"
|
||||||
|
#define wxCC_GENERIC_TLW_IS_DIALOG
|
||||||
|
#define wxComboCtrlGenericTLW wxDialog
|
||||||
|
|
||||||
|
#include "wx/gtk/private.h"
|
||||||
|
|
||||||
// NB: Let's not be afraid to use wxGTK's wxPopupTransientWindow as a
|
// NB: Let's not be afraid to use wxGTK's wxPopupTransientWindow as a
|
||||||
// 'perfect' popup, as it can succesfully host child controls even in
|
// 'perfect' popup, as it can succesfully host child controls even in
|
||||||
// popups that are shown in modal dialogs.
|
// popups that are shown in modal dialogs.
|
||||||
@@ -92,6 +100,10 @@
|
|||||||
|
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
|
|
||||||
|
#include "wx/nonownedwnd.h"
|
||||||
|
#define wxCC_GENERIC_TLW_IS_NONOWNEDWINDOW
|
||||||
|
#define wxComboCtrlGenericTLW wxNonOwnedWindow
|
||||||
|
|
||||||
#define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
|
#define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
|
||||||
#define TRANSIENT_POPUPWIN_IS_PERFECT 1 // wxPopupTransientWindow works, its child can have focus, and common
|
#define TRANSIENT_POPUPWIN_IS_PERFECT 1 // wxPopupTransientWindow works, its child can have focus, and common
|
||||||
// native controls work on it like normal.
|
// native controls work on it like normal.
|
||||||
@@ -106,6 +118,10 @@
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#include "wx/dialog.h"
|
||||||
|
#define wxCC_GENERIC_TLW_IS_DIALOG
|
||||||
|
#define wxComboCtrlGenericTLW wxDialog
|
||||||
|
|
||||||
#define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
|
#define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
|
||||||
#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common
|
#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common
|
||||||
// native controls work on it like normal.
|
// native controls work on it like normal.
|
||||||
@@ -139,7 +155,7 @@ enum
|
|||||||
POPUPWIN_NONE = 0,
|
POPUPWIN_NONE = 0,
|
||||||
POPUPWIN_WXPOPUPTRANSIENTWINDOW = 1,
|
POPUPWIN_WXPOPUPTRANSIENTWINDOW = 1,
|
||||||
POPUPWIN_WXPOPUPWINDOW = 2,
|
POPUPWIN_WXPOPUPWINDOW = 2,
|
||||||
POPUPWIN_WXDIALOG = 3
|
POPUPWIN_GENERICTLW = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -157,9 +173,9 @@ enum
|
|||||||
#define SECONDARY_POPUP_TYPE POPUPWIN_WXPOPUPWINDOW
|
#define SECONDARY_POPUP_TYPE POPUPWIN_WXPOPUPWINDOW
|
||||||
#define USES_WXPOPUPWINDOW 1
|
#define USES_WXPOPUPWINDOW 1
|
||||||
#else
|
#else
|
||||||
#define wxComboPopupWindowBase2 wxDialog
|
#define wxComboPopupWindowBase2 wxComboCtrlGenericTLW
|
||||||
#define SECONDARY_POPUP_TYPE POPUPWIN_WXDIALOG
|
#define SECONDARY_POPUP_TYPE POPUPWIN_GENERICTLW
|
||||||
#define USES_WXDIALOG 1
|
#define USES_GENERICTLW 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif wxUSE_POPUPWIN
|
#elif wxUSE_POPUPWIN
|
||||||
@@ -170,17 +186,17 @@ enum
|
|||||||
#define USES_WXPOPUPWINDOW 1
|
#define USES_WXPOPUPWINDOW 1
|
||||||
|
|
||||||
#if !POPUPWIN_IS_PERFECT
|
#if !POPUPWIN_IS_PERFECT
|
||||||
#define wxComboPopupWindowBase2 wxDialog
|
#define wxComboPopupWindowBase2 wxComboCtrlGenericTLW
|
||||||
#define SECONDARY_POPUP_TYPE POPUPWIN_WXDIALOG
|
#define SECONDARY_POPUP_TYPE POPUPWIN_GENERICTLW
|
||||||
#define USES_WXDIALOG 1
|
#define USES_GENERICTLW 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// wxPopupWindow is not implemented
|
// wxPopupWindow is not implemented
|
||||||
|
|
||||||
#define wxComboPopupWindowBase wxDialog
|
#define wxComboPopupWindowBase wxComboCtrlGenericTLW
|
||||||
#define PRIMARY_POPUP_TYPE POPUPWIN_WXDIALOG
|
#define PRIMARY_POPUP_TYPE POPUPWIN_GENERICTLW
|
||||||
#define USES_WXDIALOG 1
|
#define USES_GENERICTLW 1
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -193,8 +209,8 @@ enum
|
|||||||
#define USES_WXPOPUPWINDOW 0
|
#define USES_WXPOPUPWINDOW 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USES_WXDIALOG
|
#ifndef USES_GENERICTLW
|
||||||
#define USES_WXDIALOG 0
|
#define USES_GENERICTLW 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -435,7 +451,7 @@ public:
|
|||||||
|
|
||||||
void OnSizeEvent( wxSizeEvent& event );
|
void OnSizeEvent( wxSizeEvent& event );
|
||||||
void OnKeyEvent(wxKeyEvent& event);
|
void OnKeyEvent(wxKeyEvent& event);
|
||||||
#if USES_WXDIALOG
|
#if USES_GENERICTLW
|
||||||
void OnActivate( wxActivateEvent& event );
|
void OnActivate( wxActivateEvent& event );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -449,7 +465,7 @@ private:
|
|||||||
BEGIN_EVENT_TABLE(wxComboPopupWindowEvtHandler, wxEvtHandler)
|
BEGIN_EVENT_TABLE(wxComboPopupWindowEvtHandler, wxEvtHandler)
|
||||||
EVT_KEY_DOWN(wxComboPopupWindowEvtHandler::OnKeyEvent)
|
EVT_KEY_DOWN(wxComboPopupWindowEvtHandler::OnKeyEvent)
|
||||||
EVT_KEY_UP(wxComboPopupWindowEvtHandler::OnKeyEvent)
|
EVT_KEY_UP(wxComboPopupWindowEvtHandler::OnKeyEvent)
|
||||||
#if USES_WXDIALOG
|
#if USES_GENERICTLW
|
||||||
EVT_ACTIVATE(wxComboPopupWindowEvtHandler::OnActivate)
|
EVT_ACTIVATE(wxComboPopupWindowEvtHandler::OnActivate)
|
||||||
#endif
|
#endif
|
||||||
EVT_SIZE(wxComboPopupWindowEvtHandler::OnSizeEvent)
|
EVT_SIZE(wxComboPopupWindowEvtHandler::OnSizeEvent)
|
||||||
@@ -470,7 +486,7 @@ void wxComboPopupWindowEvtHandler::OnKeyEvent( wxKeyEvent& event )
|
|||||||
child->GetEventHandler()->AddPendingEvent(event);
|
child->GetEventHandler()->AddPendingEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USES_WXDIALOG
|
#if USES_GENERICTLW
|
||||||
void wxComboPopupWindowEvtHandler::OnActivate( wxActivateEvent& event )
|
void wxComboPopupWindowEvtHandler::OnActivate( wxActivateEvent& event )
|
||||||
{
|
{
|
||||||
if ( !event.GetActive() )
|
if ( !event.GetActive() )
|
||||||
@@ -1618,7 +1634,7 @@ bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event,
|
|||||||
wxLongLong t = ::wxGetLocalTimeMillis();
|
wxLongLong t = ::wxGetLocalTimeMillis();
|
||||||
int evtType = event.GetEventType();
|
int evtType = event.GetEventType();
|
||||||
|
|
||||||
#if USES_WXPOPUPWINDOW || USES_WXDIALOG
|
#if USES_WXPOPUPWINDOW || USES_GENERICTLW
|
||||||
if ( m_popupWinType != POPUPWIN_WXPOPUPTRANSIENTWINDOW )
|
if ( m_popupWinType != POPUPWIN_WXPOPUPTRANSIENTWINDOW )
|
||||||
{
|
{
|
||||||
if ( IsPopupWindowState(Visible) &&
|
if ( IsPopupWindowState(Visible) &&
|
||||||
@@ -1772,12 +1788,23 @@ void wxComboCtrlBase::CreatePopup()
|
|||||||
#ifdef wxComboPopupWindowBase2
|
#ifdef wxComboPopupWindowBase2
|
||||||
if ( m_iFlags & wxCC_IFLAG_USE_ALT_POPUP )
|
if ( m_iFlags & wxCC_IFLAG_USE_ALT_POPUP )
|
||||||
{
|
{
|
||||||
#if !USES_WXDIALOG
|
#if !USES_GENERICTLW
|
||||||
m_winPopup = new wxComboPopupWindowBase2( this, wxNO_BORDER );
|
m_winPopup = new wxComboPopupWindowBase2( this, wxNO_BORDER );
|
||||||
#else
|
#else
|
||||||
|
int tlwFlags = wxNO_BORDER;
|
||||||
|
#ifdef wxCC_GENERIC_TLW_IS_FRAME
|
||||||
|
tlwFlags |= wxFRAME_NO_TASKBAR;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef wxCC_GENERIC_TLW_IS_NONOWNEDWINDOW
|
||||||
|
m_winPopup = new wxComboPopupWindowBase2( this, wxID_ANY,
|
||||||
|
wxPoint(-21,-21), wxSize(20, 20),
|
||||||
|
tlwFlags );
|
||||||
|
#else
|
||||||
m_winPopup = new wxComboPopupWindowBase2( this, wxID_ANY, wxEmptyString,
|
m_winPopup = new wxComboPopupWindowBase2( this, wxID_ANY, wxEmptyString,
|
||||||
wxPoint(-21,-21), wxSize(20, 20),
|
wxPoint(-21,-21), wxSize(20, 20),
|
||||||
wxNO_BORDER );
|
tlwFlags );
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
m_popupWinType = SECONDARY_POPUP_TYPE;
|
m_popupWinType = SECONDARY_POPUP_TYPE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user