]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listbox.cpp
* Big memory bug fixed in socket/getline fixed.
[wxWidgets.git] / src / msw / listbox.cpp
index c3a7f127559d918e9901f6a76200d000db7f80a4..46f202afe2d2d93900f7df82d3021ed5653db2a6 100644 (file)
@@ -23,6 +23,9 @@
 #ifndef WX_PRECOMP
 #include "wx/listbox.h"
 #include "wx/settings.h"
+#include "wx/brush.h"
+#include "wx/font.h"
+#include "wx/dc.h"
 #endif
 
 #include "wx/msw/private.h"
 #include <windows.h>
 #include <windowsx.h>
 
+#ifndef __TWIN32__
 #ifdef __GNUWIN32__
 #include <wx/msw/gnuwin32/extra.h>
 #endif
+#endif
 
 #ifdef GetCharWidth
 #undef GetCharWidth
@@ -135,7 +140,7 @@ bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
 }
 
 // Listbox item
-wxListBox::wxListBox(void)
+wxListBox::wxListBox()
 {
   m_noItems = 0;
   m_selected = 0;
@@ -211,7 +216,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 
   wxCHECK_MSG( m_hWnd, FALSE, "Failed to create listbox" );
 
-#if CTL3D
+#if wxUSE_CTL3D
   if (want3D)
   {
     Ctl3dSubclassCtl(hwnd);
@@ -244,7 +249,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
   if ( (m_windowStyle & wxLB_MULTIPLE) == 0 )
     SendMessage(hwnd, LB_SETCURSEL, 0, 0);
 
-  SetFont(parent->GetFont());
+  SetFont(parent->GetFont());
 
   SetSize(x, y, width, height);
 
@@ -253,7 +258,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
   return TRUE;
 }
 
-wxListBox::~wxListBox(void)
+wxListBox::~wxListBox()
 {
 #if wxUSE_OWNER_DRAWN
     size_t uiCount = m_aItems.Count();
@@ -263,7 +268,7 @@ wxListBox::~wxListBox(void)
 #endif
 }
 
-void wxListBox::SetupColours(void)
+void wxListBox::SetupColours()
 {
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
   SetForegroundColour(GetParent()->GetForegroundColour());
@@ -372,7 +377,7 @@ int wxListBox::FindString(const wxString& s) const
    return pos;
 }
 
-void wxListBox::Clear(void)
+void wxListBox::Clear()
 {
   ListBox_ResetContent(hwnd);
 
@@ -469,7 +474,7 @@ wxString wxListBox::GetString(int N) const
   return wxString(wxBuffer);
 }
 
-void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
+void wxListBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
   int currentX, currentY;
   GetPosition(&currentX, &currentY);
@@ -495,7 +500,7 @@ void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
   int cx; // button font dimensions
   int cy;
 
-  wxGetCharSize(GetHWND(), &cx, &cy,GetFont());
+  wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont());
 
   float control_width, control_height, control_x, control_y;
 
@@ -540,8 +545,8 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
     int existingExtent = (int)SendMessage(hwnd, LB_GETHORIZONTALEXTENT, 0, 0L);
     HDC dc = GetWindowDC(hwnd);
     HFONT oldFont = 0;
-    if (GetFont() && GetFont()->GetResourceHandle())
-      oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont()->GetResourceHandle());
+    if (GetFont().Ok() && GetFont().GetResourceHandle())
+      oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
 
     GetTextMetrics(dc, &lpTextMetric);
     SIZE extentXY;
@@ -561,8 +566,8 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
     int largestExtent = 0;
     HDC dc = GetWindowDC(hwnd);
     HFONT oldFont = 0;
-    if (GetFont() && GetFont()->GetResourceHandle())
-      oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont()->GetResourceHandle());
+    if (GetFont().Ok() && GetFont().GetResourceHandle())
+      oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
 
     GetTextMetrics(dc, &lpTextMetric);
     int i;
@@ -635,13 +640,13 @@ void wxListBox::SetString(int N, const wxString& s)
 #endif  //USE_OWNER_DRAWN
 }
 
-int wxListBox::Number (void) const
+int wxListBox::Number () const
 {
   return m_noItems;
 }
 
 // For single selection items only
-wxString wxListBox::GetStringSelection (void) const
+wxString wxListBox::GetStringSelection () const
 {
   int sel = GetSelection ();
   if (sel > -1)
@@ -683,7 +688,7 @@ void wxListBox::Command (wxCommandEvent & event)
 WXHBRUSH wxListBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
                        WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
 {
-#if CTL3D
+#if wxUSE_CTL3D
   if ( m_useCtl3D )
   {
     HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);