]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxVListBox::OnDrawBackground(); fixed warnings
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 30 Jul 2003 21:36:38 +0000 (21:36 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 30 Jul 2003 21:36:38 +0000 (21:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/htmllbox.h
include/wx/vlbox.h
include/wx/vscroll.h
samples/htlbox/htlbox.cpp
src/generic/htmllbox.cpp
src/generic/vlbox.cpp

index 5098935c17fd4dffd952929298dbf1ca8cccc118..49405b94b9fbe13279c8cc7c9e9947851f9c7b4d 100644 (file)
@@ -120,6 +120,7 @@ private:
 
 
     DECLARE_EVENT_TABLE()
+    DECLARE_NO_COPY_CLASS(wxHtmlListBox)
 };
 
 #endif // _WX_HTMLLBOX_H_
index 276076ece7e6e3f280e3a24a4b8abd9215d34ac2..6b30ac122e3938afe3acbc456c58aec8d4f27388 100644 (file)
@@ -202,6 +202,14 @@ protected:
     // the base class version doesn't do anything
     virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const;
 
+    // this method is used to draw the items background and, maybe, a border
+    // around it
+    //
+    // the base class version implements a reasonable default behaviour which
+    // consists in drawing the selected item with the standard background
+    // colour and drawing a border around the item if it is either selected or
+    // current
+    virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
 
     // we implement OnGetLineHeight() in terms of OnMeasureItem() because this
     // allows us to add borders to the items easily
@@ -269,6 +277,7 @@ private:
 
 
     DECLARE_EVENT_TABLE()
+    DECLARE_NO_COPY_CLASS(wxVListBox)
 };
 
 #endif // _WX_VLBOX_H_
index 1cdc9d1e485a4f55ac49b07b8c9b3ac97f10a0b6..eb2185bb1c84ecd4274f8e181d9b8779c216383f 100644 (file)
@@ -146,7 +146,8 @@ protected:
     //
     // finally note that lineMin is inclusive, while lineMax is exclusive, as
     // usual
-    virtual void OnGetLinesHint(size_t lineMin, size_t lineMax) const { }
+    virtual void OnGetLinesHint(size_t WXUNUSED(lineMin),
+                                size_t WXUNUSED(lineMax)) const { }
 
     // when the number of lines changes, we try to estimate the total height
     // of all lines which is a rather expensive operation in terms of lines
@@ -194,6 +195,7 @@ private:
 
 
     DECLARE_EVENT_TABLE()
+    DECLARE_NO_COPY_CLASS(wxVScrolledWindow)
 };
 
 #endif // _WX_VSCROLL_H_
index 1a87b03df6f7c544cc9363f5b75a8065ff7a887f..dfb89455fb7d1d29925c618251182f25d9e7262c 100644 (file)
@@ -45,7 +45,7 @@
 
 // you can also have a file containing HTML strings for testing, enable this if
 // you want to use it
-//#define USE_HTML_FILE
+#define USE_HTML_FILE
 #ifdef USE_HTML_FILE
     #include "wx/textfile.h"
 #endif
@@ -84,6 +84,8 @@ protected:
 #ifdef USE_HTML_FILE
     wxTextFile m_file;
 #endif
+
+    DECLARE_NO_COPY_CLASS(MyHtmlListBox)
 };
 
 class MyFrame : public wxFrame
index dff147a45c6dc1592f97622051e2e30aca336b00..0c5578c11a6a9f439d66b9baa2da5f1bb858241d 100644 (file)
@@ -144,6 +144,8 @@ public:
 
 private:
     const wxHtmlListBox& m_hlbox;
+
+    DECLARE_NO_COPY_CLASS(wxHtmlListBoxStyle)
 };
 
 
index 938b9d331c76d8780cd5e28d81b18bdbf8f920f3..fedb4496a4ce98c060cd04fe213859c9c3bc63cf 100644 (file)
@@ -319,7 +319,30 @@ void wxVListBox::OnDrawSeparator(wxDC& WXUNUSED(dc),
 {
 }
 
-void wxVListBox::OnPaint(wxPaintEvent& event)
+void wxVListBox::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
+{
+    // we need to render selected and current items differently
+    const bool isSelected = IsSelected(n),
+               isCurrent = IsCurrent(n);
+    if ( isSelected || isCurrent )
+    {
+        if ( isSelected )
+        {
+            dc.SetBrush(wxBrush(m_colBgSel, wxSOLID));
+        }
+        else // !selected
+        {
+            dc.SetBrush(*wxTRANSPARENT_BRUSH);
+        }
+
+        dc.SetPen(*(isCurrent ? wxBLACK_PEN : wxTRANSPARENT_PEN));
+
+        dc.DrawRectangle(rect);
+    }
+    //else: do nothing for the normal items
+}
+
+void wxVListBox::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
 
@@ -344,25 +367,9 @@ void wxVListBox::OnPaint(wxPaintEvent& event)
             // don't allow drawing outside of the lines rectangle
             wxDCClipper clip(dc, rectLine);
 
-            // we need to render selected and current items differently
-            const bool isSelected = IsSelected(line);
-            if ( isSelected || IsCurrent(line) )
-            {
-                if ( isSelected )
-                {
-                    dc.SetBrush(wxBrush(m_colBgSel, wxSOLID));
-                }
-                else // !selected
-                {
-                    dc.SetBrush(*wxTRANSPARENT_BRUSH);
-                }
-
-                dc.SetPen(*(IsCurrent(line) ? wxBLACK_PEN : wxTRANSPARENT_PEN));
-
-                dc.DrawRectangle(rectLine);
-            }
-
             wxRect rect = rectLine;
+            OnDrawBackground(dc, rect, line);
+
             OnDrawSeparator(dc, rect, line);
 
             rect.Deflate(m_ptMargins.x, m_ptMargins.y);