X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/352d44d26856241d5e14dac630ab4473d18e05ef..34cf9bb5093f1b96c4cd3306738ec4e26f60c3cb:/contrib/samples/gizmos/splittree/tree.cpp diff --git a/contrib/samples/gizmos/splittree/tree.cpp b/contrib/samples/gizmos/splittree/tree.cpp index a060a5f887..d65f57beb8 100644 --- a/contrib/samples/gizmos/splittree/tree.cpp +++ b/contrib/samples/gizmos/splittree/tree.cpp @@ -98,7 +98,7 @@ static char * icon2_xpm[] = { // resources // ---------------------------------------------------------------------------- // the application icon -#if defined(__WXGTK__) || defined(__WXMOTIF__) +#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) #include "mondrian.xpm" #endif @@ -133,7 +133,7 @@ IMPLEMENT_APP(MyApp) bool MyApp::OnInit() { // create the main application window - MyFrame *frame = new MyFrame("Tree Testing", + MyFrame *frame = new MyFrame(wxT("Tree Testing"), wxPoint(50, 50), wxSize(450, 340)); // and show it (the frames, unlike simple controls, are not shown when @@ -169,8 +169,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) m_splitter = new wxThinSplitterWindow(m_scrolledWindow, idSPLITTER_WINDOW, wxDefaultPosition, wxDefaultSize, wxSP_3DBORDER | wxCLIP_CHILDREN /* | wxSP_LIVE_UPDATE */); m_splitter->SetSashSize(2); - m_tree = new TestTree(m_splitter, idTREE_CTRL, wxDefaultPosition, - wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER ); + + /* Note the wxTR_ROW_LINES style: draws horizontal lines between items */ + m_tree = new TestTree(m_splitter , idTREE_CTRL, wxDefaultPosition, + wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER | wxTR_ROW_LINES ); m_valueWindow = new TestValueWindow(m_splitter, idVALUE_WINDOW, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); m_splitter->SplitVertically(m_tree, m_valueWindow); @@ -188,18 +190,18 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) SetIcon(wxICON(mondrian)); // create a menu bar - wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF); + wxMenu *menuFile = new wxMenu(wxT(""), wxMENU_TEAROFF); // the "About" item should be in the help menu wxMenu *helpMenu = new wxMenu; - helpMenu->Append(Minimal_About, "&About...\tCtrl-A", "Show about dialog"); + helpMenu->Append(Minimal_About, wxT("&About...\tCtrl-A"), wxT("Show about dialog")); - menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program"); + menuFile->Append(Minimal_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); // now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); - menuBar->Append(menuFile, "&File"); - menuBar->Append(helpMenu, "&Help"); + menuBar->Append(menuFile, wxT("&File")); + menuBar->Append(helpMenu, wxT("&Help")); // ... and attach this menu bar to the frame SetMenuBar(menuBar); @@ -217,10 +219,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxString msg; - msg.Printf( _T("This is the about dialog of tree sample.\n") - _T("Welcome to %s"), wxVERSION_STRING); + msg.Printf( wxT("This is the about dialog of splittree sample.\n") + wxT("Welcome to %s"), wxVERSION_STRING); - wxMessageBox(msg, "About Tree Test", wxOK | wxICON_INFORMATION, this); + wxMessageBox(msg, wxT("About Tree Test"), wxOK | wxICON_INFORMATION, this); } /* @@ -230,7 +232,6 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) IMPLEMENT_CLASS(TestTree, wxRemotelyScrolledTreeCtrl) BEGIN_EVENT_TABLE(TestTree, wxRemotelyScrolledTreeCtrl) - EVT_PAINT(TestTree::OnPaint) END_EVENT_TABLE() TestTree::TestTree(wxWindow* parent, wxWindowID id, const wxPoint& pt, @@ -273,41 +274,6 @@ TestTree::~TestTree() delete m_imageList; } -void TestTree::OnPaint(wxPaintEvent& event) -{ - wxPaintDC dc(this); - - wxTreeCtrl::OnPaint(event); - - // Reset the device origin since it may have been set - dc.SetDeviceOrigin(0, 0); - - wxSize sz = GetClientSize(); - - wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID); - dc.SetPen(pen); - dc.SetBrush(* wxTRANSPARENT_BRUSH); - - wxSize clientSize = GetClientSize(); - wxRect itemRect; - int cy=0; - wxTreeItemId h, lastH; - for(h=GetFirstVisibleItem();h;h=GetNextVisible(h)) - { - if (GetBoundingRect(h, itemRect)) - { - cy = itemRect.GetTop(); - dc.DrawLine(0, cy, clientSize.x, cy); - lastH = h; - } - } - if (GetBoundingRect(lastH, itemRect)) - { - cy = itemRect.GetBottom(); - dc.DrawLine(0, cy, clientSize.x, cy); - } -} - /* * TestValueWindow */