/////////////////////////////////////////////////////////////////////////////
-// Name: windows.cpp
+// Name: src/os2/window.cpp
// Purpose: wxWindow
// Author: David Webster
// Modified by:
pParent->AddChild(this);
hParent = GetWinHwnd(pParent);
- if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
- pParent->IsKindOf(CLASSINFO(wxScrolledWindow))
- )
+ if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)))
ulCreateFlags |= WS_CLIPSIBLINGS;
}
::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER | SWP_DEACTIVATE);
} // end of wxWindowOS2::Lower
-void wxWindowOS2::SetTitle( const wxString& rTitle )
+void wxWindowOS2::SetLabel( const wxString& label )
{
- ::WinSetWindowText(GetHwnd(), (PSZ)rTitle.c_str());
-} // end of wxWindowOS2::SetTitle
+ ::WinSetWindowText(GetHwnd(), (PSZ)label.c_str());
+} // end of wxWindowOS2::SetLabel
-wxString wxWindowOS2::GetTitle() const
+wxString wxWindowOS2::GetLabel() const
{
return wxGetWindowText(GetHWND());
-} // end of wxWindowOS2::GetTitle
+} // end of wxWindowOS2::GetLabel
void wxWindowOS2::DoCaptureMouse()
{
::WinSetCapture(HWND_DESKTOP, hWnd);
m_bWinCaptured = true;
}
-} // end of wxWindowOS2::GetTitle
+} // end of wxWindowOS2::DoCaptureMouse
void wxWindowOS2::DoReleaseMouse()
{
int nOldRange = nRange - nThumbVisible;
int nRange1 = nOldRange;
int nPageSize = nThumbVisible;
+ int nVSBWidth = wxSystemSettingsNative::GetMetric(wxSYS_VSCROLL_X,
+ this);
+ int nHSBHeight = wxSystemSettingsNative::GetMetric(wxSYS_HSCROLL_Y,
+ this);
SBCDATA vInfo;
ULONG ulStyle = WS_VISIBLE | WS_SYNCPAINT;
,ulStyle
,vSwp.x
,vSwp.y
- ,vSwp.cx - 20
- ,20
+ ,vSwp.cx - nVSBWidth
+ ,nHSBHeight
,hWnd
,HWND_TOP
,60000
// origin, not the frame's client window origin.
// The starting x position is the same as the starting x position
// of the owner, but in terms of the parent frame.
- // The starting y position is 20 pels below the 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 starting y position is wxSYS_HSCROLL_Y pels below the
+ // origin of the owner in terms of the parent frame.
+ // The horz bar is the same width as the owner and wxSYS_HSCROLL_Y
+ // pels high.
//
if (nRange1 >= nThumbVisible)
{
::WinSetWindowPos( m_hWndScrollBarHorz
,HWND_TOP
,vSwp.x + vSwpOwner.x
- ,(vSwp.y + vSwpOwner.y) - 20
+ ,(vSwp.y + vSwpOwner.y) - nHSBHeight
,vSwpOwner.cx
- ,20
+ ,nHSBHeight
,SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER
);
::WinSendMsg( m_hWndScrollBarHorz
,WC_SCROLLBAR
,(PSZ)NULL
,ulStyle
- ,vSwp.x + vSwp.cx - 20
- ,vSwp.y + 20
- ,20
- ,vSwp.cy - 20
+ ,vSwp.x + vSwp.cx - nVSBWidth
+ ,vSwp.y + nHSBHeight
+ ,nVSBWidth
+ ,vSwp.cy - nHSBHeight
,hWnd
,HWND_TOP
,60001
// position of the scrollbar relative to the parent frame (the vert
// scrollbar is on the right and starts at the bottom of the
// 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)
{
,HWND_TOP
,vSwp.x + vSwpOwner.x + vSwpOwner.cx
,vSwp.y + vSwpOwner.y
- ,20
+ ,nVSBWidth
,vSwpOwner.cy
,SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW
);
//
// 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.
// 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
// moving the children. Everytime the window is sized the
// toplevel OnSize is going to resize the panel to fit the client
// which will cause the scrollbars to be displayed via the SetScrollbar
// call in CWindow.
//
- if ( IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
- IsKindOf(CLASSINFO(wxScrolledWindow))
- )
+ if (IsKindOf(CLASSINFO(wxScrolledWindow)))
{
int nAdjustWidth = 0;
int nAdjustHeight = 0;
+ int nHSBHeight = wxSystemSettingsNative::GetMetric(wxSYS_HSCROLL_Y,
+ this);
+ int nVSBWidth = wxSystemSettingsNative::GetMetric(wxSYS_VSCROLL_X,
+ this);
SWP vSwpScroll;
if (GetScrollBarHorz() == NULLHANDLE ||
!WinIsWindowShowing(GetScrollBarHorz()))
nAdjustHeight = 0L;
else
- nAdjustHeight = 20L;
+ nAdjustHeight = nHSBHeight;
if (GetScrollBarVert() == NULLHANDLE ||
!WinIsWindowShowing(GetScrollBarVert()))
nAdjustWidth = 0L;
else
- nAdjustWidth = 20L;
- ::WinQueryWindowPos(GetHWND(), &vSwpScroll);
- ::WinSetWindowPos( GetHWND()
+ nAdjustWidth = nVSBWidth;
+ ::WinQueryWindowPos(GetHwnd(), &vSwpScroll);
+ ::WinSetWindowPos( GetHwnd()
,HWND_TOP
,vSwpScroll.x
,vSwpScroll.y + nAdjustHeight
hPS = ::WinGetPS(GetHwnd());
- l = rString.Length();
+ l = rString.length();
if (l > 0L)
{
pStr = (PCH)rString.c_str();
//
// In world coordinates.
//
- bRc = ::GpiQueryTextBox( hPS
- ,l
- ,pStr
- ,TXTBOX_COUNT // return maximum information
- ,avPoint // array of coordinates points
- );
+ bRc = ::GpiQueryTextBox( hPS,
+ l,
+ pStr,
+ TXTBOX_COUNT,// return maximum information
+ avPoint // array of coordinates points
+ );
if (bRc)
{
vPtMin.x = avPoint[0].x;
// ---------------------------------------------------------------------------
//
#if wxUSE_MENUS_NATIVE
-bool wxWindowOS2::DoPopupMenu( wxMenu* pMenu,
- int nX,
- int nY )
+bool wxWindowOS2::DoPopupMenu( wxMenu* pMenu, int nX, int nY )
{
HWND hWndOwner = GetHwnd();
HWND hWndParent = GetHwnd();
SubclassWin(m_hWnd);
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();
return true;
} // end of wxWindowOS2::HandleEraseBkgnd
-void wxWindowOS2::OnEraseBackground(
- wxEraseEvent& rEvent
-)
+void wxWindowOS2::OnEraseBackground(wxEraseEvent& rEvent)
{
- RECTL vRect;
- HPS hPS = rEvent.m_dc->m_hPS;
- APIRET rc;
- LONG lColor = m_backgroundColour.GetPixel();
+ RECTL vRect;
+ HPS hPS = rEvent.GetDC()->GetHPS();
+ APIRET rc;
+ LONG lColor = m_backgroundColour.GetPixel();
rc = ::WinQueryWindowRect(GetHwnd(), &vRect);
rc = ::WinFillRect(hPS, &vRect, lColor);
switch(pSwp->fl)
{
case SWP_MAXIMIZE:
-#if !(defined(__WATCOMC__) && __WATCOMC__ < 1240 )
-// Open Watcom 1.3 had incomplete headers
-// that's reported and should be fixed for OW 1.4
::WinGetMaxPosition(GetHwnd(), pSwp);
m_maxWidth = pSwp->cx;
m_maxHeight = pSwp->cy;
-#endif
break;
case SWP_MINIMIZE:
-#if !(defined(__WATCOMC__) && __WATCOMC__ < 1240 )
-// Open Watcom 1.3 had incomplete headers
-// that's reported and should be fixed for OW 1.4
::WinGetMinPosition(GetHwnd(), pSwp, &vPoint);
m_minWidth = pSwp->cx;
m_minHeight = pSwp->cy;
-#else
- wxUnusedVar(vPoint);
-#endif
break;
default:
// ---------------------------------------------------------------------------
// mouse events
// ---------------------------------------------------------------------------
-//TODO!!! check against MSW
+//TODO: check against MSW
void wxWindowOS2::InitMouseEvent(
wxMouseEvent& rEvent
, int nX
// Find the wxWindow at the current mouse position, returning the mouse
// position.
-wxWindow* wxFindWindowAtPointer(
- wxPoint& WXUNUSED(rPt)
-)
+wxWindow* wxFindWindowAtPointer(wxPoint& WXUNUSED(rPt))
{
return wxFindWindowAtPoint(wxGetMousePosition());
}
-wxWindow* wxFindWindowAtPoint(
- const wxPoint& rPt
-)
+wxWindow* wxFindWindowAtPoint(const wxPoint& rPt)
{
- POINTL vPt2;
+ POINTL vPt2;
vPt2.x = rPt.x;
vPt2.y = rPt.y;
- HWND hWndHit = ::WinWindowFromPoint(HWND_DESKTOP, &vPt2, FALSE);
- wxWindow* pWin = wxFindWinFromHandle((WXHWND)hWndHit) ;
- HWND hWnd = hWndHit;
+ HWND hWndHit = ::WinWindowFromPoint(HWND_DESKTOP, &vPt2, FALSE);
+ wxWindow* pWin = wxFindWinFromHandle((WXHWND)hWndHit) ;
+ HWND hWnd = hWndHit;
//
// Try to find a window with a wxWindow associated with it