Implemented wxGetClientDisplayRect which returns the dimensions of the

desktop minus taskbar, etc. on Windows and defaults to the full
desktop dimensions on other platforms.  (If there is a way to do it
for other platforms please do.)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-04-30 20:55:11 +00:00
parent 926bb76c2a
commit ec5d77998a
11 changed files with 182 additions and 76 deletions

View File

@@ -932,6 +932,18 @@ The following are relevant to the GDI (Graphics Device Interface).
<wx/gdicmn.h> <wx/gdicmn.h>
\membersection{::wxClientDisplayRect}
\func{void}{wxClientDisplayRect}{\param{int *}{x}, \param{int *}{y},
\param{int *}{width}, \param{int *}{height}}
\func{wxRect}{wxGetClientDisplayRect}{\void}
Returns the dimensions of the work area on the display. On Windows
this means the area not covered by the taskbar, etc. Other platforms
are currently defaulting to the whole display until a way is found to
provide this info for all window managers, etc.
\membersection{::wxColourDisplay} \membersection{::wxColourDisplay}
\func{bool}{wxColourDisplay}{\void} \func{bool}{wxColourDisplay}{\void}

View File

@@ -509,6 +509,10 @@ extern wxSize WXDLLEXPORT wxGetDisplaySize();
extern void WXDLLEXPORT wxDisplaySizeMM(int *width, int *height); extern void WXDLLEXPORT wxDisplaySizeMM(int *width, int *height);
extern wxSize WXDLLEXPORT wxGetDisplaySizeMM(); extern wxSize WXDLLEXPORT wxGetDisplaySizeMM();
// Get position and size of the display workarea
extern void WXDLLEXPORT wxClientDisplayRect(int *x, int *y, int *width, int *height);
extern wxRect WXDLLEXPORT wxGetClientDisplayRect();
// set global cursor // set global cursor
extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor); extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);

View File

@@ -723,6 +723,13 @@ wxSize wxGetDisplaySize()
return wxSize(x, y); return wxSize(x, y);
} }
wxRect wxGetClientDisplayRect()
{
int x, y, width, height;
wxClientDisplayRect(&x, &y, &width, &height); // call plat-specific version
return wxRect(x, y, width, height);
}
wxSize wxGetDisplaySizeMM() wxSize wxGetDisplaySizeMM()
{ {
int x, y; int x, y;

View File

@@ -94,6 +94,17 @@ void wxDisplaySizeMM( int *width, int *height )
if (height) *height = gdk_screen_height_mm(); if (height) *height = gdk_screen_height_mm();
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
// This is supposed to return desktop dimensions minus any window
// manager panels, menus, taskbars, etc. If there is a way to do that
// for this platform please fix this function, otherwise it defaults
// to the entire desktop.
if (x) *x = 0;
if (y) *y = 0;
wxDisplaySize(width, height);
}
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition( int* x, int* y )
{ {
gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL ); gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );

View File

@@ -94,6 +94,17 @@ void wxDisplaySizeMM( int *width, int *height )
if (height) *height = gdk_screen_height_mm(); if (height) *height = gdk_screen_height_mm();
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
// This is supposed to return desktop dimensions minus any window
// manager panels, menus, taskbars, etc. If there is a way to do that
// for this platform please fix this function, otherwise it defaults
// to the entire desktop.
if (x) *x = 0;
if (y) *y = 0;
wxDisplaySize(width, height);
}
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition( int* x, int* y )
{ {
gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL ); gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );

View File

@@ -350,6 +350,17 @@ void wxDisplaySizeMM(int *width, int *height)
wxDisplaySize(width, height); wxDisplaySize(width, height);
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
// This is supposed to return desktop dimensions minus any window
// manager panels, menus, taskbars, etc. If there is a way to do that
// for this platform please fix this function, otherwise it defaults
// to the entire desktop.
if (x) *x = 0;
if (y) *y = 0;
wxDisplaySize(width, height);
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt) wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
{ {
return wxGenericFindWindowAtPoint(pt); return wxGenericFindWindowAtPoint(pt);

View File

@@ -350,6 +350,17 @@ void wxDisplaySizeMM(int *width, int *height)
wxDisplaySize(width, height); wxDisplaySize(width, height);
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
// This is supposed to return desktop dimensions minus any window
// manager panels, menus, taskbars, etc. If there is a way to do that
// for this platform please fix this function, otherwise it defaults
// to the entire desktop.
if (x) *x = 0;
if (y) *y = 0;
wxDisplaySize(width, height);
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt) wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
{ {
return wxGenericFindWindowAtPoint(pt); return wxGenericFindWindowAtPoint(pt);

View File

@@ -658,6 +658,18 @@ void wxDisplaySizeMM(int *width, int *height)
*height = DisplayHeightMM(dpy, DefaultScreen (dpy)); *height = DisplayHeightMM(dpy, DefaultScreen (dpy));
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
// This is supposed to return desktop dimensions minus any window
// manager panels, menus, taskbars, etc. If there is a way to do that
// for this platform please fix this function, otherwise it defaults
// to the entire desktop.
if (x) *x = 0;
if (y) *y = 0;
wxDisplaySize(width, height);
}
// Configurable display in Motif // Configurable display in Motif
static WXDisplay *gs_currentDisplay = NULL; static WXDisplay *gs_currentDisplay = NULL;
static wxString gs_displayName; static wxString gs_displayName;

View File

@@ -1032,6 +1032,18 @@ void wxDisplaySizeMM(int *width, int *height)
if ( height ) *height = GetDeviceCaps(dc, VERTSIZE); if ( height ) *height = GetDeviceCaps(dc, VERTSIZE);
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
// Determine the desktop dimensions minus the taskbar and any other
// special decorations...
RECT r;
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
if (x) *x = r.left;
if (y) *y = r.top;
if (width) *width = r.right - r.left;
if (height) *height = r.bottom - r.top;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// window information functions // window information functions

View File

@@ -823,6 +823,18 @@ void wxDisplaySizeMM(
); );
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
// This is supposed to return desktop dimensions minus any window
// manager panels, menus, taskbars, etc. If there is a way to do that
// for this platform please fix this function, otherwise it defaults
// to the entire desktop.
if (x) *x = 0;
if (y) *y = 0;
wxDisplaySize(width, height);
}
bool wxDirExists( bool wxDirExists(
const wxString& rDir const wxString& rDir
) )

View File

@@ -120,6 +120,9 @@ wxSize wxGetDisplaySize();
void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT); void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT);
wxSize wxGetDisplaySizeMM(); wxSize wxGetDisplaySizeMM();
void wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT);
wxRect wxGetClientDisplayRect();
void wxSetCursor(wxCursor& cursor); void wxSetCursor(wxCursor& cursor);
//---------------------------------------------------------------------- //----------------------------------------------------------------------