- if (y) *y -= org_y;
-}
-
-void wxWindow::Centre( int direction )
-{
- wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
-
- int x = m_x;
- int y = m_y;
-
- if (m_parent)
- {
- int p_w = 0;
- int p_h = 0;
- m_parent->GetSize( &p_w, &p_h );
- if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (p_w - m_width) / 2;
- if (direction & wxVERTICAL == wxVERTICAL) y = (p_h - m_height) / 2;
- }
- else
- {
- 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 wxWindow::Fit()
-{
- wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
-
- int maxX = 0;
- int maxY = 0;
- wxNode *node = m_children.First();
- while (node)
- {
- wxWindow *win = (wxWindow *)node->Data();
- int wx, wy, ww, wh;
- win->GetPosition(&wx, &wy);
- win->GetSize(&ww, &wh);
- if (wx + ww > maxX) maxX = wx + ww;
- if (wy + wh > maxY) maxY = wy + wh;
-
- node = node->Next();
- }
-
- SetClientSize(maxX + 7, maxY + 14);
-}
-
-void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH) )
-{
- wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
-
- m_minWidth = minW;
- m_minHeight = minH;
- m_maxWidth = maxW;
- m_maxHeight = maxH;
-}
-
-void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
-{
- /* this is commented because it also is commented
- in wxMSW. before I get even more questions about
- this. */
-// if (GetAutoLayout()) Layout();
-}
-
-bool wxWindow::Show( bool show )
-{
- wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") );
-
- if (show == m_isShown) return TRUE;
-
- if (show)
- gtk_widget_show( m_widget );
- else
- gtk_widget_hide( m_widget );
-
- m_isShown = show;
-
- return TRUE;
-}
-
-void wxWindow::Enable( bool enable )
-{
- wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
-
- m_isEnabled = enable;
-
- gtk_widget_set_sensitive( m_widget, enable );
- if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable );
-}
-
-int wxWindow::GetCharHeight() const
-{
- wxCHECK_MSG( (m_widget != NULL), 12, _T("invalid window") );
-
- wxCHECK_MSG( m_font.Ok(), 12, _T("invalid font") );
-
- GdkFont *font = m_font.GetInternalFont( 1.0 );
-
- return font->ascent + font->descent;
-}
-
-int wxWindow::GetCharWidth() const
-{
- wxCHECK_MSG( (m_widget != NULL), 8, _T("invalid window") );
-
- wxCHECK_MSG( m_font.Ok(), 8, _T("invalid font") );
-
- GdkFont *font = m_font.GetInternalFont( 1.0 );
-
- return gdk_string_width( font, "H" );
-}
-
-void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
- int *descent, int *externalLeading, const wxFont *theFont, bool WXUNUSED(use16) ) const
-{
- wxFont fontToUse = m_font;
- if (theFont) fontToUse = *theFont;
-
- wxCHECK_RET( fontToUse.Ok(), _T("invalid font") );
-
- GdkFont *font = fontToUse.GetInternalFont( 1.0 );
- if (x) (*x) = gdk_string_width( font, string.mbc_str() );
- if (y) (*y) = font->ascent + font->descent;
- if (descent) (*descent) = font->descent;
- if (externalLeading) (*externalLeading) = 0; // ??
-}
-
-void wxWindow::MakeModal( bool modal )
-{
- return;
-
- // Disable all other windows
- if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
- {
- wxNode *node = wxTopLevelWindows.First();
- while (node)
- {
- wxWindow *win = (wxWindow *)node->Data();
- if (win != this) win->Enable(!modal);
-
- node = node->Next();
- }
- }