- wxString msg;
- msg.Printf( _T("This is the about dialog of minimal sample.\n")
- _T("Welcome to %s")
-#ifdef wxBETA_NUMBER
- _T(" (beta %d)!")
-#endif // wxBETA_NUMBER
- , wxVERSION_STRING
-#ifdef wxBETA_NUMBER
- , wxBETA_NUMBER
-#endif // wxBETA_NUMBER
- );
-
- wxMessageBox(msg, "About Minimal", wxOK | wxICON_INFORMATION, this);
-}
-
-struct Foo
-{
- Foo(int n_) { n = n_; }
-
- int n;
-};
-
-WX_DECLARE_LIST(Foo, FooList);
-
-#include <wx/listimpl.cpp>
-
-WX_DEFINE_LIST(FooList);
-
-int FooSort(const Foo **item1, const Foo **item2)
-{
- return (*item2)->n - (*item1)->n;
-}
-
-void ShowList(const FooList& list)
-{
- wxString msg, str;
- msg = "The list elements: (";
- for ( FooList::Node *node = list.GetFirst(); node; node = node->GetNext() )
- {
- if ( !!str )
- msg += ", ";
- str.Printf("%d", node->GetData()->n);
- msg += str;
- }
-
- msg += ')';
-
- wxMessageBox(msg, "List contents", wxOK | wxICON_INFORMATION);
-}
-
-void MyFrame::OnTest(wxCommandEvent& event)
-{
- FooList list;
- list.Append(new Foo(12));
- list.Append(new Foo(3));
- list.Append(new Foo(1));
- list.Append(new Foo(7));
- list.Append(new Foo(4));
- ShowList(list);
- list.Sort(FooSort);
- ShowList(list);
-}
-
-void MyFrame::OnPaint(wxPaintEvent& event)
-{
- wxPaintDC dc(this);
-
- wxMemoryDC dcMem;
- wxSize size(GetClientSize());
- dcMem.SelectObject(wxBitmap(size.x, size.y, -1));
-
- dcMem.SetBackground(wxBrush(wxColour(0, 0, 255), wxSOLID));
- dcMem.SetTextForeground(wxColour(0, 255, 0));
- dcMem.SetTextBackground(wxColour(0, 0, 0));
- dcMem.SetBackgroundMode(wxSOLID);
- dcMem.Clear();
- dcMem.DrawText("Hello, wxWindows!", 10, 10);
-
- wxPoint ptOrig(0, 0);
- dc.Blit(ptOrig, size, &dcMem, ptOrig);
-
- dcMem.SelectObject(wxNullBitmap);