]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectlg.cpp
Patches-1940222 ] wxTextCtrl and keydown on fully selected text (wxMac)
[wxWidgets.git] / src / generic / treectlg.cpp
index 61e67c5ed77ed11eed30df3257f608a1843e170c..2ac26238faca5042056fb78abe8b610e819a8172 100644 (file)
@@ -51,7 +51,7 @@
 
 class WXDLLIMPEXP_FWD_CORE wxGenericTreeItem;
 
-WX_DEFINE_EXPORTED_ARRAY_PTR(wxGenericTreeItem *, wxArrayGenericTreeItems);
+WX_DEFINE_ARRAY_PTR(wxGenericTreeItem *, wxArrayGenericTreeItems);
 
 // ----------------------------------------------------------------------------
 // constants
@@ -92,8 +92,8 @@ class WXDLLEXPORT wxTreeTextCtrl: public wxTextCtrl
 public:
     wxTreeTextCtrl(wxGenericTreeCtrl *owner, wxGenericTreeItem *item);
 
-    void EndEdit(bool discardChanges = false);
-    
+    void EndEdit( bool discardChanges );
+
     const wxGenericTreeItem* item() const { return m_itemEdited; }
 
 protected:
@@ -102,7 +102,7 @@ protected:
     void OnKillFocus( wxFocusEvent &event );
 
     bool AcceptChanges();
-    void Finish( bool setfocus = true );
+    void Finish( bool setfocus );
 
 private:
     wxGenericTreeCtrl  *m_owner;
@@ -387,12 +387,12 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner,
 void wxTreeTextCtrl::EndEdit(bool discardChanges)
 {
     m_aboutToFinish = true;
-    
+
     if ( discardChanges )
     {
         m_owner->OnRenameCancelled(m_itemEdited);
-           
-        Finish();
+
+        Finish( true );
     }
     else
     {
@@ -400,7 +400,7 @@ void wxTreeTextCtrl::EndEdit(bool discardChanges)
         AcceptChanges();
 
         // Even if vetoed, close the control (consistent with MSW)
-        Finish();
+        Finish( true );
     }
 }
 
@@ -485,7 +485,7 @@ void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &event )
     {
         if ( !AcceptChanges() )
             m_owner->OnRenameCancelled( m_itemEdited );
-            
+
         Finish( false );
     }
 
@@ -750,7 +750,7 @@ void wxGenericTreeCtrl::Init()
                             (
                                 wxSYS_COLOUR_HIGHLIGHT
                             ),
-                            wxSOLID
+                            wxBRUSHSTYLE_SOLID
                          );
 
     m_hilightUnfocusedBrush = new wxBrush
@@ -759,7 +759,7 @@ void wxGenericTreeCtrl::Init()
                                  (
                                      wxSYS_COLOUR_BTNSHADOW
                                  ),
-                                 wxSOLID
+                                 wxBRUSHSTYLE_SOLID
                               );
 
     m_imageListButtons = NULL;
@@ -802,21 +802,12 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent,
                                const wxString& name )
 {
 #ifdef __WXMAC__
-    int major,minor;
-    wxGetOsVersion( &major, &minor );
+    int major, minor;
+    wxGetOsVersion(&major, &minor);
 
-    style &= ~wxTR_LINES_AT_ROOT;
-    style |= wxTR_NO_LINES;
     if (major < 10)
         style |= wxTR_ROW_LINES;
-        
-    if (style == 0 || style & wxTR_DEFAULT_STYLE)
-        style |= wxTR_FULL_ROW_HIGHLIGHT;
-        
 #endif // __WXMAC__
-#ifdef __WXGTK20__
-    style |= wxTR_NO_LINES;
-#endif
 
     if ( !wxControl::Create( parent, id, pos, size,
                              style|wxHSCROLL|wxVSCROLL,
@@ -843,7 +834,7 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent,
     // style because we apparently get performance problems when using dotted
     // pen for drawing in some ports -- but under MSW it seems to work fine
 #ifdef __WXMSW__
-    m_dottedPen = wxPen(*wxLIGHT_GREY, 0, wxDOT);
+    m_dottedPen = wxPen(*wxLIGHT_GREY, 0, wxPENSTYLE_DOT);
 #else
     m_dottedPen = *wxGREY_PEN;
 #endif
@@ -1906,7 +1897,7 @@ void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, bool select)
     {
         wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
         wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") );
-        
+
         wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGING, this, item);
         if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() )
             return;
@@ -2217,7 +2208,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
         {
             colBg = GetBackgroundColour();
         }
-        dc.SetBrush(wxBrush(colBg, wxSOLID));
+        dc.SetBrush(wxBrush(colBg, wxBRUSHSTYLE_SOLID));
     }
 
     int offset = HasFlag(wxTR_ROW_LINES) ? 1 : 0;
@@ -2264,7 +2255,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
 #else
             rect.x -= 1;
             rect.width += 2;
-        
+
             int flags = wxCONTROL_SELECTED;
             if (m_hasFocus)
                 flags |= wxCONTROL_FOCUSED;
@@ -2291,7 +2282,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
             {
                 rect.x -= 1;
                 rect.width += 2;
-                
+
                 int flags = wxCONTROL_SELECTED;
                 if (m_hasFocus)
                     flags |= wxCONTROL_FOCUSED;
@@ -2313,7 +2304,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
         dc.DestroyClippingRegion();
     }
 
-    dc.SetBackgroundMode(wxTRANSPARENT);
+    dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
     int extraH = (total_h > text_h) ? (total_h - text_h)/2 : 0;
     dc.DrawText( item->GetText(),
                  (wxCoord)(image_w + item->GetX()),
@@ -3569,6 +3560,8 @@ void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item)
 
 void wxGenericTreeCtrl::DoThaw()
 {
+    wxTreeCtrlBase::DoThaw();
+
     if ( m_dirty )
         DoDirtyProcessing();
     else