Attempts to get client origin working. Work in progress.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14153 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-02-12 12:59:14 +00:00
parent 43d611cbcc
commit e5053ade6b
6 changed files with 71 additions and 3 deletions

View File

@@ -95,3 +95,4 @@ private:
#endif #endif
// _WX_COLOUR_H_ // _WX_COLOUR_H_

View File

@@ -72,6 +72,13 @@ protected:
// common part of all ctors // common part of all ctors
void Init(); void Init();
// For implementation purposes - sometimes decorations make the client area
// smaller
virtual wxPoint GetClientAreaOrigin() const;
virtual void DoGetClientSize( int *width, int *height ) const;
virtual void DoSetClientSize(int width, int height);
// is the frame currently iconized? // is the frame currently iconized?
bool m_iconized; bool m_iconized;

View File

@@ -96,6 +96,7 @@ void wxFrame::PositionMenuBar()
// the menubar is positioned above the client size, hence the negative // the menubar is positioned above the client size, hence the negative
// y coord // y coord
wxCoord heightMbar = m_frameMenuBar->GetSize().y; wxCoord heightMbar = m_frameMenuBar->GetSize().y;
m_frameMenuBar->SetSize(0, m_frameMenuBar->SetSize(0,
#ifdef __WXPM__ // FIXME -- remove this, make wxOS2/Univ behave as #ifdef __WXPM__ // FIXME -- remove this, make wxOS2/Univ behave as
// the rest of the world!!! // the rest of the world!!!

View File

@@ -342,6 +342,8 @@ void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
CalcBoundingBox(x1, y1); CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2); CalcBoundingBox(x2, y2);
wxLogDebug("Drawing line at %d, %d -> %d, %d", XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
} }
} }
@@ -749,6 +751,7 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
CalcBoundingBox( x, y ); CalcBoundingBox( x, y );
CalcBoundingBox( x + width, y + height ); CalcBoundingBox( x + width, y + height );
wxLogDebug("Drawing rectangle at %d, %d (%dx%d)", x, y, width, height);
} }
void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius ) void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
@@ -1246,6 +1249,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
{ {
XDrawString( (Display*) m_display, (Window) m_window, XDrawString( (Display*) m_display, (Window) m_window,
(GC) m_textGC, x, y, text.c_str(), text.Len() ); (GC) m_textGC, x, y, text.c_str(), text.Len() );
wxLogDebug("Drawing text %s at %d, %d", text.c_str(), x, y);
} }
#if 0 #if 0

View File

@@ -35,11 +35,12 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/frame.h" #include "wx/frame.h"
#include "wx/menu.h"
#include "wx/statusbr.h"
#endif //WX_PRECOMP #endif //WX_PRECOMP
#include "wx/x11/private.h" #include "wx/x11/private.h"
bool wxMWMIsRunning(Window w); bool wxMWMIsRunning(Window w);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -396,3 +397,54 @@ bool wxMWMIsRunning(Window w)
return (ret == Success); return (ret == Success);
} }
// For implementation purposes - sometimes decorations make the client area
// smaller
wxPoint wxTopLevelWindowX11::GetClientAreaOrigin() const
{
if (this->IsKindOf(CLASSINFO(wxFrame)))
{
wxFrame* frame = (wxFrame*) this;
if (frame->GetMenuBar())
return wxPoint(0, frame->GetMenuBar()->GetSize().y);
}
return wxPoint(0, 0);
}
void wxTopLevelWindowX11::DoGetClientSize( int *width, int *height ) const
{
wxWindowX11::DoGetClientSize(width, height);
if (this->IsKindOf(CLASSINFO(wxFrame)))
{
wxFrame* frame = (wxFrame*) this;
if (frame->GetMenuBar())
(*height) -= frame->GetMenuBar()->GetSize().y;
if (frame->GetStatusBar())
(*height) -= frame->GetStatusBar()->GetSize().y;
}
}
void wxTopLevelWindowX11::DoSetClientSize(int width, int height)
{
// TODO - take menubar and status line into account
wxWindowX11::DoSetClientSize(width, height);
#if 0
if (!GetMainWindow())
return;
XWindowChanges windowChanges;
int valueMask = 0;
if (width != -1)
{
windowChanges.width = width ;
valueMask |= CWWidth;
}
if (height != -1)
{
windowChanges.height = height ;
valueMask |= CWHeight;
}
XConfigureWindow(wxGlobalDisplay(), (Window) GetMainWindow(),
valueMask, & windowChanges);
#endif
}

View File

@@ -719,11 +719,15 @@ void wxWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
if (x != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) if (x != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
{ {
int yy = 0;
AdjustForParentClientOrigin( x, yy, sizeFlags);
windowChanges.x = x; windowChanges.x = x;
valueMask |= CWX; valueMask |= CWX;
} }
if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
{ {
int xx = 0;
AdjustForParentClientOrigin( xx, y, sizeFlags);
windowChanges.y = y; windowChanges.y = y;
valueMask |= CWY; valueMask |= CWY;
} }
@@ -737,7 +741,6 @@ void wxWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
windowChanges.height = height /* -m_borderSize*2*/; windowChanges.height = height /* -m_borderSize*2*/;
valueMask |= CWHeight; valueMask |= CWHeight;
} }
AdjustForParentClientOrigin( x, y, sizeFlags);
XConfigureWindow(wxGlobalDisplay(), (Window) GetMainWindow(), XConfigureWindow(wxGlobalDisplay(), (Window) GetMainWindow(),
valueMask, & windowChanges); valueMask, & windowChanges);