added wxDisplay::GetClientArea() (currently implemented for single display and MSW implementations only)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-03-16 16:07:24 +00:00
parent 480abc8fdb
commit 6c5d62917d
7 changed files with 57 additions and 1 deletions

View File

@@ -94,6 +94,7 @@ All (GUI):
- UpdateUI handler can now show/hide the window too (Ronald Weiss) - UpdateUI handler can now show/hide the window too (Ronald Weiss)
- More than one filter allowed in in wxDocTemplate filter. - More than one filter allowed in in wxDocTemplate filter.
- Added wxListBox::HitTest() - Added wxListBox::HitTest()
- Added wxDisplay::GetClientArea()
wxMSW: wxMSW:

View 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} \membersection{wxDisplay::GetCount}\label{wxdisplaygetcount}
\func{static size\_t}{GetCount}{\void} \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 Returns the bounding rectangle of the display whose index was passed to the
constructor. constructor.
\wxheading{See also:}
\helpref{GetClientArea}{wxdisplaygetclientarea}, \helpref{wxDisplaySize}{wxdisplaysize}
\membersection{wxDisplay::GetModes}\label{wxdisplaygetmodes} \membersection{wxDisplay::GetModes}\label{wxdisplaygetmodes}

View File

@@ -68,9 +68,12 @@ public:
// return true if the object was initialized successfully // return true if the object was initialized successfully
bool IsOk() const { return m_impl != NULL; } 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 // name may be empty
wxString GetName() const; wxString GetName() const;

View File

@@ -52,6 +52,9 @@ public:
// return the full area of this display // return the full area of this display
virtual wxRect GetGeometry() const = 0; 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) // return the name (may be empty)
virtual wxString GetName() const = 0; virtual wxString GetName() const = 0;

View 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, _T("Name: ")));
sizer->Add(new wxStaticText(page, wxID_ANY, display.GetName())); sizer->Add(new wxStaticText(page, wxID_ANY, display.GetName()));

View File

@@ -68,6 +68,8 @@ public:
return r; return r;
} }
virtual wxRect GetClientArea() const { return wxGetClientDisplayRect(); }
virtual wxString GetName() const { return wxString(); } virtual wxString GetName() const { return wxString(); }
#if wxUSE_DISPLAY #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 wxString wxDisplay::GetName() const
{ {
wxCHECK_MSG( IsOk(), wxString(), _T("invalid wxDisplay object") ); wxCHECK_MSG( IsOk(), wxString(), _T("invalid wxDisplay object") );

View File

@@ -142,6 +142,9 @@ struct wxDisplayInfo
// the entire area of this monitor in virtual screen coordinates // the entire area of this monitor in virtual screen coordinates
wxRect m_rect; 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 // the display device name for this monitor, empty initially and retrieved
// on demand by DoGetName() // on demand by DoGetName()
wxString m_devName; 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 wxString GetName() const;
virtual bool IsPrimary() 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_devName = monInfo.szDevice;
m_flags = monInfo.dwFlags; 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 wxString wxDisplayImplWin32Base::GetName() const
{ {
if ( m_info.m_devName.IsEmpty() ) if ( m_info.m_devName.IsEmpty() )