X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e90c1d2a19361551eb07778280f22be3e759cf64..bcdfb2cf30140e4c2b12b69632f5d6929b25662b:/src/gtk/dialog.cpp diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 275b1eb4e9..703e8320c6 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -38,33 +38,6 @@ extern bool g_isIdle; extern wxList wxPendingDelete; -/* -//----------------------------------------------------------------------------- -// instruct X to set the WM hint for positioning -//----------------------------------------------------------------------------- - -extern "C" { - -static void gdk_window_set_position_hint( GdkWindow *window, gint x, gint y ) -{ - GdkWindowPrivate *priv; - XSizeHints size_hints; - - g_return_if_fail (window != NULL); - - priv = (GdkWindowPrivate*) window; - if (priv->destroyed) return; - - size_hints.flags = PPosition; - size_hints.x = x; - size_hints.y = y; - - XSetWMNormalHints (priv->xdisplay, priv->xwindow, &size_hints); -} - -} -*/ - //----------------------------------------------------------------------------- // "delete_event" //----------------------------------------------------------------------------- @@ -150,9 +123,18 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win ) position in "realize" and "map" */ gtk_widget_set_uposition( widget, win->m_x, win->m_y ); -/* - gdk_window_set_position_hint( widget->window, win->m_x, win->m_y ); -*/ + /* set size hints */ + gint flag = GDK_HINT_POS; + if ((win->GetMinWidth() != -1) || (win->GetMinHeight() != -1)) flag |= GDK_HINT_MIN_SIZE; + if ((win->GetMaxWidth() != -1) || (win->GetMaxHeight() != -1)) flag |= GDK_HINT_MAX_SIZE; + if (flag) + { + gdk_window_set_hints( win->m_widget->window, + win->m_x, win->m_y, + win->GetMinWidth(), win->GetMinHeight(), + win->GetMaxWidth(), win->GetMaxHeight(), + flag ); + } /* reset the icon */ if (win->m_icon != wxNullIcon) @@ -264,6 +246,7 @@ void wxDialog::Init() m_returnCode = 0; m_sizeSet = FALSE; m_modalShowing = FALSE; + m_isFrame = TRUE; } wxDialog::wxDialog( wxWindow *parent, @@ -288,7 +271,7 @@ bool wxDialog::Create( wxWindow *parent, if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { - wxFAIL_MSG( T("wxDialog creation failed") ); + wxFAIL_MSG( wxT("wxDialog creation failed") ); return FALSE; } @@ -356,7 +339,7 @@ wxDialog::~wxDialog() void wxDialog::SetTitle( const wxString& title ) { m_title = title; - if (m_title.IsNull()) m_title = T(""); + if (m_title.IsNull()) m_title = wxT(""); gtk_window_set_title( GTK_WINDOW(m_widget), m_title.mbc_str() ); } @@ -404,7 +387,7 @@ void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) ) // yes } -void wxDialog::OnCloseWindow(wxCloseEvent& event) +void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { // We'll send a Cancel message by default, // which may close the dialog. @@ -442,7 +425,7 @@ bool wxDialog::Destroy() void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) { - wxASSERT_MSG( (m_widget != NULL), T("invalid dialog") ); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") ); #if wxUSE_CONSTRAINTS if (GetAutoLayout()) @@ -477,8 +460,8 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxASSERT_MSG( (m_widget != NULL), T("invalid dialog") ); - wxASSERT_MSG( (m_wxwindow != NULL), T("invalid dialog") ); + wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") ); + wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid dialog") ); if (m_resizing) return; /* I don't like recursions */ m_resizing = TRUE; @@ -565,19 +548,6 @@ void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int heigh GetEventHandler()->ProcessEvent( event ); } -void wxDialog::Centre( int direction ) -{ - wxASSERT_MSG( (m_widget != NULL), T("invalid dialog") ); - - int x = 0; - int y = 0; - - if ((direction & wxHORIZONTAL) == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2; - if ((direction & wxVERTICAL) == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2; - - Move( x, y ); -} - void wxDialog::OnInternalIdle() { if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow)) @@ -623,14 +593,14 @@ void wxDialog::SetModal( bool WXUNUSED(flag) ) else if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL; */ - wxFAIL_MSG( T("wxDialog:SetModal obsolete now") ); + wxFAIL_MSG( wxT("wxDialog:SetModal obsolete now") ); } int wxDialog::ShowModal() { if (IsModal()) { - wxFAIL_MSG( T("wxDialog:ShowModal called twice") ); + wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") ); return GetReturnCode(); } @@ -653,7 +623,7 @@ void wxDialog::EndModal( int retCode ) if (!IsModal()) { - wxFAIL_MSG( T("wxDialog:EndModal called twice") ); + wxFAIL_MSG( wxT("wxDialog:EndModal called twice") ); return; }