diff --git a/include/wx/gtk/frame.h b/include/wx/gtk/frame.h index 0a14bb20c3..6f04f1546a 100644 --- a/include/wx/gtk/frame.h +++ b/include/wx/gtk/frame.h @@ -84,6 +84,7 @@ public: virtual void OnInternalIdle(); bool m_menuBarDetached; + int m_menuBarHeight; bool m_toolBarDetached; protected: diff --git a/include/wx/gtk1/frame.h b/include/wx/gtk1/frame.h index 0a14bb20c3..6f04f1546a 100644 --- a/include/wx/gtk1/frame.h +++ b/include/wx/gtk1/frame.h @@ -84,6 +84,7 @@ public: virtual void OnInternalIdle(); bool m_menuBarDetached; + int m_menuBarHeight; bool m_toolBarDetached; protected: diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 6ef90dcc7a..75352ccdaa 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -851,6 +851,12 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) ) dc.SetTextForeground(wxGetApp().m_canvasTextColour); dc.SetBackgroundMode(wxTRANSPARENT); dc.DrawText("wxWindows common dialogs test application", 10, 10); + + dc.SetPen( *wxRED_PEN ); + dc.DrawLine( 10,40,200,40 ); + + dc.SetPen( *wxBLACK_PEN ); + dc.DrawLine( 10,50,200,50 ); } // ---------------------------------------------------------------------------- diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index 274b222b20..c9c2e6b1e8 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -366,7 +366,7 @@ bool MyPrintout::OnPrintPage(int page) wxChar buf[200]; wxSprintf(buf, wxT("PAGE %d"), page); - dc->DrawText(buf, 10, 10); + // dc->DrawText(buf, 10, 10); return TRUE; } @@ -432,6 +432,7 @@ void MyPrintout::DrawPageOne(wxDC *dc) // Set the scale and origin dc->SetUserScale(actualScale, actualScale); dc->SetDeviceOrigin( (long)posX, (long)posY ); + //dc->SetUserScale(1.0, 1.0); frame->Draw(*dc); } diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index acad4c3355..2df0917868 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -45,7 +45,6 @@ // constants // ---------------------------------------------------------------------------- -const int wxMENU_HEIGHT = 27; const int wxSTATUS_HEIGHT = 25; const int wxPLACE_HOLDER = 0; @@ -206,6 +205,7 @@ void wxFrame::Init() { m_menuBarDetached = FALSE; m_toolBarDetached = FALSE; + m_menuBarHeight = 2; } bool wxFrame::Create( wxWindow *parent, @@ -245,7 +245,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const if (m_frameMenuBar) { if (!m_menuBarDetached) - (*height) -= wxMENU_HEIGHT; + (*height) -= m_menuBarHeight; else (*height) -= wxPLACE_HOLDER; } @@ -292,7 +292,7 @@ void wxFrame::DoSetClientSize( int width, int height ) if (m_frameMenuBar) { if (!m_menuBarDetached) - height += wxMENU_HEIGHT; + height += m_menuBarHeight; else height += wxPLACE_HOLDER; } @@ -396,7 +396,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int xx = m_miniEdge; int yy = m_miniEdge + m_miniTitle; int ww = m_width - 2*m_miniEdge; - int hh = wxMENU_HEIGHT; + int hh = m_menuBarHeight; if (m_menuBarDetached) hh = wxPLACE_HOLDER; m_frameMenuBar->m_x = xx; m_frameMenuBar->m_y = yy; @@ -419,7 +419,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), if (m_frameMenuBar) { if (!m_menuBarDetached) - yy += wxMENU_HEIGHT; + yy += m_menuBarHeight; else yy += wxPLACE_HOLDER; } @@ -578,6 +578,17 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) } m_frameMenuBar->Show( TRUE ); + + GtkRequisition req; + req.width = 2; + req.height = 2; + (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request ) + (m_frameMenuBar->m_widget, &req ); + m_menuBarHeight = req.height; + } + else + { + m_menuBarHeight = 2; } // resize window in OnInternalIdle diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index acad4c3355..2df0917868 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -45,7 +45,6 @@ // constants // ---------------------------------------------------------------------------- -const int wxMENU_HEIGHT = 27; const int wxSTATUS_HEIGHT = 25; const int wxPLACE_HOLDER = 0; @@ -206,6 +205,7 @@ void wxFrame::Init() { m_menuBarDetached = FALSE; m_toolBarDetached = FALSE; + m_menuBarHeight = 2; } bool wxFrame::Create( wxWindow *parent, @@ -245,7 +245,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const if (m_frameMenuBar) { if (!m_menuBarDetached) - (*height) -= wxMENU_HEIGHT; + (*height) -= m_menuBarHeight; else (*height) -= wxPLACE_HOLDER; } @@ -292,7 +292,7 @@ void wxFrame::DoSetClientSize( int width, int height ) if (m_frameMenuBar) { if (!m_menuBarDetached) - height += wxMENU_HEIGHT; + height += m_menuBarHeight; else height += wxPLACE_HOLDER; } @@ -396,7 +396,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int xx = m_miniEdge; int yy = m_miniEdge + m_miniTitle; int ww = m_width - 2*m_miniEdge; - int hh = wxMENU_HEIGHT; + int hh = m_menuBarHeight; if (m_menuBarDetached) hh = wxPLACE_HOLDER; m_frameMenuBar->m_x = xx; m_frameMenuBar->m_y = yy; @@ -419,7 +419,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), if (m_frameMenuBar) { if (!m_menuBarDetached) - yy += wxMENU_HEIGHT; + yy += m_menuBarHeight; else yy += wxPLACE_HOLDER; } @@ -578,6 +578,17 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) } m_frameMenuBar->Show( TRUE ); + + GtkRequisition req; + req.width = 2; + req.height = 2; + (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request ) + (m_frameMenuBar->m_widget, &req ); + m_menuBarHeight = req.height; + } + else + { + m_menuBarHeight = 2; } // resize window in OnInternalIdle