X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f3ecfad1923022f59dca6fe065e5f278e2802faf..7fc4caa60a5b6c4af27da67afed5eeb85a823003:/src/gtk/popupwin.cpp diff --git a/src/gtk/popupwin.cpp b/src/gtk/popupwin.cpp index 36ef2e7b62..5847154018 100644 --- a/src/gtk/popupwin.cpp +++ b/src/gtk/popupwin.cpp @@ -7,11 +7,12 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "popupwin.h" #endif -#include "wx/defs.h" +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" #if wxUSE_POPUPWIN @@ -117,7 +118,7 @@ gtk_dialog_realized_callback( GtkWidget * WXUNUSED(widget), wxPopupWindow *win ) /* Callback for wxFrame. This very strange beast has to be used because * C++ has no virtual methods in a constructor. We have to emulate a - * virtual function here as wxWindows requires different ways to insert + * virtual function here as wxWidgets requires different ways to insert * a child in container classes. */ static void wxInsertChildInDialog( wxPopupWindow* parent, wxWindow* child ) @@ -142,17 +143,23 @@ static void wxInsertChildInDialog( wxPopupWindow* parent, wxWindow* child ) //----------------------------------------------------------------------------- BEGIN_EVENT_TABLE(wxPopupWindow,wxPopupWindowBase) - EVT_SIZE (wxPopupWindow::OnSize) +#ifdef __WXUNIVERSAL__ + EVT_SIZE(wxPopupWindow::OnSize) +#endif END_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow,wxPopupWindowBase) +IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) + +wxPopupWindow::~wxPopupWindow() +{ +} bool wxPopupWindow::Create( wxWindow *parent, int style ) { m_needParent = FALSE; if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) || - !CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, "popup" )) + !CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("popup") )) { wxFAIL_MSG( wxT("wxPopupWindow creation failed") ); return FALSE; @@ -245,10 +252,15 @@ void wxPopupWindow::DoSetSize( int x, int y, int width, int height, int sizeFlag } */ - if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; - if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; - if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; - if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; + int minWidth = GetMinWidth(), + minHeight = GetMinHeight(), + maxWidth = GetMaxWidth(), + maxHeight = GetMaxHeight(); + + if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; + if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; + if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; + if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight; if ((m_x != -1) || (m_y != -1)) { @@ -285,20 +297,25 @@ void wxPopupWindow::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int m_width = width; m_height = height; - if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; - if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; - if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; - if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; + int minWidth = GetMinWidth(), + minHeight = GetMinHeight(), + maxWidth = GetMaxWidth(), + maxHeight = GetMaxHeight(); + + if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; + if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; + if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; + if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight; /* set size hints */ gint flag = 0; // GDK_HINT_POS; - if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE; - if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE; + if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE; + if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE; GdkGeometry geom; - geom.min_width = m_minWidth; - geom.min_height = m_minHeight; - geom.max_width = m_maxWidth; - geom.max_height = m_maxHeight; + geom.min_width = minWidth; + geom.min_height = minHeight; + geom.max_width = maxWidth; + geom.max_height = maxHeight; gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), (GtkWidget*) NULL, &geom, @@ -330,9 +347,9 @@ bool wxPopupWindow::Show( bool show ) GtkOnSize( m_x, m_y, m_width, m_height ); } - + bool ret = wxWindow::Show( show ); - + return ret; }