]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxDisplay::GetClientArea() (currently implemented for single display and MSW...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 16 Mar 2006 16:07:24 +0000 (16:07 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 16 Mar 2006 16:07:24 +0000 (16:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
docs/latex/wx/display.tex
include/wx/display.h
include/wx/display_impl.h
samples/display/display.cpp
src/common/dpycmn.cpp
src/msw/display.cpp

index a3d46f88dea373d1f92124ec23c7019ff09e67dd..1fe885015c0294efcdb8468c62549e2e8b0e3442 100644 (file)
@@ -94,6 +94,7 @@ All (GUI):
 - UpdateUI handler can now show/hide the window too (Ronald Weiss)
 - More than one filter allowed in in wxDocTemplate filter.
 - Added wxListBox::HitTest()
 - UpdateUI handler can now show/hide the window too (Ronald Weiss)
 - More than one filter allowed in in wxDocTemplate filter.
 - Added wxListBox::HitTest()
+- Added wxDisplay::GetClientArea()
 
 wxMSW:
 
 
 wxMSW:
 
index b2c80bd300545be8050545df3c1dde3e688bed7d..fd78c8f15e59d66a1246ba6f901eb296b7cae4ab 100644 (file)
@@ -57,6 +57,20 @@ function that changed the video mode to the system
 default by using the system's 'scrn' resource.
 
 
 default by using the system's 'scrn' resource.
 
 
+\membersection{wxDisplay::GetClientArea}\label{wxdisplaygetclientarea}
+
+\constfunc{wxRect }{GetClientArea}{\void}
+
+Returns the client area of the display. The client area is the part of the
+display available for the normal (non full screen) windows, usually it is the
+same as \helpref{GetGeometry}{wxdisplaygetgeometry} but it could be less if
+there is a taskbar (or equivalent) on this display.
+
+\wxheading{See also:}
+
+\helpref{wxClientDisplayRect}{wxclientdisplayrect}
+
+
 \membersection{wxDisplay::GetCount}\label{wxdisplaygetcount}
 
 \func{static size\_t}{GetCount}{\void}
 \membersection{wxDisplay::GetCount}\label{wxdisplaygetcount}
 
 \func{static size\_t}{GetCount}{\void}
@@ -112,6 +126,10 @@ Returns \texttt{wxNOT\_FOUND} if the window is not on any connected display.
 Returns the bounding rectangle of the display whose index was passed to the
 constructor.
 
 Returns the bounding rectangle of the display whose index was passed to the
 constructor.
 
+\wxheading{See also:}
+
+\helpref{GetClientArea}{wxdisplaygetclientarea}, \helpref{wxDisplaySize}{wxdisplaysize}
+
 
 \membersection{wxDisplay::GetModes}\label{wxdisplaygetmodes}
 
 
 \membersection{wxDisplay::GetModes}\label{wxdisplaygetmodes}
 
index 3429258eb6fc2b04ff38645fb17a25e1dfea04ad..002ce99ceda59926b051fb85a675d92b787c3096 100644 (file)
@@ -68,9 +68,12 @@ public:
     // return true if the object was initialized successfully
     bool IsOk() const { return m_impl != NULL; }
 
     // return true if the object was initialized successfully
     bool IsOk() const { return m_impl != NULL; }
 
-    // get the display size
+    // get the full display size
     wxRect GetGeometry() const;
 
     wxRect GetGeometry() const;
 
+    // get the client area of the display, i.e. without taskbars and such
+    wxRect GetClientArea() const;
+
     // name may be empty
     wxString GetName() const;
 
     // name may be empty
     wxString GetName() const;
 
index aa7e05ff0d678bedf03558a14a5a95cbeb7adc71..2a36d49d158ff2cb19a4bcaa767f274304adc91a 100644 (file)
@@ -52,6 +52,9 @@ public:
     // return the full area of this display
     virtual wxRect GetGeometry() const = 0;
 
     // return the full area of this display
     virtual wxRect GetGeometry() const = 0;
 
+    // return the area of the display available for normal windows
+    virtual wxRect GetClientArea() const { return GetGeometry(); }
+
     // return the name (may be empty)
     virtual wxString GetName() const = 0;
 
     // return the name (may be empty)
     virtual wxString GetName() const = 0;
 
index ff358cd01a6baf85a4d6e5965812f71ceb3d9dda..7ee089971d09884481c85f981437e7910e74bcc0 100644 (file)
@@ -260,6 +260,15 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
                                          r.width, r.height)
                        ));
 
                                          r.width, r.height)
                        ));
 
+        const wxRect rc(display.GetClientArea());
+        sizer->Add(new wxStaticText(page, wxID_ANY, _T("Client area: ")));
+        sizer->Add(new wxStaticText
+                       (
+                        page,
+                        wxID_ANY,
+                        wxString::Format(_T("(%d, %d)-(%d, %d)"),
+                                         rc.x, rc.y, rc.width, rc.height)
+                       ));
 
         sizer->Add(new wxStaticText(page, wxID_ANY, _T("Name: ")));
         sizer->Add(new wxStaticText(page, wxID_ANY, display.GetName()));
 
         sizer->Add(new wxStaticText(page, wxID_ANY, _T("Name: ")));
         sizer->Add(new wxStaticText(page, wxID_ANY, display.GetName()));
index b30084f099d260005b683121eab0258b1b51bf61..d375d9e49486c45def38db9e410808053a4ab381 100644 (file)
@@ -68,6 +68,8 @@ public:
         return r;
     }
 
         return r;
     }
 
+    virtual wxRect GetClientArea() const { return wxGetClientDisplayRect(); }
+
     virtual wxString GetName() const { return wxString(); }
 
 #if wxUSE_DISPLAY
     virtual wxString GetName() const { return wxString(); }
 
 #if wxUSE_DISPLAY
@@ -162,6 +164,13 @@ wxRect wxDisplay::GetGeometry() const
     return m_impl->GetGeometry();
 }
 
     return m_impl->GetGeometry();
 }
 
+wxRect wxDisplay::GetClientArea() const
+{
+    wxCHECK_MSG( IsOk(), wxRect(), _T("invalid wxDisplay object") );
+
+    return m_impl->GetClientArea();
+}
+
 wxString wxDisplay::GetName() const
 {
     wxCHECK_MSG( IsOk(), wxString(), _T("invalid wxDisplay object") );
 wxString wxDisplay::GetName() const
 {
     wxCHECK_MSG( IsOk(), wxString(), _T("invalid wxDisplay object") );
index 639737d549aa458046480b7fd8351106a2d974fd..40300953d5067332d58d2425be13214a02629ad1 100644 (file)
@@ -142,6 +142,9 @@ struct wxDisplayInfo
     // the entire area of this monitor in virtual screen coordinates
     wxRect m_rect;
 
     // the entire area of this monitor in virtual screen coordinates
     wxRect m_rect;
 
+    // the work or client area, i.e. the area available for the normal windows
+    wxRect m_rectClient;
+
     // the display device name for this monitor, empty initially and retrieved
     // on demand by DoGetName()
     wxString m_devName;
     // the display device name for this monitor, empty initially and retrieved
     // on demand by DoGetName()
     wxString m_devName;
@@ -167,6 +170,7 @@ public:
     }
 
     virtual wxRect GetGeometry() const;
     }
 
     virtual wxRect GetGeometry() const;
+    virtual wxRect GetClientArea() const;
     virtual wxString GetName() const;
     virtual bool IsPrimary() const;
 
     virtual wxString GetName() const;
     virtual bool IsPrimary() const;
 
@@ -415,6 +419,7 @@ void wxDisplayInfo::Initialize()
         }
 
         wxCopyRECTToRect(monInfo.rcMonitor, m_rect);
         }
 
         wxCopyRECTToRect(monInfo.rcMonitor, m_rect);
+        wxCopyRECTToRect(monInfo.rcWork, m_rectClient);
         m_devName = monInfo.szDevice;
         m_flags = monInfo.dwFlags;
     }
         m_devName = monInfo.szDevice;
         m_flags = monInfo.dwFlags;
     }
@@ -432,6 +437,14 @@ wxRect wxDisplayImplWin32Base::GetGeometry() const
     return m_info.m_rect;
 }
 
     return m_info.m_rect;
 }
 
+wxRect wxDisplayImplWin32Base::GetClientArea() const
+{
+    if ( m_info.m_rectClient.IsEmpty() )
+        m_info.Initialize();
+
+    return m_info.m_rectClient;
+}
+
 wxString wxDisplayImplWin32Base::GetName() const
 {
     if ( m_info.m_devName.IsEmpty() )
 wxString wxDisplayImplWin32Base::GetName() const
 {
     if ( m_info.m_devName.IsEmpty() )