]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/listbox.cpp
Applied patch [ 1378183 ] Mac: wxNotebook::HitTest off by one
[wxWidgets.git] / src / os2 / listbox.cpp
index dacc04c2b667ff44137fbba33666e869874f2b24..d5e6bc01faabc46c5965616ce55af30acfcbe02b 100644 (file)
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        listbox.cpp
+// Name:        src/os2/listbox.cpp
 // Purpose:     wxListBox
 // Author:      David Webster
 // Modified by:
 // Purpose:     wxListBox
 // Author:      David Webster
 // Modified by:
@@ -65,9 +65,7 @@ wxListBoxItem::wxListBoxItem(
     SetMarginWidth(0);
 } // end of wxListBoxItem::wxListBoxItem
 
     SetMarginWidth(0);
 } // end of wxListBoxItem::wxListBoxItem
 
-wxOwnerDrawn* wxListBox::CreateItem(
-  size_t                            n
-)
+wxOwnerDrawn* wxListBox::CreateItem( size_t WXUNUSED(n) )
 {
     return new wxListBoxItem();
 } // end of wxListBox::CreateItem
 {
     return new wxListBoxItem();
 } // end of wxListBox::CreateItem
@@ -194,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();
 
@@ -207,7 +205,7 @@ bool wxListBox::Create(
                       ,sizeof(LONG)
                       ,(PVOID)&lColor
                      );
                       ,sizeof(LONG)
                       ,(PVOID)&lColor
                      );
-    vColour.Set(wxString(wxT("NAVY")));
+    vColour = wxSystemSettingsNative::GetColour(wxSYS_COLOUR_HIGHLIGHT);
     lColor = (LONG)vColour.GetPixel();
     ::WinSetPresParam( m_hWnd
                       ,PP_HILITEBACKGROUNDCOLOR
     lColor = (LONG)vColour.GetPixel();
     ::WinSetPresParam( m_hWnd
                       ,PP_HILITEBACKGROUNDCOLOR
@@ -215,6 +213,8 @@ bool wxListBox::Create(
                       ,(PVOID)&lColor
                      );
 
                       ,(PVOID)&lColor
                      );
 
+    SetXComp(0);
+    SetYComp(0);
     SetSize( nX
             ,nY
             ,nWidth
     SetSize( nX
             ,nY
             ,nWidth
@@ -366,30 +366,6 @@ void wxListBox::DoSetItems(
     ::WinShowWindow(GetHwnd(), TRUE);
 } // end of wxListBox::DoSetItems
 
     ::WinShowWindow(GetHwnd(), TRUE);
 } // end of wxListBox::DoSetItems
 
-int wxListBox::FindString(
-  const wxString&                   rsString
-) const
-{
-    int                             nPos;
-    LONG                            lTextLength;
-    PSZ                             zStr;
-
-
-    for (nPos = 0; nPos < m_nNumItems; nPos++)
-    {
-        lTextLength = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)nPos, (MPARAM)0));
-        zStr = new char[lTextLength + 1];
-        ::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT(nPos, (SHORT)lTextLength), (MPARAM)zStr);
-        if (rsString == (wxChar*)zStr)
-        {
-            delete [] zStr;
-            break;
-        }
-        delete [] zStr;
-    }
-    return nPos;
-} // end of wxListBox::FindString
-
 void wxListBox::Clear()
 {
 #if wxUSE_OWNER_DRAWN
 void wxListBox::Clear()
 {
 #if wxUSE_OWNER_DRAWN
@@ -508,9 +484,7 @@ bool wxListBox::HasMultipleSelection() const
     return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
 } // end of wxListBox::HasMultipleSelection
 
     return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
 } // end of wxListBox::HasMultipleSelection
 
-int wxListBox::GetSelections(
-  wxArrayInt&                       raSelections
-) const
+int wxListBox::GetSelections( wxArrayInt& raSelections ) const
 {
     int                             nCount = 0;
     LONG                            lItem;
 {
     int                             nCount = 0;
     LONG                            lItem;
@@ -557,7 +531,6 @@ int wxListBox::GetSelections(
             }
             return nCount;
         }
             }
             return nCount;
         }
-        return 0;
     }
     else  // single-selection listbox
     {
     }
     else  // single-selection listbox
     {
@@ -777,7 +750,7 @@ bool wxListBox::OS2Command(
     {
         eEvtType = wxEVT_COMMAND_LISTBOX_SELECTED;
     }
     {
         eEvtType = wxEVT_COMMAND_LISTBOX_SELECTED;
     }
-    if (uParam == LN_ENTER)
+    else if (uParam == LN_ENTER)
     {
         eEvtType = wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
     }
     {
         eEvtType = wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
     }
@@ -892,14 +865,10 @@ bool wxListBox::OS2OnDraw (
 
     wxCHECK(pData, false );
 
 
     wxCHECK(pData, false );
 
-    wxDC                              vDc;
-    wxRect                            vRect( wxPoint( pDrawStruct->rclItem.xLeft
-                                                     ,pDrawStruct->rclItem.yTop
-                                                    )
-                                            ,wxPoint( pDrawStruct->rclItem.xRight
-                                                     ,pDrawStruct->rclItem.yBottom
-                                                    )
-                                           );
+    wxDC    vDc;
+    wxPoint pt1( pDrawStruct->rclItem.xLeft, pDrawStruct->rclItem.yTop );
+    wxPoint pt2( pDrawStruct->rclItem.xRight, pDrawStruct->rclItem.yBottom );
+    wxRect  vRect( pt1, pt2 );
 
     vDc.SetHPS(pDrawStruct->hps);
 
 
     vDc.SetHPS(pDrawStruct->hps);
 
@@ -976,4 +945,3 @@ bool wxListBox::OS2OnDraw (
 #endif // ndef for wxUSE_OWNER_DRAWN
 
 #endif // ndef for wxUSE_LISTBOX
 #endif // ndef for wxUSE_OWNER_DRAWN
 
 #endif // ndef for wxUSE_LISTBOX
-