allow wxDisplaySize to be called with NULL parameters
implement GetMetric for wxSYS_SCREEN_X & wxSYS_SCREEN_X using wxDisplaySize git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20752 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -151,10 +151,13 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
|||||||
// Get a system metric, e.g. scrollbar size
|
// Get a system metric, e.g. scrollbar size
|
||||||
int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
|
int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
|
||||||
{
|
{
|
||||||
|
int value;
|
||||||
|
|
||||||
switch ( index)
|
switch ( index)
|
||||||
{
|
{
|
||||||
case wxSYS_MOUSE_BUTTONS:
|
case wxSYS_MOUSE_BUTTONS:
|
||||||
return 2; // we emulate a two button mouse (ctrl + click = right button )
|
// we emulate a two button mouse (ctrl + click = right button )
|
||||||
|
return 2;
|
||||||
case wxSYS_BORDER_X:
|
case wxSYS_BORDER_X:
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
@@ -210,11 +213,11 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
|
|||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
case wxSYS_SCREEN_X:
|
case wxSYS_SCREEN_X:
|
||||||
// TODO
|
wxDisplaySize(&value, NULL);
|
||||||
return 0;
|
return value;
|
||||||
case wxSYS_SCREEN_Y:
|
case wxSYS_SCREEN_Y:
|
||||||
// TODO
|
wxDisplaySize(NULL, &value);
|
||||||
return 0;
|
return value;
|
||||||
case wxSYS_FRAMESIZE_X:
|
case wxSYS_FRAMESIZE_X:
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -458,8 +458,12 @@ void wxDisplaySize(int *width, int *height)
|
|||||||
BitMap screenBits;
|
BitMap screenBits;
|
||||||
GetQDGlobalsScreenBits( &screenBits );
|
GetQDGlobalsScreenBits( &screenBits );
|
||||||
|
|
||||||
|
if (width != NULL) {
|
||||||
*width = screenBits.bounds.right - screenBits.bounds.left ;
|
*width = screenBits.bounds.right - screenBits.bounds.left ;
|
||||||
|
}
|
||||||
|
if (height != NULL) {
|
||||||
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
|
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDisplaySizeMM(int *width, int *height)
|
void wxDisplaySizeMM(int *width, int *height)
|
||||||
@@ -467,8 +471,13 @@ void wxDisplaySizeMM(int *width, int *height)
|
|||||||
wxDisplaySize(width, height);
|
wxDisplaySize(width, height);
|
||||||
// on mac 72 is fixed (at least now ;-)
|
// on mac 72 is fixed (at least now ;-)
|
||||||
float cvPt2Mm = 25.4 / 72;
|
float cvPt2Mm = 25.4 / 72;
|
||||||
|
|
||||||
|
if (width != NULL) {
|
||||||
*width = int( *width * cvPt2Mm );
|
*width = int( *width * cvPt2Mm );
|
||||||
|
}
|
||||||
|
if (height != NULL) {
|
||||||
*height = int( *height * cvPt2Mm );
|
*height = int( *height * cvPt2Mm );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
||||||
@@ -479,8 +488,12 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
|||||||
if (x) *x = 0;
|
if (x) *x = 0;
|
||||||
if (y) *y = 0;
|
if (y) *y = 0;
|
||||||
|
|
||||||
|
if (width != NULL) {
|
||||||
*width = screenBits.bounds.right - screenBits.bounds.left ;
|
*width = screenBits.bounds.right - screenBits.bounds.left ;
|
||||||
|
}
|
||||||
|
if (height != NULL) {
|
||||||
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
|
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
|
||||||
|
}
|
||||||
|
|
||||||
SInt16 mheight ;
|
SInt16 mheight ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -488,8 +501,10 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
|||||||
#else
|
#else
|
||||||
mheight = LMGetMBarHeight() ;
|
mheight = LMGetMBarHeight() ;
|
||||||
#endif
|
#endif
|
||||||
|
if (height != NULL) {
|
||||||
*height -= mheight ;
|
*height -= mheight ;
|
||||||
if ( y )
|
}
|
||||||
|
if (y)
|
||||||
*y = mheight ;
|
*y = mheight ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -151,10 +151,13 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
|||||||
// Get a system metric, e.g. scrollbar size
|
// Get a system metric, e.g. scrollbar size
|
||||||
int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
|
int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
|
||||||
{
|
{
|
||||||
|
int value;
|
||||||
|
|
||||||
switch ( index)
|
switch ( index)
|
||||||
{
|
{
|
||||||
case wxSYS_MOUSE_BUTTONS:
|
case wxSYS_MOUSE_BUTTONS:
|
||||||
return 2; // we emulate a two button mouse (ctrl + click = right button )
|
// we emulate a two button mouse (ctrl + click = right button )
|
||||||
|
return 2;
|
||||||
case wxSYS_BORDER_X:
|
case wxSYS_BORDER_X:
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
@@ -210,11 +213,11 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
|
|||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
case wxSYS_SCREEN_X:
|
case wxSYS_SCREEN_X:
|
||||||
// TODO
|
wxDisplaySize(&value, NULL);
|
||||||
return 0;
|
return value;
|
||||||
case wxSYS_SCREEN_Y:
|
case wxSYS_SCREEN_Y:
|
||||||
// TODO
|
wxDisplaySize(NULL, &value);
|
||||||
return 0;
|
return value;
|
||||||
case wxSYS_FRAMESIZE_X:
|
case wxSYS_FRAMESIZE_X:
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -458,8 +458,12 @@ void wxDisplaySize(int *width, int *height)
|
|||||||
BitMap screenBits;
|
BitMap screenBits;
|
||||||
GetQDGlobalsScreenBits( &screenBits );
|
GetQDGlobalsScreenBits( &screenBits );
|
||||||
|
|
||||||
|
if (width != NULL) {
|
||||||
*width = screenBits.bounds.right - screenBits.bounds.left ;
|
*width = screenBits.bounds.right - screenBits.bounds.left ;
|
||||||
|
}
|
||||||
|
if (height != NULL) {
|
||||||
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
|
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDisplaySizeMM(int *width, int *height)
|
void wxDisplaySizeMM(int *width, int *height)
|
||||||
@@ -467,8 +471,13 @@ void wxDisplaySizeMM(int *width, int *height)
|
|||||||
wxDisplaySize(width, height);
|
wxDisplaySize(width, height);
|
||||||
// on mac 72 is fixed (at least now ;-)
|
// on mac 72 is fixed (at least now ;-)
|
||||||
float cvPt2Mm = 25.4 / 72;
|
float cvPt2Mm = 25.4 / 72;
|
||||||
|
|
||||||
|
if (width != NULL) {
|
||||||
*width = int( *width * cvPt2Mm );
|
*width = int( *width * cvPt2Mm );
|
||||||
|
}
|
||||||
|
if (height != NULL) {
|
||||||
*height = int( *height * cvPt2Mm );
|
*height = int( *height * cvPt2Mm );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
||||||
@@ -479,8 +488,12 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
|||||||
if (x) *x = 0;
|
if (x) *x = 0;
|
||||||
if (y) *y = 0;
|
if (y) *y = 0;
|
||||||
|
|
||||||
|
if (width != NULL) {
|
||||||
*width = screenBits.bounds.right - screenBits.bounds.left ;
|
*width = screenBits.bounds.right - screenBits.bounds.left ;
|
||||||
|
}
|
||||||
|
if (height != NULL) {
|
||||||
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
|
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
|
||||||
|
}
|
||||||
|
|
||||||
SInt16 mheight ;
|
SInt16 mheight ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -488,8 +501,10 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
|||||||
#else
|
#else
|
||||||
mheight = LMGetMBarHeight() ;
|
mheight = LMGetMBarHeight() ;
|
||||||
#endif
|
#endif
|
||||||
|
if (height != NULL) {
|
||||||
*height -= mheight ;
|
*height -= mheight ;
|
||||||
if ( y )
|
}
|
||||||
|
if (y)
|
||||||
*y = mheight ;
|
*y = mheight ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user