]> git.saurik.com Git - wxWidgets.git/commitdiff
Notebook, Listbox, and Checklst updates
authorDavid Webster <Dave.Webster@bhmi.com>
Tue, 3 Sep 2002 04:47:39 +0000 (04:47 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Tue, 3 Sep 2002 04:47:39 +0000 (04:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16951 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/os2/checklst.h
include/wx/os2/statbmp.h
include/wx/os2/window.h
src/os2/checklst.cpp
src/os2/combobox.cpp
src/os2/listbox.cpp
src/os2/notebook.cpp
src/os2/statbmp.cpp
src/os2/window.cpp

index f669ef3cb1c67a631333773de3ad4d27d601f3d5..335e8c07edcccff3bd7bda2f63d44496025a1278 100644 (file)
 
 #include "wx/setup.h"
 
-class wxOwnerDrawn;    // so the compiler knows, it is a class.
+class wxOwnerDrawn; // so the compiler knows, it is a class.
 
 class wxCheckListBoxItem; // fwd decl, define in checklst.cpp
 
 class WXDLLEXPORT wxCheckListBox : public wxListBox
 {
-  DECLARE_DYNAMIC_CLASS(wxCheckListBox)
 public:
-  // ctors
-  wxCheckListBox();
-  wxCheckListBox(wxWindow *parent, wxWindowID id,
-                 const wxPoint& pos = wxDefaultPosition,
-                 const wxSize& size = wxDefaultSize,
-                 int nStrings = 0,
-                 const wxString choices[] = NULL,
-                 long style = 0,
+    // 
+    // Ctors
+    //
+    wxCheckListBox();
+    wxCheckListBox( wxWindow*          pParent
+                   ,wxWindowID         vId
+                   ,const wxPoint&     rPos = wxDefaultPosition
+                   ,const wxSize&      vSize = wxDefaultSize
+                   ,int                nStrings = 0
+                   ,const wxString     asChoices[] = NULL
+                   ,long               lStyle = 0
 #if wxUSE_VALIDATORS
-                 const wxValidator& validator = wxDefaultValidator,
+                   ,const wxValidator& rValidator = wxDefaultValidator
 #endif
-                 const wxString& name = wxListBoxNameStr);
-
-  // override base class virtuals
-  virtual void Delete(int n);
-  virtual void InsertItems(int nItems, const wxString items[], int pos);
-
-  virtual bool SetFont( const wxFont &font );
-
-  // items may be checked
-  bool IsChecked(size_t uiIndex) const;
-  void Check(size_t uiIndex, bool bCheck = TRUE);
-
-  // accessors
-  size_t GetItemHeight() const { return m_nItemHeight; }
+                   ,const wxString&    rsName = wxListBoxNameStr
+                  );
+
+    // 
+    // Override base class virtuals
+    //
+    virtual void Delete(int n);
+    virtual void InsertItems( int            nItems
+                             ,const wxString asItems[]
+                             ,int            nPos
+                            );
+
+    virtual bool SetFont(const wxFont &rFont);
+
+    // 
+    // Items may be checked
+    //
+    bool IsChecked(size_t uiIndex) const;
+    void Check( size_t uiIndex
+               ,bool   bCheck = TRUE
+              );
+
+    // 
+    // Accessors
+    //
+    size_t GetItemHeight(void) const { return m_nItemHeight; }
 
 protected:
-  // we create our items ourselves and they have non-standard size,
-  // so we need to override these functions
-  virtual wxOwnerDrawn *CreateItem(size_t n);
-//  virtual bool          OS2OnMeasure(WXMEASUREITEMSTRUCT *item);
-
-  // pressing space or clicking the check box toggles the item
-  void OnChar(wxKeyEvent& event);
-  void OnLeftClick(wxMouseEvent& event);
+    // 
+    // We create our items ourselves and they have non-standard size,
+    // so we need to override these functions
+    //
+    virtual wxOwnerDrawn* CreateItem(size_t n);
+    virtual bool          OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem);
+
+    // 
+    // Pressing space or clicking the check box toggles the item
+    //
+    void OnChar(wxKeyEvent& rEvent);
+    void OnLeftClick(wxMouseEvent& rEvent);
 
 private:
-  size_t    m_nItemHeight;  // height of checklistbox items (the same for all)
-
-  //Virtual function hiding suppression, do not use
-  virtual wxControl *CreateItem(const wxItemResource* childResource,
-                                const wxItemResource* parentResource,
-                                const wxResourceTable *table = (const wxResourceTable *) NULL)
-  { return(wxWindowBase::CreateItem(childResource, parentResource, table));};
-
-  DECLARE_EVENT_TABLE()
-};
+    size_t                          m_nItemHeight;  // height of checklistbox items (the same for all)
+
+    //
+    // Virtual function hiding suppression, do not use
+    //
+    virtual wxControl* CreateItem( const wxItemResource*  pChildResource
+                                  ,const wxItemResource*  pParentResource
+                                  ,const wxResourceTable* pTable = (const wxResourceTable *) NULL
+                                 )
+    { 
+        return(wxWindowBase::CreateItem( pChildResource
+                                        ,pParentResource
+                                        ,pTable
+                                       ));
+    }
+    DECLARE_DYNAMIC_CLASS(wxCheckListBox)
+    DECLARE_EVENT_TABLE()
+}; // end of CLASS wxCheckListBoxItem
 
 #endif
    // _WX_CHECKLST_H_
index f42b488f46439bf5d8d3611d929ec63539a6a100..4f34c65d5ffe94b3b48be1598cefc9943580fe8d 100644 (file)
@@ -62,6 +62,7 @@ class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
                                   ,WXWPARAM wParam
                                   ,WXLPARAM lParam
                                  );
+    void OnPaint(wxPaintEvent& rEvent);
 
 protected:
     virtual wxSize DoGetBestSize() const;
@@ -79,6 +80,7 @@ protected:
     wxGDIImage*                     m_pImage;
 private:
     DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
+    DECLARE_EVENT_TABLE()
 }; // end of wxStaticBitmap
 
 #endif
index dd4a0e64fe8f70ff2bbfcbfc8b644b988a0c84e8..a64f5ae222b02921a8c1988b8989b06e6901dbcc 100644 (file)
@@ -227,9 +227,6 @@ public:
     void OnIdle(wxIdleEvent& rEvent);
 
 public:
-    // For hidden notebook pages, always TRUE for everything else
-    bool IsActivePage(void) const { return m_bIsActivePage; }
-    void SetActivePage(bool bActive) { m_bIsActivePage = bActive; }
 
     // For implementation purposes - sometimes decorations make the client area
     // smaller
@@ -606,7 +603,6 @@ private:
     HWND                            m_hWndScrollBarHorz;
     HWND                            m_hWndScrollBarVert;
     SWP                             m_vWinSwp;
-    bool                            m_bIsActivePage;
 
     DECLARE_DYNAMIC_CLASS(wxWindowOS2);
     DECLARE_NO_COPY_CLASS(wxWindowOS2)
index 05f0b829f2c42b8725e93723407e5a3e70ad2f8b..f3a639ff6a8aeda38d4b85a47def8d1d2dd9de0e 100644 (file)
@@ -44,7 +44,7 @@
 // implementation
 // ============================================================================
 
-  IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
+IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
 
 // ----------------------------------------------------------------------------
 // declaration and implementation of wxCheckListBoxItem class
 
 class wxCheckListBoxItem : public wxOwnerDrawn
 {
-friend class wxCheckListBox;
+    friend class wxCheckListBox;
 public:
-  // ctor
-  wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex);
-
-  // drawing functions
-  virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat);
-
-  // simple accessors
-  bool IsChecked() const  { return m_bChecked;        }
-  void Check(bool bCheck);
-  void Toggle() { Check(!IsChecked()); }
+    //
+    // ctor
+    //
+    wxCheckListBoxItem( wxCheckListBox* pParent
+                       ,size_t          nIndex
+                      );
+
+    //
+    // Drawing functions
+    //
+    virtual bool OnDrawItem( wxDC&         rDc
+                            ,const wxRect& rRect
+                            ,wxODAction    eAct
+                            ,wxODStatus    eStat
+                           );
+
+    //
+    // Simple accessors
+    //
+    bool IsChecked(void) const  { return m_bChecked; }
+    void Check(bool bCheck);
+    void Toggle(void) { Check(!IsChecked()); }
 
 private:
-  bool            m_bChecked;
-  wxCheckListBox *m_pParent;
-  size_t            m_nIndex;
-};
-
-wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex)
-                  : wxOwnerDrawn("", TRUE)   // checkable
+    bool                            m_bChecked;
+    wxCheckListBox*                 m_pParent;
+    size_t                          m_nIndex;
+}; // end of CLASS wxCheckListBoxItem
+
+wxCheckListBoxItem::wxCheckListBoxItem (
+  wxCheckListBox*                   pParent
+, size_t                            nIndex
+)
+: wxOwnerDrawn( ""
+               ,TRUE // checkable
+              )
 {
-  m_bChecked = FALSE;
-  m_pParent  = pParent;
-  m_nIndex   = nIndex;
-
-  // we don't initialize m_nCheckHeight/Width vars because it's
-  // done in OnMeasure while they are used only in OnDraw and we
-  // know that there will always be OnMeasure before OnDraw
-
-  // fix appearance
-  SetMarginWidth(GetDefaultMarginWidth());
-}
-
-/*
- * JACS - I've got the owner-draw stuff partially working with WIN16,
- * with a really horrible-looking cross for wxCheckListBox instead of a
- * check - could use a bitmap check-mark instead, defined in wx.rc.
- * Also there's a refresh problem whereby it doesn't always draw the
- * check until you click to the right of it, which is OK for WIN32.
- */
-
-bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc,
-                                    wxODAction act, wxODStatus stat)
+    m_bChecked = FALSE;
+    m_pParent  = pParent;
+    m_nIndex   = nIndex;
+
+    //
+    // We don't initialize m_nCheckHeight/Width vars because it's
+    // done in OnMeasure while they are used only in OnDraw and we
+    // know that there will always be OnMeasure before OnDraw
+    //
+    SetMarginWidth(GetDefaultMarginWidth());
+} // end of wxCheckListBoxItem::wxCheckListBoxItem
+
+bool wxCheckListBoxItem::OnDrawItem (
+  wxDC&                             rDc
+, const wxRect&                     rRect
+, wxODAction                        eAct
+, wxODStatus                        eStat
+)
 {
-  if ( IsChecked() )
-    stat = (wxOwnerDrawn::wxODStatus)(stat | wxOwnerDrawn::wxODChecked);
-
-// TODO:
-/*
-
-  if ( wxOwnerDrawn::OnDrawItem(dc, rc, act, stat) ) {
-    // ## using native API for performance and precision
-    size_t nCheckWidth  = GetDefaultMarginWidth(),
-         nCheckHeight = m_pParent->GetItemHeight();
-
-    int x = rc.GetX(),
-        y = rc.GetY();
-
-    HDC hdc = (HDC)dc.GetHDC();
-
-    // create pens
-    HPEN hpenBack = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_WINDOW)),
-         hpenGray = CreatePen(PS_SOLID, 0, RGB(128, 128, 128)),
-         hpenPrev = (HPEN)SelectObject(hdc, hpenBack);
-
-    // we erase the 1-pixel border
-    Rectangle(hdc, x, y, x + nCheckWidth, y + nCheckHeight);
-
-    // shift check mark 1 pixel to the right (it looks better like this)
-    x++;
-
-    if ( IsChecked() ) {
-      // first create a monochrome bitmap in a memory DC
-      HDC hdcMem = CreateCompatibleDC(hdc);
-      HBITMAP hbmpCheck = CreateBitmap(nCheckWidth, nCheckHeight, 1, 1, 0);
-      HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpCheck);
-
-      // then draw a check mark into it
-      RECT rect ;
-      rect.left   = 0 ;
-      rect.top    = 0 ;
-      rect.right  = nCheckWidth ;
-      rect.bottom = nCheckHeight ;
-
-#ifdef __WIN32__
-#ifndef __SC__
-      DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK);
-#endif
-#else
-      // In WIN16, draw a cross
-      HPEN blackPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
-      HPEN whiteBrush = (HPEN)GetStockObject(WHITE_BRUSH);
-      HPEN hPenOld = (HPEN)::SelectObject(hdcMem, blackPen);
-      HPEN hBrushOld = (HPEN)::SelectObject(hdcMem, whiteBrush);
-      ::SetROP2(hdcMem, R2_COPYPEN);
-      Rectangle(hdcMem, 0, 0, nCheckWidth, nCheckHeight);
-      MoveTo(hdcMem, 0, 0);
-      LineTo(hdcMem, nCheckWidth, nCheckHeight);
-      MoveTo(hdcMem, nCheckWidth, 0);
-      LineTo(hdcMem, 0, nCheckHeight);
-      ::SelectObject(hdcMem, hPenOld);
-      ::SelectObject(hdcMem, hBrushOld);
-      ::DeleteObject(blackPen);
-#endif
-
-      // finally copy it to screen DC and clean up
-      BitBlt(hdc, x, y, nCheckWidth - 1, nCheckHeight,
-             hdcMem, 0, 0, SRCCOPY);
-
-      SelectObject(hdcMem, hbmpOld);
-      DeleteObject(hbmpCheck);
-      DeleteDC(hdcMem);
+    wxRect                          vRect = rRect;
+
+    if (IsChecked())
+        eStat = (wxOwnerDrawn::wxODStatus)(eStat | wxOwnerDrawn::wxODChecked);
+
+    //
+    // Unfortunately PM doesn't quite get the text position exact.  We need to alter
+    // it down and to the right, just a little bit.  The coords in rRect are OS/2
+    // coords not wxWindows coords.
+    //
+    vRect.x += 5;
+    vRect.y -= 3;
+    if (wxOwnerDrawn::OnDrawItem( rDc
+                                 ,vRect
+                                 ,eAct
+                                 ,eStat))
+    {
+        size_t                      nCheckWidth  = GetDefaultMarginWidth();
+        size_t                      nCheckHeight = m_pParent->GetItemHeight();
+        int                         nParentHeight;
+        int                         nX = rRect.GetX();
+        int                         nY = rRect.GetY();
+        int                         nOldY = nY;
+        wxColour                    vColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+        wxPen                       vPenBack;
+        wxPen                       vPenGray;
+        wxPen                       vPenPrev;
+
+        m_pParent->GetSize( NULL
+                           ,&nParentHeight
+                          );
+        ::WinQueryWindowRect( m_pParent->GetHWND()
+                             ,&rDc.m_vRclPaint
+                            );
+
+        nY = nParentHeight - nY - nCheckHeight;
+        vPenBack = wxPen(vColour, 1, wxSOLID);
+        vPenGray = wxPen(wxColour(127, 127, 127), 1, wxSOLID);
+
+        //
+        // Erase the 1-pixel border
+        //
+        rDc.SetPen(vPenBack);
+        rDc.DrawRectangle( nX
+                          ,nY
+                          ,nCheckWidth
+                          ,nCheckHeight
+                         );
+
+        //
+        // Now we draw the smaller rectangle
+        //
+        nY++;
+        nCheckWidth  -= 2;
+        nCheckHeight -= 2;
+
+        //
+        // Draw hollow gray rectangle
+        //
+        rDc.SetPen(vPenGray);
+        rDc.DrawRectangle( nX
+                          ,nY
+                          ,nCheckWidth
+                          ,nCheckHeight
+                         );
+
+        nX++;
+        if (IsChecked())
+        {
+            //
+            // Draw the check by loading the sys standard bitmap and drawing it
+            //
+            HBITMAP                 hChkBmp = ::WinGetSysBitmap( HWND_DESKTOP
+                                                                ,SBMP_MENUCHECK
+                                                               );
+            POINTL                  vPoint = {nX, nOldY + 3};
+
+            ::WinDrawBitmap( rDc.GetHPS()
+                            ,hChkBmp
+                            ,NULL
+                            ,&vPoint
+                            ,NULL
+                            ,NULL
+                            ,DBM_NORMAL
+                           );
+        }
+        return TRUE;
     }
+    return FALSE;
+} // end of wxCheckListBoxItem::OnDrawItem
 
-    // now we draw the smaller rectangle
-    y++;
-    nCheckWidth  -= 2;
-    nCheckHeight -= 2;
-
-    // draw hollow gray rectangle
-    (void)SelectObject(hdc, hpenGray);
-    HBRUSH hbrPrev  = (HBRUSH)SelectObject(hdc, GetStockObject(NULL_BRUSH));
-    Rectangle(hdc, x, y, x + nCheckWidth, y + nCheckHeight);
-
-    // clean up
-    (void)SelectObject(hdc, hpenPrev);
-    (void)SelectObject(hdc, hbrPrev);
-
-    DeleteObject(hpenBack);
-    DeleteObject(hpenGray);
-
-//
-//    dc.DrawRectangle(x, y, nCheckWidth, nCheckHeight);
 //
-//    if ( IsChecked() ) {
-//      dc.DrawLine(x, y, x + nCheckWidth, y + nCheckHeight);
-//      dc.DrawLine(x, y + nCheckHeight, x + nCheckWidth, y);
-//    }
+// Change the state of the item and redraw it
 //
-
-    return TRUE;
-  }
-*/
-  return FALSE;
-}
-
-// change the state of the item and redraw it
-void wxCheckListBoxItem::Check(bool check)
+void wxCheckListBoxItem::Check (
+  bool                              bCheck
+)
 {
-    m_bChecked = check;
+    m_bChecked = bCheck;
 
-    // index may be chanegd because new items were added/deleted
-    if ( m_pParent->GetItemIndex(this) != (int)m_nIndex )
+    //
+    // Index may be chanegd because new items were added/deleted
+    //
+    if (m_pParent->GetItemIndex(this) != (int)m_nIndex)
     {
-        // update it
-        int index = m_pParent->GetItemIndex(this);
+        //
+        // Update it
+        //
+        int                         nIndex = m_pParent->GetItemIndex(this);
 
-        wxASSERT_MSG( index != wxNOT_FOUND, wxT("what does this item do here?") );
+        wxASSERT_MSG(nIndex != wxNOT_FOUND, wxT("what does this item do here?"));
 
-        m_nIndex = (size_t)index;
+        m_nIndex = (size_t)nIndex;
     }
 
-    HWND hwndListbox = (HWND)m_pParent->GetHWND();
+    HWND                            hWndListbox = (HWND)m_pParent->GetHWND();
+    RECTL                           rUpdate;
+    MRESULT                         mRc;
 
-// TODO:
-/*
-    RECT rcUpdate;
-    if ( ::SendMessage(hwndListbox, LB_GETITEMRECT,
-                       m_nIndex, (LPARAM)&rcUpdate) == LB_ERR )
-    {
-        wxLogDebug(wxT("LB_GETITEMRECT failed"));
-    }
+    wxCommandEvent                  vEvent( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
+                                           ,m_pParent->GetId()
+                                          );
 
-    InvalidateRect(hwndListbox, &rcUpdate, FALSE);
-*/
-    wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, m_pParent->GetId());
-    event.SetInt(m_nIndex);
-    event.SetEventObject(m_pParent);
-    m_pParent->ProcessCommand(event);
-}
+    vEvent.SetInt(m_nIndex);
+    vEvent.SetEventObject(m_pParent);
+    m_pParent->ProcessCommand(vEvent);
+} // end of wxCheckListBoxItem::Check
 
 // ----------------------------------------------------------------------------
 // implementation of wxCheckListBox class
@@ -245,147 +249,228 @@ BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox)
   EVT_LEFT_DOWN(wxCheckListBox::OnLeftClick)
 END_EVENT_TABLE()
 
-// control creation
+//
+// Control creation
 // ----------------
+//
 
-// def ctor: use Create() to really create the control
-wxCheckListBox::wxCheckListBox() : wxListBox()
+//
+// Default ctor: use Create() to really create the control
+//
+wxCheckListBox::wxCheckListBox()
+: wxListBox()
 {
-}
+} // end of wxCheckListBox::wxCheckListBox
 
-// ctor which creates the associated control
-wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
-                               const wxPoint& pos, const wxSize& size,
-                               int nStrings, const wxString choices[],
+//
+// Ctor which creates the associated control
+//
+wxCheckListBox::wxCheckListBox (
+  wxWindow*                         pParent
+, wxWindowID                        vId
+, const wxPoint&                    rPos
+, const wxSize&                     rSize
+, int                               nStrings
+, const wxString                    asChoices[]
+, long                              lStyle
 #if wxUSE_VALIDATORS
-                               long style, const wxValidator& val,
+, const wxValidator&                rVal
 #endif
-                               const wxString& name)
+, const wxString&                   rsName
+)
               : wxListBox()
 {
-    Create(parent, id, pos, size, nStrings, choices,
-           style | wxLB_OWNERDRAW, val, name);
-}
+    Create( pParent
+           ,vId
+           ,rPos
+           ,rSize
+           ,nStrings
+           ,asChoices
+           ,lStyle | wxLB_OWNERDRAW
+#if wxUSE_VALIDATORS
+           ,rVal
+#endif
+           ,rsName
+          );
+} // end of wxCheckListBox::wxCheckListBox
 
-void wxCheckListBox::Delete(int N)
+void wxCheckListBox::Delete(
+  int                               N
+)
 {
     wxCHECK_RET( N >= 0 && N < m_nNumItems,
                  wxT("invalid index in wxListBox::Delete") );
-
     wxListBox::Delete(N);
 
-    // free memory
+    //
+    // Free memory
+    //
     delete m_aItems[N];
-
     m_aItems.RemoveAt(N);
-}
+} // end of wxCheckListBox::Delete
 
-void wxCheckListBox::InsertItems(int nItems, const wxString items[], int pos)
+void wxCheckListBox::InsertItems (
+  int                               nItems
+, const wxString                    asItems[]
+, int                               nPos
+)
 {
-    wxCHECK_RET( pos >= 0 && pos <= m_nNumItems,
-                 wxT("invalid index in wxCheckListBox::InsertItems") );
+    int                             i;
 
-    wxListBox::InsertItems(nItems, items, pos);
+    wxCHECK_RET( nPos >= 0 && nPos <= m_nNumItems,
+                 wxT("invalid index in wxCheckListBox::InsertItems") );
 
-    int i;
-    for ( i = 0; i < nItems; i++ ) {
-        wxOwnerDrawn *pNewItem = CreateItem((size_t)(pos + i));
-        pNewItem->SetName(items[i]);
-        m_aItems.Insert(pNewItem, (size_t)(pos + i));
-//        ListBox_SetItemData((HWND)GetHWND(), i + pos, pNewItem);
+    wxListBox::InsertItems( nItems
+                           ,asItems
+                           ,nPos
+                          );
+    for (i = 0; i < nItems; i++)
+    {
+        wxOwnerDrawn*               pNewItem = CreateItem((size_t)(nPos + i));
+
+        pNewItem->SetName(asItems[i]);
+        m_aItems.Insert(pNewItem, (size_t)(nPos + i));
+        ::WinSendMsg( (HWND)GetHWND()
+                     ,LM_SETITEMHANDLE
+                     ,(MPARAM)(i + nPos)
+                     ,MPFROMP(pNewItem)
+                    );
     }
-}
-
+} // end of wxCheckListBox::InsertItems
 
-bool wxCheckListBox::SetFont( const wxFont &font )
+bool wxCheckListBox::SetFont (
+  const wxFont&                     rFont
+)
 {
-    size_t i;
-    for (i=0; i < m_aItems.GetCount(); i++)
-        m_aItems[i]->SetFont(font);
-    wxListBox::SetFont(font);
+    size_t                          i;
+
+    for (i = 0; i < m_aItems.GetCount(); i++)
+        m_aItems[i]->SetFont(rFont);
+    wxListBox::SetFont(rFont);
     return TRUE;
-}
+} // end of wxCheckListBox::SetFont
 
-// create/retrieve item
+//
+// Create/retrieve item
 // --------------------
+//
 
-// create a check list box item
-wxOwnerDrawn *wxCheckListBox::CreateItem(size_t nIndex)
+//
+// Create a check list box item
+//
+wxOwnerDrawn* wxCheckListBox::CreateItem (
+  size_t                            nIndex
+)
 {
-  wxCheckListBoxItem *pItem = new wxCheckListBoxItem(this, nIndex);
-  return pItem;
-}
+    wxCheckListBoxItem*             pItem = new wxCheckListBoxItem( this
+                                                                   ,nIndex
+                                                                  );
+    return pItem;
+} // end of wxCheckListBox::CreateItem
 
-// return item size
+//
+// Return item size
 // ----------------
-// TODO:
-/*
-bool wxCheckListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
+//
+bool wxCheckListBox::OS2OnMeasure (
+  WXMEASUREITEMSTRUCT*             pItem
+)
 {
-  if ( wxListBox::MSWOnMeasure(item) ) {
-    MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item;
-
-    // save item height
-    m_nItemHeight = pStruct->itemHeight;
-
-    // add place for the check mark
-    pStruct->itemWidth += wxOwnerDrawn::GetDefaultMarginWidth();
-
-    return TRUE;
-  }
+    if (!pItem)
+        pItem = (WXMEASUREITEMSTRUCT*)new OWNERITEM;
+    if (wxListBox::OS2OnMeasure(pItem) )
+    {
+        POWNERITEM                  pStruct = (POWNERITEM)pItem;
+
+        //
+        // Save item height
+        //
+        m_nItemHeight = pStruct->rclItem.yTop - pStruct->rclItem.yBottom;
+
+        //
+        // Add place for the check mark
+        //
+        pStruct->rclItem.xRight += wxOwnerDrawn::GetDefaultMarginWidth();
+        return TRUE;
+    }
+    return FALSE;
+} // end of wxCheckListBox::CreateItem
 
-  return FALSE;
-}
-*/
-// check items
+//
+// Check items
 // -----------
-
-bool wxCheckListBox::IsChecked(size_t uiIndex) const
+//
+bool wxCheckListBox::IsChecked (
+  size_t                            uiIndex
+) const
 {
-  return GetItem(uiIndex)->IsChecked();
-}
+    return GetItem(uiIndex)->IsChecked();
+} // end of wxCheckListBox::IsChecked
 
-void wxCheckListBox::Check(size_t uiIndex, bool bCheck)
+void wxCheckListBox::Check (
+  size_t                            uiIndex
+, bool                              bCheck
+)
 {
-  GetItem(uiIndex)->Check(bCheck);
-}
+    GetItem(uiIndex)->Check(bCheck);
+} // end of wxCheckListBox::Check
 
-// process events
+//
+// Process events
 // --------------
-
-void wxCheckListBox::OnChar(wxKeyEvent& event)
+//
+void wxCheckListBox::OnChar (
+  wxKeyEvent&                       rEvent
+)
 {
-  if ( event.KeyCode() == WXK_SPACE )
-    GetItem(GetSelection())->Toggle();
-  else
-    event.Skip();
-}
-
-void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
+    if (rEvent.KeyCode() == WXK_SPACE)
+        GetItem(GetSelection())->Toggle();
+    else
+        rEvent.Skip();
+} // end of wxCheckListBox::OnChar
+
+void wxCheckListBox::OnLeftClick (
+  wxMouseEvent&                     rEvent
+)
 {
-  // clicking on the item selects it, clicking on the checkmark toggles
-  if ( event.GetX() <= wxOwnerDrawn::GetDefaultMarginWidth() ) {
-// TODO:
-/*
-      size_t nItem = (size_t)::SendMessage
-                               (
-                                (HWND)GetHWND(),
-                                LB_ITEMFROMPOINT,
-                                0,
-                                MAKELPARAM(event.GetX(), event.GetY())
-                               );
-*/
-    size_t nItem = 0;
-
-    if ( nItem < (size_t)m_nNumItems )
-      GetItem(nItem)->Toggle();
-    //else: it's not an error, just click outside of client zone
-  }
-  else {
-    // implement default behaviour: clicking on the item selects it
-    event.Skip();
-  }
-}
+    //
+    // Clicking on the item selects it, clicking on the checkmark toggles
+    //
+    if (rEvent.GetX() <= wxOwnerDrawn::GetDefaultMarginWidth())
+    {
+        int                         nParentHeight;
+        wxScreenDC                  vDc;
+        wxCoord                     vHeight;
+
+        GetSize( NULL
+                ,&nParentHeight
+               );
+        vDc.SetFont(GetFont());
+        vHeight = vDc.GetCharHeight() * 2.5;
+
+        //
+        // This, of course, will not work if the LB is scrolled
+        //
+        int                         nY = rEvent.GetY();
+
+        nY = nParentHeight - (nY + vHeight);
+
+        size_t                      nItem = (size_t)(nY / vHeight);
+
+        if (nItem < (size_t)m_nNumItems)
+            GetItem(nItem)->Toggle();
+        //
+        // else: it's not an error, just click outside of client zone
+        //
+    }
+    else
+    {
+        //
+        // Implement default behaviour: clicking on the item selects it
+        //
+        rEvent.Skip();
+    }
+} // end of wxCheckListBox::OnLeftClick
 
 #endif
 
index 651dfe9209e79f0b2b1d1ceaeaee6621b05740cd..038fa35ec555e8a048457bd304effaeda29d0666 100644 (file)
@@ -49,7 +49,7 @@ bool wxComboBox::OS2Command(
 
     switch (uParam)
     {
-        case LN_SELECT:
+        case CBN_LBSELECT:
             if (GetSelection() > -1)
             {
                 wxCommandEvent      vEvent( wxEVT_COMMAND_COMBOBOX_SELECTED
@@ -63,7 +63,7 @@ bool wxComboBox::OS2Command(
             }
             break;
 
-        case EN_CHANGE:
+        case CBN_EFCHANGE:
             {
                 wxCommandEvent      vEvent( wxEVT_COMMAND_TEXT_UPDATED
                                            ,GetId()
index 968cd9a851b95f46d1e77b2775c8611b602df2a8..5621ec8cd3c20eb2105e33bf6abc0dc65663f206 100644 (file)
@@ -410,6 +410,8 @@ void wxListBox::SetSelection(
                  ,MPFROMLONG(N)
                  ,(MPARAM)bSelect
                 );
+    if(m_windowStyle & wxLB_OWNERDRAW)
+        Refresh();
 } // end of wxListBox::SetSelection
 
 bool wxListBox::IsSelected(
@@ -807,21 +809,152 @@ bool wxListBox::OS2Command(
 //
 #define OWNER_DRAWN_LISTBOX_EXTRA_SPACE    (1)
 
-bool wxListBox::OS2OnMeasure(WXMEASUREITEMSTRUCT *item)
+bool wxListBox::OS2OnMeasure(
+  WXMEASUREITEMSTRUCT*              pItem
+)
 {
+    if (!pItem)
+        pItem = (WXMEASUREITEMSTRUCT*)new OWNERITEM;
+
+    POWNERITEM                      pMeasureStruct = (POWNERITEM)pItem;
+    wxScreenDC                      vDc;
+
     //
-    // TODO: Get to this eventually
+    // Only owner-drawn control should receive this message
     //
+    wxCHECK( ((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), FALSE );
+
+    vDc.SetFont(GetFont());
+
+    wxCoord                         vHeight;
+
+    pMeasureStruct->rclItem.xRight = 0;
+    pMeasureStruct->rclItem.xLeft  = 0;
+    pMeasureStruct->rclItem.yTop   = 0;
+    pMeasureStruct->rclItem.yBottom = 0;
+
+    vHeight = vDc.GetCharHeight() * 2.5;
+    pMeasureStruct->rclItem.yTop  = vHeight;
+
+    ::WinSendMsg( GetHWND()
+                 ,LM_SETITEMHEIGHT
+                 ,MPFROMLONG(vHeight)
+                 ,MPFROMLONG(pMeasureStruct->idItem)
+                );
     return TRUE;
-}
+} // end of wxListBox::OS2OnMeasure
 
-bool wxListBox::OS2OnDraw(WXDRAWITEMSTRUCT *item)
+bool wxListBox::OS2OnDraw (
+  WXDRAWITEMSTRUCT*                 pItem
+)
 {
+    POWNERITEM                      pDrawStruct = (POWNERITEM)pItem;
+    LONG                            lItemID = pDrawStruct->idItem;
+    int                             eAction = 0;
+    int                             eStatus = 0;
+
     //
-    // TODO: Get to this eventually
+    // Only owner-drawn control should receive this message
     //
-    return FALSE;
-}
+    wxCHECK(((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), FALSE);
+
+
+    //
+    // The item may be -1 for an empty listbox
+    //
+    if (lItemID == -1L)
+        return FALSE;
+
+    wxListBoxItem*                   pData = (wxListBoxItem*)PVOIDFROMMR( ::WinSendMsg( GetHwnd()
+                                                                                       ,LM_QUERYITEMHANDLE
+                                                                                       ,MPFROMLONG(pDrawStruct->idItem)
+                                                                                       ,(MPARAM)0
+                                                                                      )
+                                                                        );
+
+    wxCHECK(pData, FALSE );
+
+    wxDC                              vDc;
+    wxRect                            vRect( wxPoint( pDrawStruct->rclItem.xLeft
+                                                     ,pDrawStruct->rclItem.yTop
+                                                    )
+                                            ,wxPoint( pDrawStruct->rclItem.xRight
+                                                     ,pDrawStruct->rclItem.yBottom
+                                                    )
+                                           );
+
+    vDc.SetHPS(pDrawStruct->hps);
+
+    if (pDrawStruct->fsAttribute == pDrawStruct->fsAttributeOld)
+    {
+        //
+        // Entire Item needs to be redrawn (either it has reappeared from
+        // behind another window or is being displayed for the first time
+        //
+        eAction = wxOwnerDrawn::wxODDrawAll;
+
+        if (pDrawStruct->fsAttribute & MIA_HILITED)
+        {
+            //
+            // If it is currently selected we let the system handle it
+            //
+            eStatus |= wxOwnerDrawn::wxODSelected;
+        }
+        if (pDrawStruct->fsAttribute & MIA_CHECKED)
+        {
+            //
+            // If it is currently checked we draw our own
+            //
+            eStatus |= wxOwnerDrawn::wxODChecked;
+            pDrawStruct->fsAttributeOld = pDrawStruct->fsAttribute &= ~MIA_CHECKED;
+        }
+        if (pDrawStruct->fsAttribute & MIA_DISABLED)
+        {
+            //
+            // If it is currently disabled we let the system handle it
+            //
+            eStatus |= wxOwnerDrawn::wxODDisabled;
+        }
+        //
+        // Don't really care about framed (indicationg focus) or NoDismiss
+        //
+    }
+    else
+    {
+        if (pDrawStruct->fsAttribute & MIA_HILITED)
+        {
+            eAction = wxOwnerDrawn::wxODDrawAll;
+            eStatus |= wxOwnerDrawn::wxODSelected;
+            //
+            // Keep the system from trying to highlight with its bogus colors
+            //
+            pDrawStruct->fsAttributeOld = pDrawStruct->fsAttribute &= ~MIA_HILITED;
+        }
+        else if (!(pDrawStruct->fsAttribute & MIA_HILITED))
+        {
+            eAction = wxOwnerDrawn::wxODDrawAll;
+            eStatus = 0;
+            //
+            // Keep the system from trying to highlight with its bogus colors
+            //
+            pDrawStruct->fsAttribute = pDrawStruct->fsAttributeOld &= ~MIA_HILITED;
+        }
+        else
+        {
+            //
+            // For now we don't care about anything else
+            // just ignore the entire message!
+            //
+            return TRUE;
+        }
+    }
+    return pData->OnDrawItem( vDc
+                             ,vRect
+                             ,(wxOwnerDrawn::wxODAction)eAction
+                             ,(wxOwnerDrawn::wxODStatus)eStatus
+                            );
+} // end of wxListBox::OS2OnDraw
+
 #endif // ndef for wxUSE_OWNER_DRAWN
 
 #endif // ndef for wxUSE_LISTBOX
index 7cfd92ab124e2a409467f826e0a85a58047d7777..0f0339aa14acac691e45ae49afd1ac8816522aaa 100644 (file)
@@ -679,8 +679,20 @@ void wxNotebook::OnSize(
   wxSizeEvent&                      rEvent
 )
 {
-    if (m_nSelection < m_pages.Count() && m_nSelection >= 0)
-        m_pages[m_nSelection]->Refresh();
+    int                             nPage;
+    int                             nCount = (int)m_pages.Count();
+
+    for (nPage = 0; nPage < nCount; nPage++)
+    {
+        if (m_nSelection == nPage)
+            m_pages[nPage]->Refresh();
+        else
+            ::WinSetWindowPos(m_pages[nPage]->GetHWND()
+                              ,NULLHANDLE
+                              ,0,0,0,0
+                              ,SWP_HIDE
+                             );
+    }
     rEvent.Skip();
 } // end of wxNotebook::OnSize
 
@@ -693,22 +705,44 @@ void wxNotebook::OnSelChange (
     //
     if (rEvent.GetEventObject() == this)
     {
-        int                         nSel = rEvent.GetOldSelection();
+        int                         nPageCount = GetPageCount();
+        int                         nSel;
+        ULONG                       ulOS2Sel = (ULONG)rEvent.GetOldSelection();
+        bool                        bFound = FALSE;
 
-        if (nSel != -1)
+        for (nSel = 0; nSel < nPageCount; nSel++)
         {
-            m_pages[nSel]->Show(FALSE);
-            m_pages[nSel]->SetActivePage(FALSE);
+            if (ulOS2Sel == m_alPageId[nSel])
+            {
+                bFound = TRUE;
+                break;
+            }
         }
-        nSel = rEvent.GetSelection();
-        if (nSel != -1)
-        {
-            wxNotebookPage*         pPage = m_pages[nSel];
 
-            pPage->Show(TRUE);
-            pPage->SetFocus();
-            m_pages[nSel]->SetActivePage(TRUE);
+        if (!bFound)
+            return;
+
+        m_pages[nSel]->Show(FALSE);
+
+        ulOS2Sel = (ULONG)rEvent.GetSelection();
+
+        bFound = FALSE;
+
+        for (nSel = 0; nSel < nPageCount; nSel++)
+        {
+            if (ulOS2Sel == m_alPageId[nSel])
+            {
+                bFound = TRUE;
+                break;
+            }
         }
+
+        if (!bFound)
+            return;
+
+        wxNotebookPage*         pPage = m_pages[nSel];
+
+        pPage->Show(TRUE);
         m_nSelection = nSel;
     }
 
index 5d523be4ffd9fb8f72fc31d458580724b3acee00..7dbfa69b0ad3aa670a6dc594408bf29dff38879d 100644 (file)
 
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
 
+BEGIN_EVENT_TABLE(wxStaticBitmap, wxWindow)
+    EVT_PAINT(wxStaticBitmap::OnPaint)
+END_EVENT_TABLE()
+
 static wxGDIImage* ConvertImage(
   const wxGDIImage&                 rBitmap
 )
@@ -105,9 +109,8 @@ bool wxStaticBitmap::Create(
     //
     int                             nWinstyle = SS_ICON;
 
-    sprintf(zId, "#%d", rBitmap.GetId());
     m_hWnd = (WXHWND)::WinCreateWindow( pParent->GetHWND()
-                                       ,WC_STATIC
+                                       ,wxCanvasClassName
                                        ,zId
                                        ,nWinstyle | WS_VISIBLE
                                        ,0,0,0,0
@@ -129,6 +132,8 @@ bool wxStaticBitmap::Create(
 
     // Subclass again for purposes of dialog editing mode
     SubclassWin(m_hWnd);
+    SetSize(nX, nY, m_pImage->GetWidth(), m_pImage->GetHeight());
+
     return(TRUE);
 } // end of wxStaticBitmap::Create
 
@@ -153,6 +158,30 @@ wxSize wxStaticBitmap::DoGetBestSize() const
     return wxWindow::DoGetBestSize();
 }
 
+void wxStaticBitmap::OnPaint (
+  wxPaintEvent&                     WXUNUSED(rEvent)
+)
+{
+    wxPaintDC                       vDc(this);
+    int                             i;
+    wxBitmap*                       pBitmap;
+
+    if (m_pImage->IsKindOf(CLASSINFO(wxIcon)))
+    {
+        wxIcon*                     pIcon;
+
+        pIcon = wxDynamicCast(m_pImage, wxIcon);
+        pBitmap = new wxBitmap(*pIcon);
+        vDc.DrawBitmap(*pBitmap, 0, 0);
+        delete pBitmap;
+    }
+    else
+    {
+        pBitmap = wxDynamicCast(m_pImage, wxBitmap);
+        vDc.DrawBitmap(*pBitmap, 0, 0);
+    }
+} // end of wxStaticBitmap::OnPaint
+
 void wxStaticBitmap::SetImage(
   const wxGDIImage&                 rBitmap
 )
index 6fc21ee0c34257daf4d0dba498ed893d47b1d00e..951bf17e8c797136775a92746d48cb37ba26aca9 100644 (file)
     #include "wx/tooltip.h"
 #endif
 
+#if wxUSE_NOTEBOOK
+    #include "wx/notebook.h"
+#endif
+
 #if wxUSE_CARET
     #include "wx/caret.h"
 #endif // wxUSE_CARET
@@ -301,7 +305,6 @@ void wxWindowOS2::Init()
     m_bUseCtl3D             = FALSE;
     m_bMouseInWindow        = FALSE;
     m_bLastKeydownProcessed = FALSE;
-    m_bIsActivePage         = TRUE;
     m_pChildrenDisabled     = NULL;
 
     //
@@ -2905,7 +2908,6 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             // Avoid duplicate messages to OnChar for these ASCII keys: they
                             // will be translated by TranslateMessage() and received in WM_CHAR
                             case VK_ESC:
-                            case VK_SPACE:
                             case VK_ENTER:
                             case VK_BACKSPACE:
                             case VK_TAB:
@@ -2966,7 +2968,41 @@ MRESULT wxWindowOS2::OS2WindowProc(
         case WM_CONTROL:
             switch(SHORT2FROMMP(wParam))
             {
-                case BN_CLICKED:
+                case BKN_PAGESELECTEDPENDING:
+                    {
+                        PPAGESELECTNOTIFY  pPage = (PPAGESELECTNOTIFY)lParam;
+
+                        if ((pPage->ulPageIdNew != pPage->ulPageIdCur) &&
+                            (pPage->ulPageIdNew > 0L && pPage->ulPageIdCur > 0L))
+                        {
+                            wxWindowOS2*        pWin = wxFindWinFromHandle(pPage->hwndBook);
+                            wxNotebookEvent     vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
+                                                       ,(int)SHORT1FROMMP(wParam)
+                                                       ,(int)pPage->ulPageIdNew
+                                                       ,(int)pPage->ulPageIdCur
+                                                      );
+                            if (!pWin)
+                            {
+                                bProcessed = FALSE;
+                                break;
+                            }
+                            if (pWin->IsKindOf(CLASSINFO(wxNotebook)))
+                            {
+                                wxNotebook*         pNotebook = wxDynamicCast(pWin, wxNotebook);
+
+                                vEvent.SetEventObject(pWin);
+                                pNotebook->OnSelChange(vEvent);
+                                bProcessed = TRUE;
+                            }
+                            else
+                                bProcessed = FALSE;
+                        }
+                        else
+                            bProcessed = FALSE;
+                    }
+                    break;
+
+                case BN_CLICKED: // Dups as LN_SELECT and CBN_LBSELECT
                     {
                         HWND                hWnd = ::WinWindowFromID((HWND)GetHwnd(), SHORT1FROMMP(wParam));
                         wxWindowOS2*        pWin = wxFindWinFromHandle(hWnd);
@@ -3004,6 +3040,61 @@ MRESULT wxWindowOS2::OS2WindowProc(
                                                   ,(WXUINT)SHORT1FROMMP(wParam)
                                                  );
                         }
+                        if (pWin->IsKindOf(CLASSINFO(wxListBox)))
+                        {
+                            wxListBox*          pListBox = wxDynamicCast(pWin, wxListBox);
+
+                            pListBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+                                                 ,(WXUINT)SHORT1FROMMP(wParam)
+                                                );
+                            if (pListBox->GetWindowStyle() & wxLB_OWNERDRAW)
+                                Refresh();
+                        }
+                        if (pWin->IsKindOf(CLASSINFO(wxComboBox)))
+                        {
+                            wxComboBox*          pComboBox = wxDynamicCast(pWin, wxComboBox);
+
+                            pComboBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+                                                  ,(WXUINT)SHORT1FROMMP(wParam)
+                                                 );
+                        }
+                        return 0;
+                    }
+                    break;
+
+                case LN_ENTER:   /* dups as CBN_EFCHANGE */
+                    {
+                        HWND                hWnd = HWNDFROMMP(lParam);
+                        wxWindowOS2*        pWin = wxFindWinFromHandle(hWnd);
+
+                        if (!pWin)
+                        {
+                            bProcessed = FALSE;
+                            break;
+                        }
+                        //
+                        // Simulate a WM_COMMAND here, as wxWindows expects all control
+                        // button clicks to generate WM_COMMAND msgs, not WM_CONTROL
+                        //
+                        if (pWin->IsKindOf(CLASSINFO(wxListBox)))
+                        {
+                            wxListBox*          pListBox = wxDynamicCast(pWin, wxListBox);
+
+                            pListBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+                                                 ,(WXUINT)SHORT1FROMMP(wParam)
+                                                );
+                            if (pListBox->GetWindowStyle() & wxLB_OWNERDRAW)
+                                Refresh();
+
+                        }
+                        if (pWin->IsKindOf(CLASSINFO(wxComboBox)))
+                        {
+                            wxComboBox*          pComboBox = wxDynamicCast(pWin, wxComboBox);
+
+                            pComboBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+                                                  ,(WXUINT)SHORT1FROMMP(wParam)
+                                                 );
+                        }
                         return 0;
                     }
                     break;
@@ -3755,7 +3846,10 @@ bool wxWindowOS2::OS2OnMeasureItem(
 
     if (pItem && pItem->IsKindOf(CLASSINFO(wxControl)))
     {
-        return ((wxControl *)pItem)->OS2OnMeasure(pItemStruct);
+        OWNERITEM                   vItem;
+
+        vItem.idItem = (LONG)pItemStruct;
+        return ((wxControl *)pItem)->OS2OnMeasure((WXMEASUREITEMSTRUCT*)&vItem);
     }
 #else
     lId = lId;
@@ -3902,33 +3996,30 @@ bool wxWindowOS2::HandlePaint()
                                      ,0L
                                      ,NULL
                                     );
-
-            if (::WinIsWindowVisible(GetHWND()) && m_bIsActivePage)
-            {
+            if (::WinIsWindowVisible(GetHWND()))
                 ::WinFillRect(hPS, &vRect,  GetBackgroundColour().GetPixel());
-                if (m_dwExStyle)
-                {
-                    LINEBUNDLE      vLineBundle;
-
-                    vLineBundle.lColor     = 0x00000000; // Black
-                    vLineBundle.usMixMode  = FM_OVERPAINT;
-                    vLineBundle.fxWidth    = 1;
-                    vLineBundle.lGeomWidth = 1;
-                    vLineBundle.usType     = LINETYPE_SOLID;
-                    vLineBundle.usEnd      = 0;
-                    vLineBundle.usJoin     = 0;
-                    ::GpiSetAttrs( hPS
-                                  ,PRIM_LINE
-                                  ,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE
-                                  ,0L
-                                  ,&vLineBundle
-                                 );
-                    ::WinQueryWindowRect(GetHwnd(), &vRect);
-                    wxDrawBorder( hPS
-                                 ,vRect
-                                 ,m_dwExStyle
-                                );
-                }
+            if (m_dwExStyle)
+            {
+                LINEBUNDLE      vLineBundle;
+
+                vLineBundle.lColor     = 0x00000000; // Black
+                vLineBundle.usMixMode  = FM_OVERPAINT;
+                vLineBundle.fxWidth    = 1;
+                vLineBundle.lGeomWidth = 1;
+                vLineBundle.usType     = LINETYPE_SOLID;
+                vLineBundle.usEnd      = 0;
+                vLineBundle.usJoin     = 0;
+                ::GpiSetAttrs( hPS
+                              ,PRIM_LINE
+                              ,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE
+                              ,0L
+                              ,&vLineBundle
+                             );
+                ::WinQueryWindowRect(GetHwnd(), &vRect);
+                wxDrawBorder( hPS
+                             ,vRect
+                             ,m_dwExStyle
+                            );
             }
         }
         ::WinEndPaint(hPS);
@@ -3967,7 +4058,7 @@ bool wxWindowOS2::HandlePaint()
                                      ,NULL
                                     );
 
-            if (::WinIsWindowVisible(GetHWND()) && m_bIsActivePage)
+            if (::WinIsWindowVisible(GetHWND()))
                 ::WinFillRect(hPS, &vRect,  GetBackgroundColour().GetPixel());
         }
         ::WinEndPaint(hPS);
@@ -4327,7 +4418,7 @@ bool wxWindowOS2::HandleChar(
         // ctrlDown.  IOW, Ctrl-C should result in keycode == 3 and
         // ControlDown() == TRUE.
         //
-        vId = (int)wParam;
+        vId = SHORT1FROMMP(lParam);
         if ((vId > 0) && (vId < 27))
         {
             switch (vId)
@@ -4352,7 +4443,7 @@ bool wxWindowOS2::HandleChar(
     }
     else  // we're called from WM_KEYDOWN
     {
-        vId = wxCharCodeOS2ToWX((int)wParam);
+        vId = wxCharCodeOS2ToWX((int)SHORT2FROMMP(lParam));
         if (vId == 0)
             return FALSE;
     }
@@ -4374,14 +4465,14 @@ bool wxWindowOS2::HandleKeyDown(
 , WXLPARAM                          lParam
 )
 {
-    int                             nId = wxCharCodeOS2ToWX((int)wParam);
+    int                             nId = wxCharCodeOS2ToWX((int)SHORT2FROMMP(lParam));
 
     if (!nId)
     {
         //
         // Normal ASCII char
         //
-        nId = (int)wParam;
+        nId = SHORT1FROMMP(lParam);
     }
 
     if (nId != -1)
@@ -4405,7 +4496,7 @@ bool wxWindowOS2::HandleKeyUp(
 , WXLPARAM                          lParam
 )
 {
-    int                             nId = wxCharCodeOS2ToWX((int)wParam);
+    int                             nId = wxCharCodeOS2ToWX((int)SHORT2FROMMP(lParam));
 
     if (!nId)
     {