From 63c1d521d4ab28041d64dce6042e665d4b03728a Mon Sep 17 00:00:00 2001 From: David Webster Date: Mon, 16 Dec 2002 18:34:27 +0000 Subject: [PATCH] final pre-release OS/2 updates. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/scrolbar.h | 121 ++++++------ src/os2/choice.cpp | 17 ++ src/os2/makefile.va | 8 +- src/os2/menu.cpp | 9 + src/os2/menuitem.cpp | 3 + src/os2/ownerdrw.cpp | 89 ++++++++- src/os2/scrolbar.cpp | 397 +++++++++++++++++++++----------------- src/os2/textctrl.cpp | 6 +- src/os2/window.cpp | 2 + 9 files changed, 408 insertions(+), 244 deletions(-) diff --git a/include/wx/os2/scrolbar.h b/include/wx/os2/scrolbar.h index 9d0c867ae5..ea0b911915 100644 --- a/include/wx/os2/scrolbar.h +++ b/include/wx/os2/scrolbar.h @@ -15,76 +15,85 @@ #include "wx/scrolbar.h" // Scrollbar item -class WXDLLEXPORT wxScrollBar: public wxScrollBarBase +class WXDLLEXPORT wxScrollBar : public wxScrollBarBase { - DECLARE_DYNAMIC_CLASS(wxScrollBar) - public: - inline wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } - ~wxScrollBar(); - - inline wxScrollBar(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, + inline wxScrollBar() + { + m_nPageSize = 0; + m_nViewSize = 0; + m_nObjectSize = 0; + } + inline wxScrollBar( wxWindow* pParent + ,wxWindowID vId + ,const wxPoint& rPos = wxDefaultPosition + ,const wxSize& rSize = wxDefaultSize + ,long lStyle = wxSB_HORIZONTAL #if wxUSE_VALIDATORS - const wxValidator& validator = wxDefaultValidator, + ,const wxValidator& rValidator = wxDefaultValidator #endif - const wxString& name = wxScrollBarNameStr) - { - Create(parent, id, pos, size, style, validator, name); - } - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, + ,const wxString& rsName = wxScrollBarNameStr + ) + { + Create( pParent + ,vId + ,rPos + ,rSize + ,lStyle #if wxUSE_VALIDATORS - const wxValidator& validator = wxDefaultValidator, + ,rValidator #endif - const wxString& name = wxScrollBarNameStr); + ,rsName + ); + } + ~wxScrollBar(); - int GetThumbPosition() const ; - inline int GetThumbSize() const { return m_pageSize; } - inline int GetPageSize() const { return m_viewSize; } - inline int GetRange() const { return m_objectSize; } - - virtual void SetThumbPosition(int viewStart); - virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize, - bool refresh = TRUE); - -#if WXWIN_COMPATIBILITY - // Backward compatibility - int GetValue() const { return GetThumbPosition(); } - void SetValue(int viewStart) { SetThumbPosition(viewStart); } - void GetValues(int *viewStart, int *viewLength, int *objectLength, - int *pageLength) const ; - int GetViewLength() const { return m_viewSize; } - int GetObjectLength() const { return m_objectSize; } - - void SetPageSize(int pageLength); - void SetObjectLength(int objectLength); - void SetViewLength(int viewLength); + bool Create( wxWindow* pParent + ,wxWindowID vId + ,const wxPoint& rPos = wxDefaultPosition + ,const wxSize& rSize = wxDefaultSize + ,long lStyle = wxSB_HORIZONTAL +#if wxUSE_VALIDATORS + ,const wxValidator& rValidator = wxDefaultValidator #endif + ,const wxString& rsName = wxScrollBarNameStr + ); - void Command(wxCommandEvent& event); + int GetThumbPosition(void) const ; + inline int GetThumbSize(void) const { return m_nPageSize; } + inline int GetPageSize(void) const { return m_nViewSize; } + inline int GetRange(void) const { return m_nObjectSize; } - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - virtual bool OS2OnScroll(int orientation, WXWORD wParam, - WXWORD pos, WXHWND control); + virtual void SetThumbPosition(int nViewStart); + virtual void SetScrollbar( int nPosition + ,int nThumbSize + ,int nRange + ,int nPageSize + ,bool bRefresh = TRUE + ); -#if WXWIN_COMPATIBILITY - // Backward compatibility: generate an old-style scroll command - void OnScroll(wxScrollEvent& event); -#endif // WXWIN_COMPATIBILITY + void Command(wxCommandEvent& rEvent); + virtual WXHBRUSH OnCtlColor( WXHDC hDC + ,WXHWND hWnd + ,WXUINT uCtlColor + ,WXUINT uMessage + ,WXWPARAM wParam + ,WXLPARAM lParam + ); + virtual bool OS2OnScroll( int nOrientation + ,WXWORD wParam + ,WXWORD wPos + ,WXHWND hControl + ); protected: - int m_pageSize; - int m_viewSize; - int m_objectSize; + int m_nPageSize; + int m_nViewSize; + int m_nObjectSize; -DECLARE_EVENT_TABLE() -}; +private: + DECLARE_DYNAMIC_CLASS(wxScrollBar) +}; // end of CLASS wxScrollBar #endif // _WX_SCROLBAR_H_ diff --git a/src/os2/choice.cpp b/src/os2/choice.cpp index f3f95b2a91..a1bb7f81d6 100644 --- a/src/os2/choice.cpp +++ b/src/os2/choice.cpp @@ -189,6 +189,16 @@ void wxChoice::SetString( ) { SHORT nIndexType = 0; + void* pData; + + if ( m_clientDataItemsType != wxClientData_None ) + { + pData = DoGetItemClientData(n); + } + else // no client data + { + pData = NULL; + } ::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, 0); @@ -201,6 +211,13 @@ void wxChoice::SetString( ,(MPARAM)nIndexType ,(MPARAM)rsStr.c_str() ); + + if (pData) + { + DoSetItemClientData( n + ,pData + ); + } } // end of wxChoice::SetString wxString wxChoice::GetString( diff --git a/src/os2/makefile.va b/src/os2/makefile.va index e5001f5cfc..c6b03a341f 100644 --- a/src/os2/makefile.va +++ b/src/os2/makefile.va @@ -1113,15 +1113,15 @@ $(WXDIR)\lib\wx.lib: \ !else # Update the dynamic link library -$(WXDIR)\lib\wx23.dll: $(OBJECTS) +$(WXDIR)\lib\wx24.dll: $(OBJECTS) icc @<< /B" $(LINKFLAGS)" /Fe$@ $(LIBS) $(DUMMYOBJ) $(OBJECTS) - $(WXDIR)\src\os2\wx23.def + $(WXDIR)\src\os2\wx24.def << - implib $(WXDIR)\lib\wx23.lib $(WXDIR)\src\os2\wx23.def + implib $(WXDIR)\lib\wx24.lib $(WXDIR)\src\os2\wx24.def !endif @@ -1200,7 +1200,7 @@ clean: $(PERIPH_CLEAN_TARGET) clean_png clean_zlib clean_jpeg clean_tiff rd ..\os2\$D del $(LIBTARGET) !if "$(WXMAKINGDLL)" == "1" - erase /N ..\..\lib\wx23.lib + erase /N ..\..\lib\wx24.lib !endif erase /N $(COMMDIR)\y_tab.c erase /N $(COMMDIR)\lex_yy.c diff --git a/src/os2/menu.cpp b/src/os2/menu.cpp index 8ca65be64b..8007899907 100644 --- a/src/os2/menu.cpp +++ b/src/os2/menu.cpp @@ -750,6 +750,15 @@ wxMenuBar::wxMenuBar( wxMenuBar::~wxMenuBar() { + // + // We should free PM's resources only if PM doesn't do it for us + // which happens if we're attached to a frame + // + if (m_hMenu && !IsAttached()) + { + ::WinDestroyWindow((HMENU)m_hMenu); + m_hMenu = (WXHMENU)NULL; + } } // end of wxMenuBar::~wxMenuBar // --------------------------------------------------------------------------- diff --git a/src/os2/menuitem.cpp b/src/os2/menuitem.cpp index ca9fc82f00..91c6e9d975 100644 --- a/src/os2/menuitem.cpp +++ b/src/os2/menuitem.cpp @@ -423,6 +423,9 @@ void wxMenuItem::SetText( wxMenuItemBase::SetText(sText); OWNER_DRAWN_ONLY(wxOwnerDrawn::SetName(sText)); +#if wxUSE_OWNER_DRAWN + SetAccelString(rText.AfterFirst(_T('\t'))); +#endif // wxUSE_OWNER_DRAWN HWND hMenu = GetHmenuOf(m_parentMenu); diff --git a/src/os2/ownerdrw.cpp b/src/os2/ownerdrw.cpp index 2cfddaec1b..c352f843de 100644 --- a/src/os2/ownerdrw.cpp +++ b/src/os2/ownerdrw.cpp @@ -71,17 +71,100 @@ bool wxOwnerDrawn::OnMeasureItem( { wxMemoryDC vDC; - vDC.SetFont(GetFont()); wxString sStr = wxStripMenuCodes(m_strName); + // + // If we have a valid accel string, then pad out + // the menu string so the menu and accel string are not + // placed ontop of eachother. + if (!m_strAccel.empty() ) + { + sStr.Pad(sStr.Length()%8); + sStr += m_strAccel; + } + vDC.SetFont(GetFont()); vDC.GetTextExtent( sStr ,(long *)pWidth ,(long *)pHeight ); + if (!m_strAccel.IsEmpty()) + { + // + // Measure the accelerator string, and add it's width to + // the total item width, plus 16 (Accelerators are right justified, + // with the right edge of the text rectangle 16 pixels left of + // the right edge of the menu) + // + int nAccelWidth; + int nAccelHeight; - (*pHeight) = (*pHeight) + 2; - m_nHeight = *pHeight; // remember height for use in OnDrawItem + vDC.GetTextExtent( m_strAccel + ,&nAccelWidth + ,&nAccelHeight + ); + *pWidth += nAccelWidth; + } + + // + // Add space at the end of the menu for the submenu expansion arrow + // this will also allow offsetting the accel string from the right edge + // + *pWidth += GetDefaultMarginWidth() * 1.5; + + // + // JACS: items still look too tightly packed, so adding 5 pixels. + // + (*pHeight) += 5; + + // + // Ray Gilbert's changes - Corrects the problem of a BMP + // being placed next to text in a menu item, and the BMP does + // not match the size expected by the system. This will + // resize the space so the BMP will fit. Without this, BMPs + // must be no larger or smaller than 16x16. + // + if (m_bmpChecked.Ok()) + { + // + // Is BMP height larger then text height? + // + size_t nAdjustedHeight = m_bmpChecked.GetHeight() + + wxSystemSettings::GetMetric(wxSYS_EDGE_Y); + if (*pHeight < nAdjustedHeight) + *pHeight = nAdjustedHeight; + + // + // Does BMP encroach on default check menu position? + // + size_t nAdjustedWidth = m_bmpChecked.GetWidth() + + (wxSystemSettings::GetMetric(wxSYS_EDGE_X) * 2); + + // + // Do we need to widen margin to fit BMP? + // + if ((size_t)GetMarginWidth() < nAdjustedWidth) + SetMarginWidth(nAdjustedWidth); + + // + // Add the size of the bitmap to our total size... + // + *pWidth += GetMarginWidth(); + } + + // + // Add the size of the bitmap to our total size - even if we don't have + // a bitmap we leave room for one... + // + *pWidth += GetMarginWidth(); + + // + // Make sure that this item is at least as + // tall as the user's system settings specify + // + if (*pHeight < m_nMinHeight) + *pHeight = m_nMinHeight; + m_nHeight = *pHeight; // remember height for use in OnDrawItem return TRUE; } // end of wxOwnerDrawn::OnMeasureItem diff --git a/src/os2/scrolbar.cpp b/src/os2/scrolbar.cpp index e77bcbdb26..a27773d308 100644 --- a/src/os2/scrolbar.cpp +++ b/src/os2/scrolbar.cpp @@ -22,252 +22,291 @@ IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl) -BEGIN_EVENT_TABLE(wxScrollBar, wxControl) -#if WXWIN_COMPATIBILITY - EVT_SCROLL(wxScrollBar::OnScroll) -#endif -END_EVENT_TABLE() - - // Scrollbar -bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, long style, +bool wxScrollBar::Create ( + wxWindow* pParent +, wxWindowID vId +, const wxPoint& rPos +, const wxSize& rSize +, long lStyle #if wxUSE_VALIDATORS - const wxValidator& validator, +, const wxValidator& rValidator #endif - const wxString& name) +, const wxString& rsName +) { - if (!parent) + int nX = rPos.x; + int nY = rPos.y; + int nWidth = rSize.x; + int nHeight = rSize.y; + + if (!pParent) return FALSE; - parent->AddChild(this); - SetName(name); + pParent->AddChild(this); + SetName(rsName); #if wxUSE_VALIDATORS - SetValidator(validator); + SetValidator(rValidator); #endif + SetBackgroundColour(pParent->GetBackgroundColour()) ; + SetForegroundColour(pParent->GetForegroundColour()) ; - SetBackgroundColour(parent->GetBackgroundColour()) ; - SetForegroundColour(parent->GetForegroundColour()) ; - m_windowStyle = style; - - if ( id == -1 ) + if (vId == -1L) m_windowId = (int)NewControlId(); else - m_windowId = id; + m_windowId = vId; - int x = pos.x; - int y = pos.y; - int width = size.x; - int height = size.y; - - if (width == -1) + if (nWidth == -1) { - if (style & wxHORIZONTAL) - width = 140; + if (lStyle & wxHORIZONTAL) + nWidth = 140; else - width = 14; + nWidth = 14; } - if (height == -1) + if (nHeight == -1) { - if (style & wxVERTICAL) - height = 140; + if (lStyle & wxVERTICAL) + nHeight = 140; else - height = 14; + nHeight = 14; } - // TODO create scrollbar + DWORD dwStyle = WS_VISIBLE; - m_pageSize = 1; - m_viewSize = 1; - m_objectSize = 1; + if (GetWindowStyleFlag() & wxCLIP_SIBLINGS) + dwStyle |= WS_CLIPSIBLINGS; - SetFont(parent->GetFont()); + DWORD dwDirection = (lStyle & wxHORIZONTAL) ? SBS_HORZ: SBS_VERT; - m_hWnd = 0; // TODO: (WXHWND)scroll_bar; + HWND hScrollBar = ::WinCreateWindow( (HWND)GetHwndOf(pParent) + ,WC_SCROLLBAR + ,(PSZ)NULL + ,dwDirection | dwStyle + ,0, 0, 0, 0 + ,(HWND)GetHwndOf(pParent) + ,HWND_TOP + ,(HMENU)m_windowId + ,NULL + ,NULL + ); - HWND scroll_bar = 0; // temporary + m_nPageSize = 1; + m_nViewSize = 1; + m_nObjectSize = 1; + ::WinSendMsg( hScrollBar + ,SBM_SETSCROLLBAR + ,(MPARAM)0 + ,MPFROM2SHORT(0,1) + ); + ::WinShowWindow( hScrollBar + ,TRUE + ); + SetFont(*wxSMALL_FONT); + m_hWnd = hScrollBar; + + // // Subclass again for purposes of dialog editing mode - SubclassWin((WXHWND) scroll_bar); - - SetSize(x, y, width, height); - + // + SubclassWin((WXHWND)hScrollBar); + SetSize( nX + ,nY + ,nWidth + ,nHeight + ); return TRUE; -} +} // end of wxScrollBar::Create wxScrollBar::~wxScrollBar() { } -bool wxScrollBar::OS2OnScroll(int WXUNUSED(orientation), WXWORD wParam, - WXWORD pos, WXHWND control) +bool wxScrollBar::OS2OnScroll ( + int nOrientation +, WXWORD wParam +, WXWORD wPos +, WXHWND hControl +) { - // TODO: -/* - int position = ::GetScrollPos((HWND) control, SB_CTL); - int minPos, maxPos; - ::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos); + int nPosition; + int nMaxPos; + int nTrackPos = wPos; + int nMinPos; + int nScrollInc; + wxEventType vScrollEvent = wxEVT_NULL; -#if defined(__WIN95__) + MRESULT vRange; + + // + // When we're dragging the scrollbar we can't use pos parameter because it + // is limited to 16 bits + // + if (wParam == SB_SLIDERPOSITION || wParam == SB_SLIDERTRACK) + { + SBCDATA vScrollInfo; + + vScrollInfo.sHilite = SB_SLIDERTRACK; + + ::WinSendMsg((HWND)GetHwnd(), WM_QUERYWINDOWPARAMS, (PVOID)&vScrollInfo, NULL); + + nTrackPos = vScrollInfo.posThumb; + nPosition = vScrollInfo.posFirst; + nMaxPos = vScrollInfo.posLast; + } + else + { + nPosition = (int)(MRESULT)::WinSendMsg((HWND)GetHwnd(), SBM_QUERYPOS, (MPARAM)NULL, (MPARAM)NULL); + vRange = ::WinSendMsg((HWND)GetHwnd(), SBM_QUERYRANGE, (MPARAM)NULL, (MPARAM)NULL); + nMinPos = SHORT1FROMMR(vRange); + nMaxPos = SHORT2FROMMR(vRange); + } + // // A page size greater than one has the effect of reducing the effective // range, therefore the range has already been boosted artificially - so // reduce it again. - if ( m_pageSize > 1 ) - maxPos -= (m_pageSize - 1); -#endif // __WIN95__ - - wxEventType scrollEvent = wxEVT_NULL; - - int nScrollInc; - switch ( wParam ) + // + if (m_nPageSize > 1) + nMaxPos -= (m_nPageSize - 1); + switch (wParam) { - case SB_TOP: - nScrollInc = maxPos - position; - scrollEvent = wxEVT_SCROLL_TOP; - break; - - case SB_BOTTOM: - nScrollInc = - position; - scrollEvent = wxEVT_SCROLL_BOTTOM; - break; - case SB_LINEUP: - nScrollInc = -1; - scrollEvent = wxEVT_SCROLL_LINEUP; + nScrollInc = -1; + vScrollEvent = wxEVT_SCROLL_LINEUP; break; case SB_LINEDOWN: - nScrollInc = 1; - scrollEvent = wxEVT_SCROLL_LINEDOWN; + nScrollInc = 1; + vScrollEvent = wxEVT_SCROLL_LINEDOWN; break; case SB_PAGEUP: - nScrollInc = -GetPageSize(); - scrollEvent = wxEVT_SCROLL_PAGEUP; + nScrollInc = -GetPageSize(); + vScrollEvent = wxEVT_SCROLL_PAGEUP; break; case SB_PAGEDOWN: - nScrollInc = GetPageSize(); - scrollEvent = wxEVT_SCROLL_PAGEDOWN; + nScrollInc = GetPageSize(); + vScrollEvent = wxEVT_SCROLL_PAGEDOWN; break; - case SB_THUMBTRACK: - case SB_THUMBPOSITION: - nScrollInc = pos - position; - scrollEvent = wxEVT_SCROLL_THUMBTRACK; + case SB_SLIDERTRACK: + nScrollInc = nTrackPos - nPosition; + vScrollEvent = wxEVT_SCROLL_THUMBTRACK; + break; + + case SB_ENDSCROLL: + nScrollInc = 0; + vScrollEvent = wxEVT_SCROLL_ENDSCROLL; break; default: nScrollInc = 0; } - - if ( nScrollInc == 0 ) + if (nScrollInc) { - // no event to process, so don't process it + nPosition += nScrollInc; + + if (nPosition < 0) + nPosition = 0; + if (nPosition > nMaxPos) + nPosition = nMaxPos; + SetThumbPosition(nPosition); + } + else if ( vScrollEvent != wxEVT_SCROLL_THUMBRELEASE && + vScrollEvent != wxEVT_SCROLL_ENDSCROLL + ) + { + // + // Don't process the event if there is no displacement, + // unless this is a thumb release or end scroll event. + // return FALSE; } - int new_pos = position + nScrollInc; + wxScrollEvent vEvent( vScrollEvent + ,m_windowId + ); - if (new_pos < 0) - new_pos = 0; - if (new_pos > maxPos) - new_pos = maxPos; + vEvent.SetPosition(nPosition); + vEvent.SetEventObject(this); + return GetEventHandler()->ProcessEvent(vEvent); +} // end of wxScrollBar::OS2OnScroll - SetThumbPosition(new_pos); - wxScrollEvent event(scrollEvent, m_windowId); - event.SetPosition(new_pos); - event.SetEventObject( this ); - - return GetEventHandler()->ProcessEvent(event); -*/ - return FALSE; -} - -void wxScrollBar::SetThumbPosition(int viewStart) +void wxScrollBar::SetThumbPosition ( + int nViewStart +) { - // TODO -} + SBCDATA vInfo; + + memset(&vInfo, '\0', sizeof(SBCDATA)); + vInfo.cb = sizeof(SBCDATA); + vInfo.posThumb = nViewStart; + + ::WinSendMsg((HWND)GetHwnd(), WM_SETWINDOWPARAMS, (MPARAM)&vInfo, (MPARAM)NULL); + ::WinSendMsg((HWND)GetHwnd(), SBM_SETPOS, (MPARAM)nViewStart, (MPARAM)NULL); +} // end of wxScrollBar::SetThumbPosition int wxScrollBar::GetThumbPosition() const { - // TODO - return 0; -} + return((int)(MRESULT)::WinSendMsg((HWND)GetHwnd(), SBM_QUERYPOS, (MPARAM)NULL, (MPARAM)NULL)); +} // end of wxScrollBar::GetThumbPosition -void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize, - bool refresh) +void wxScrollBar::SetScrollbar ( + int nPosition +, int nThumbSize +, int nRange +, int nPageSize +, bool bRefresh +) { - m_viewSize = pageSize; - m_pageSize = thumbSize; - m_objectSize = range; + SBCDATA vInfo; + // + // The lRange (number of scroll steps) is the + // object length minus the page size. + // + int nRange1 = wxMax((m_nObjectSize - m_nPageSize), 0); - // TODO -} + m_nViewSize = nPageSize; + m_nPageSize = nThumbSize; + m_nObjectSize = nRange; -#if WXWIN_COMPATIBILITY -void wxScrollBar::SetPageSize(int pageLength) -{ - m_pageSize = pageLength; - // TODO: -} - -void wxScrollBar::SetObjectLength(int objectLength) -{ - m_objectSize = objectLength; - - // The range (number of scroll steps) is the - // object length minus the view size. - int range = wxMax((objectLength - m_viewSize), 0) ; - - // TODO: -} - -void wxScrollBar::SetViewLength(int viewLength) -{ - m_viewSize = viewLength; -} - -void wxScrollBar::GetValues(int *viewStart, int *viewLength, int *objectLength, - int *pageLength) const -{ -// TODO: -/* - *viewStart = ::GetScrollPos((HWND)m_hWnd, SB_CTL); - *viewLength = m_viewSize; - *objectLength = m_objectSize; - *pageLength = m_pageSize; -*/ -} -#endif - -WXHBRUSH wxScrollBar::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam) -{ - return 0; -} - -void wxScrollBar::Command(wxCommandEvent& event) -{ - SetThumbPosition(event.m_commandInt); - ProcessCommand(event); -} - -#if WXWIN_COMPATIBILITY -// Backward compatibility -void wxScrollBar::OnScroll(wxScrollEvent& event) -{ - // TODO: -/* - wxEventType oldEvent = event.GetEventType(); - event.SetEventType( wxEVT_COMMAND_SCROLLBAR_UPDATED ); - if ( !GetEventHandler()->ProcessEvent(event) ) + // + // Try to adjust the lRange to cope with page size > 1 + // (see comment for SetPageLength) + // + if (m_nPageSize > 1 ) { - event.SetEventType( oldEvent ); - if (!GetParent()->GetEventHandler()->ProcessEvent(event)) - event.Skip(); + nRange1 += (m_nPageSize - 1); } -*/ -} -#endif + vInfo.cb = sizeof(SBCDATA); + vInfo.cVisible = m_nPageSize; + vInfo.posFirst = 0; + vInfo.posLast = nRange1; + vInfo.posThumb = nPosition; + + ::WinSendMsg((HWND)GetHwnd(), WM_SETWINDOWPARAMS, (MPARAM)&vInfo, (MPARAM)NULL); +} // end of wxScrollBar::SetScrollbar + +WXHBRUSH wxScrollBar::OnCtlColor ( + WXHDC hDC +, WXHWND hWnd +, WXUINT uCtlColor +, WXUINT uMessage +, WXWPARAM wParam +, WXLPARAM lParam +) +{ + // + // Does nothing under OS/2 + // + return 0; +} // end of wxScrollBar::OnCtlColor + +void wxScrollBar::Command ( + wxCommandEvent& rEvent +) +{ + SetThumbPosition(rEvent.m_commandInt); + ProcessCommand(rEvent); +} // end of wxScrollBar::Command + diff --git a/src/os2/textctrl.cpp b/src/os2/textctrl.cpp index c567806c24..82cd01a4dd 100644 --- a/src/os2/textctrl.cpp +++ b/src/os2/textctrl.cpp @@ -1175,9 +1175,11 @@ void wxTextCtrl::AdjustSpaceLimit() bool wxTextCtrl::AcceptsFocus() const { // - // We don't want focus if we can't be edited + // We don't want focus if we can't be edited unless we're a multiline + // control because then it might be still nice to get focus from keyboard + // to be able to scroll it without mouse // - return IsEditable() && wxControl::AcceptsFocus(); + return (IsEditable() || IsMultiLine()) && wxControl::AcceptsFocus(); } // end of wxTextCtrl::Command wxSize wxTextCtrl::DoGetBestSize() const diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 4ab8890da9..96931c33eb 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -2234,6 +2234,8 @@ static void wxYieldForCommandsOnly() { wxTheApp->DoMessage((WXMSG*)&vMsg); } + if (vMsg.msg == WM_QUIT) + ::WinPostMsg(NULL, WM_QUIT, 0, 0); } #endif // wxUSE_MENUS_NATIVE