]> git.saurik.com Git - wxWidgets.git/commitdiff
added test for simplistic control with border
authorRobert Roebling <robert@roebling.de>
Fri, 9 Nov 2007 12:12:47 +0000 (12:12 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 9 Nov 2007 12:12:47 +0000 (12:12 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/toolbar/toolbar.cpp

index 687dab791ba495317239c4cf06ce00bb1f99e7e9..829d6020863fdde89777971108e75e0b95f7ab55 100644 (file)
@@ -84,6 +84,36 @@ enum Positions
 // classes
 // ----------------------------------------------------------------------------
 
+class MyMiniControl: public wxControl
+{
+public:
+    MyMiniControl( wxWindow *parent ) :
+      wxControl( parent, -1, wxDefaultPosition, wxSize(70,22), wxBORDER_SUNKEN, wxDefaultValidator, "MyMiniControl" )
+    {
+    }
+    void OnPaint(wxPaintEvent &WXUNUSED(event))
+    {
+       wxPaintDC dc(this);
+       dc.SetPen( *wxWHITE_PEN );
+       dc.SetBrush( *wxGREEN_BRUSH );
+       wxSize size = GetClientSize();
+       dc.DrawRectangle( 0,0,size.x,size.y );
+    }
+    virtual wxSize GetBestSize()
+    {
+        return wxSize(70,22);
+    }
+
+private:
+    DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE(MyMiniControl, wxControl)
+    EVT_PAINT(MyMiniControl::OnPaint)
+END_EVENT_TABLE()
+
+
+
 // Define a new application
 class MyApp : public wxApp
 {
@@ -438,6 +468,8 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
 
         wxSearchCtrl *srch = new wxSearchCtrl( toolBar, -1, wxT("xx"), wxDefaultPosition, wxSize(80,wxDefaultCoord), wxSUNKEN_BORDER );
         toolBar->AddControl( srch );
+        
+        toolBar->AddControl( new MyMiniControl( toolBar) );
     }
 #endif // toolbars which don't support controls