Use system colours

Fixed handling of scrollbar heigh/width


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36650 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis
2006-01-02 21:26:13 +00:00
parent 395936d860
commit ad4e3f7be6
3 changed files with 38 additions and 26 deletions

View File

@@ -192,11 +192,11 @@ bool wxListBox::Create(
SetFont(*pTextFont); SetFont(*pTextFont);
// //
// Set standard wxWidgets colors for Listbox items and highlighting // Set OS/2 system colours for Listbox items and highlighting
// //
wxColour vColour; wxColour vColour;
vColour.Set(wxString(wxT("WHITE"))); vColour = wxSystemSettingsNative::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
LONG lColor = (LONG)vColour.GetPixel(); LONG lColor = (LONG)vColour.GetPixel();
@@ -205,7 +205,7 @@ bool wxListBox::Create(
,sizeof(LONG) ,sizeof(LONG)
,(PVOID)&lColor ,(PVOID)&lColor
); );
vColour.Set(wxString(wxT("NAVY"))); vColour = wxSystemSettingsNative::GetColour(wxSYS_COLOUR_HIGHLIGHT);
lColor = (LONG)vColour.GetPixel(); lColor = (LONG)vColour.GetPixel();
::WinSetPresParam( m_hWnd ::WinSetPresParam( m_hWnd
,PP_HILITEBACKGROUNDCOLOR ,PP_HILITEBACKGROUNDCOLOR
@@ -213,6 +213,8 @@ bool wxListBox::Create(
,(PVOID)&lColor ,(PVOID)&lColor
); );
SetXComp(0);
SetYComp(0);
SetSize( nX SetSize( nX
,nY ,nY
,nWidth ,nWidth

View File

@@ -34,6 +34,7 @@
#include "wx/frame.h" #include "wx/frame.h"
#include "wx/control.h" #include "wx/control.h"
#include "wx/containr.h" // wxSetFocusToChild() #include "wx/containr.h" // wxSetFocusToChild()
#include "wx/settings.h"
#endif //WX_PRECOMP #endif //WX_PRECOMP
#include "wx/module.h" // wxSetFocusToChild() #include "wx/module.h" // wxSetFocusToChild()
@@ -407,7 +408,7 @@ bool wxTopLevelWindowOS2::CreateDialog( ULONG ulDlgTemplate,
nX = (vSizeDpy.x - nWidth) / 2; nX = (vSizeDpy.x - nWidth) / 2;
nY = (vSizeDpy.y - nHeight) / 2; nY = (vSizeDpy.y - nHeight) / 2;
} }
m_backgroundColour.Set(wxString(wxT("LIGHT GREY"))); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
LONG lColor = (LONG)m_backgroundColour.GetPixel(); LONG lColor = (LONG)m_backgroundColour.GetPixel();
@@ -502,7 +503,7 @@ bool wxTopLevelWindowOS2::CreateFrame( const wxString& rsTitle,
wxAssociateWinWithHandle(m_hWnd, this); wxAssociateWinWithHandle(m_hWnd, this);
wxAssociateWinWithHandle(m_hFrame, this); wxAssociateWinWithHandle(m_hFrame, this);
m_backgroundColour.Set(wxString(wxT("MEDIUM GREY"))); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
LONG lColor = (LONG)m_backgroundColour.GetPixel(); LONG lColor = (LONG)m_backgroundColour.GetPixel();

View File

@@ -725,6 +725,10 @@ void wxWindowOS2::SetScrollbar( int nOrient,
int nOldRange = nRange - nThumbVisible; int nOldRange = nRange - nThumbVisible;
int nRange1 = nOldRange; int nRange1 = nOldRange;
int nPageSize = nThumbVisible; int nPageSize = nThumbVisible;
int nVSBWidth = wxSystemSettingsNative::GetMetric(wxSYS_VSCROLL_X,
this);
int nHSBHeight = wxSystemSettingsNative::GetMetric(wxSYS_HSCROLL_Y,
this);
SBCDATA vInfo; SBCDATA vInfo;
ULONG ulStyle = WS_VISIBLE | WS_SYNCPAINT; ULONG ulStyle = WS_VISIBLE | WS_SYNCPAINT;
@@ -786,8 +790,8 @@ void wxWindowOS2::SetScrollbar( int nOrient,
,ulStyle ,ulStyle
,vSwp.x ,vSwp.x
,vSwp.y ,vSwp.y
,vSwp.cx - 20 ,vSwp.cx - nVSBWidth
,20 ,nHSBHeight
,hWnd ,hWnd
,HWND_TOP ,HWND_TOP
,60000 ,60000
@@ -804,18 +808,19 @@ void wxWindowOS2::SetScrollbar( int nOrient,
// origin, not the frame's client window origin. // origin, not the frame's client window origin.
// The starting x position is the same as the starting x position // The starting x position is the same as the starting x position
// of the owner, but in terms of the parent frame. // of the owner, but in terms of the parent frame.
// The starting y position is 20 pels below the origin of the // The starting y position is wxSYS_HSCROLL_Y pels below the
// owner in terms of the parent frame. // origin of the owner in terms of the parent frame.
// The horz bar is the same width as the owner and 20 pels high. // The horz bar is the same width as the owner and wxSYS_HSCROLL_Y
// pels high.
// //
if (nRange1 >= nThumbVisible) if (nRange1 >= nThumbVisible)
{ {
::WinSetWindowPos( m_hWndScrollBarHorz ::WinSetWindowPos( m_hWndScrollBarHorz
,HWND_TOP ,HWND_TOP
,vSwp.x + vSwpOwner.x ,vSwp.x + vSwpOwner.x
,(vSwp.y + vSwpOwner.y) - 20 ,(vSwp.y + vSwpOwner.y) - nHSBHeight
,vSwpOwner.cx ,vSwpOwner.cx
,20 ,nHSBHeight
,SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER ,SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER
); );
::WinSendMsg( m_hWndScrollBarHorz ::WinSendMsg( m_hWndScrollBarHorz
@@ -856,10 +861,10 @@ void wxWindowOS2::SetScrollbar( int nOrient,
,WC_SCROLLBAR ,WC_SCROLLBAR
,(PSZ)NULL ,(PSZ)NULL
,ulStyle ,ulStyle
,vSwp.x + vSwp.cx - 20 ,vSwp.x + vSwp.cx - nVSBWidth
,vSwp.y + 20 ,vSwp.y + nHSBHeight
,20 ,nVSBWidth
,vSwp.cy - 20 ,vSwp.cy - nHSBHeight
,hWnd ,hWnd
,HWND_TOP ,HWND_TOP
,60001 ,60001
@@ -882,7 +887,7 @@ void wxWindowOS2::SetScrollbar( int nOrient,
// position of the scrollbar relative to the parent frame (the vert // position of the scrollbar relative to the parent frame (the vert
// scrollbar is on the right and starts at the bottom of the // scrollbar is on the right and starts at the bottom of the
// owner window). // owner window).
// It is 20 pels wide and the same height as the owner. // It is wxSYS_VSCROLL_X pels wide and the same height as the owner.
// //
if (nRange1 >= nThumbVisible) if (nRange1 >= nThumbVisible)
{ {
@@ -890,7 +895,7 @@ void wxWindowOS2::SetScrollbar( int nOrient,
,HWND_TOP ,HWND_TOP
,vSwp.x + vSwpOwner.x + vSwpOwner.cx ,vSwp.x + vSwpOwner.x + vSwpOwner.cx
,vSwp.y + vSwpOwner.y ,vSwp.y + vSwpOwner.y
,20 ,nVSBWidth
,vSwpOwner.cy ,vSwpOwner.cy
,SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW ,SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW
); );
@@ -1556,17 +1561,17 @@ void wxWindowOS2::DoMoveWindow(
// //
// Uninitialized // Uninitialized
// //
::WinQueryWindowPos(GetHwnd(), &m_vWinSwp); ::WinQueryWindowPos(hWnd, &m_vWinSwp);
else else
{ {
int nYDiff = m_vWinSwp.cy - nHeight; int nYDiff = m_vWinSwp.cy - nHeight;
// //
// Handle resizing of scrolled windows. The target or window to // Handle resizing of scrolled windows. The target or window to
// be scrolled is the owner (gets the scroll notificaitons). The // be scrolled is the owner (gets the scroll notifications). The
// parent is usually the parent frame of the scrolled panel window. // parent is usually the parent frame of the scrolled panel window.
// In order to show the scrollbars the target window will be shrunk // In order to show the scrollbars the target window will be shrunk
// by the size of the scroll bar widths (20) and moved in the X and Y // by the size of the scroll bar widths and moved in the X and Y
// directon. That value will be computed as part of the diff for // directon. That value will be computed as part of the diff for
// moving the children. Everytime the window is sized the // moving the children. Everytime the window is sized the
// toplevel OnSize is going to resize the panel to fit the client // toplevel OnSize is going to resize the panel to fit the client
@@ -1579,20 +1584,24 @@ void wxWindowOS2::DoMoveWindow(
{ {
int nAdjustWidth = 0; int nAdjustWidth = 0;
int nAdjustHeight = 0; int nAdjustHeight = 0;
int nHSBHeight = wxSystemSettingsNative::GetMetric(wxSYS_HSCROLL_Y,
this);
int nVSBWidth = wxSystemSettingsNative::GetMetric(wxSYS_VSCROLL_X,
this);
SWP vSwpScroll; SWP vSwpScroll;
if (GetScrollBarHorz() == NULLHANDLE || if (GetScrollBarHorz() == NULLHANDLE ||
!WinIsWindowShowing(GetScrollBarHorz())) !WinIsWindowShowing(GetScrollBarHorz()))
nAdjustHeight = 0L; nAdjustHeight = 0L;
else else
nAdjustHeight = 20L; nAdjustHeight = nHSBHeight;
if (GetScrollBarVert() == NULLHANDLE || if (GetScrollBarVert() == NULLHANDLE ||
!WinIsWindowShowing(GetScrollBarVert())) !WinIsWindowShowing(GetScrollBarVert()))
nAdjustWidth = 0L; nAdjustWidth = 0L;
else else
nAdjustWidth = 20L; nAdjustWidth = nVSBWidth;
::WinQueryWindowPos(GetHWND(), &vSwpScroll); ::WinQueryWindowPos(hWnd, &vSwpScroll);
::WinSetWindowPos( GetHWND() ::WinSetWindowPos( hWnd
,HWND_TOP ,HWND_TOP
,vSwpScroll.x ,vSwpScroll.x
,vSwpScroll.y + nAdjustHeight ,vSwpScroll.y + nAdjustHeight
@@ -3114,7 +3123,7 @@ bool wxWindowOS2::OS2Create( PSZ zClass,
SubclassWin(m_hWnd); SubclassWin(m_hWnd);
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
m_backgroundColour.Set(wxString(wxT("GREY"))); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
LONG lColor = (LONG)m_backgroundColour.GetPixel(); LONG lColor = (LONG)m_backgroundColour.GetPixel();