#pragma implementation "popupwin.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_POPUPWIN
+
#include "wx/popupwin.h"
#include "wx/frame.h"
#include "wx/app.h"
//-----------------------------------------------------------------------------
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()
+{
+ if (GTK_WIDGET_HAS_GRAB(m_widget))
+ gtk_grab_remove( m_widget );
+}
bool wxPopupWindow::Create( wxWindow *parent, int style )
{
}
*/
- 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))
{
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,
GtkOnSize( m_x, m_y, m_width, m_height );
}
-
+
+ if (!show)
+ gtk_grab_remove( m_widget );
+
bool ret = wxWindow::Show( show );
-
+
+ if (show)
+ gtk_grab_add( m_widget );
+
return ret;
}
+#endif // wxUSE_POPUPWIN