]> git.saurik.com Git - wxWidgets.git/commitdiff
Attempts to get client origin working. Work in progress.
authorJulian Smart <julian@anthemion.co.uk>
Tue, 12 Feb 2002 12:59:14 +0000 (12:59 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 12 Feb 2002 12:59:14 +0000 (12:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14153 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/x11/colour.h
include/wx/x11/toplevel.h
src/univ/framuniv.cpp
src/x11/dcclient.cpp
src/x11/toplevel.cpp
src/x11/window.cpp

index 884b849c57c8540209e173a8b73499270ed4a96d..3e1db7ddd67f43e58f99e0524aa47e8c48567e25 100644 (file)
@@ -94,4 +94,5 @@ private:
 
 #endif
 
-// _WX_COLOUR_H_
\ No newline at end of file
+// _WX_COLOUR_H_
+
index 2f05fec5083763d719520f1b3c298dc71febf85e..de89221ca1ab7682712fb450413303ec395ffa55 100644 (file)
@@ -72,6 +72,13 @@ protected:
     // common part of all ctors
     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?
     bool m_iconized;
 
index 2ea330be1d8ba4602a2f383828e0a343106d02fa..ae8f7cf2215844541a742efe64c9d444b716f7b6 100644 (file)
@@ -96,6 +96,7 @@ void wxFrame::PositionMenuBar()
         // the menubar is positioned above the client size, hence the negative
         // y coord
         wxCoord heightMbar = m_frameMenuBar->GetSize().y;
+
         m_frameMenuBar->SetSize(0, 
 #ifdef __WXPM__         // FIXME -- remove this, make wxOS2/Univ behave as
                  //          the rest of the world!!!
index f367f145feead23de358685d14d9e203f8870c77..53a0311a55fb7f5364e1d7ba8fbc0083e885cdef 100644 (file)
@@ -342,6 +342,8 @@ void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
 
         CalcBoundingBox(x1, y1);
         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 + 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 )
@@ -1246,6 +1249,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
        {
         XDrawString( (Display*) m_display, (Window) m_window, 
             (GC) m_textGC, x, y, text.c_str(), text.Len() );
+       wxLogDebug("Drawing text %s at %d, %d", text.c_str(), x, y);
        }
 
 #if 0
index e139ee21a4978ff3db88e17e3fd51a20f482bb6d..101ef8e4462d2daa0514e94cf4ba417b65bca757 100644 (file)
     #include "wx/log.h"
     #include "wx/intl.h"
     #include "wx/frame.h"
+    #include "wx/menu.h"
+    #include "wx/statusbr.h"
 #endif //WX_PRECOMP
 
 #include "wx/x11/private.h"
 
-
 bool wxMWMIsRunning(Window w);
 
 // ----------------------------------------------------------------------------
@@ -396,3 +397,54 @@ bool wxMWMIsRunning(Window w)
     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
+}
index da1a164a6da4d0b4a13f8c25e1636daff257d580..a9bb558858c03f079fa5e1b021c2acefc91e8c49 100644 (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))
     {
+       int yy = 0;
+        AdjustForParentClientOrigin( x, yy, sizeFlags);
         windowChanges.x = x;
         valueMask |= CWX;
     }
     if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     {
+       int xx = 0;
+        AdjustForParentClientOrigin( xx, y, sizeFlags);
         windowChanges.y = y;
         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*/;
         valueMask |= CWHeight;
     }
-    AdjustForParentClientOrigin( x, y, sizeFlags);
 
     XConfigureWindow(wxGlobalDisplay(), (Window) GetMainWindow(),
         valueMask, & windowChanges);