]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectlg.cpp
In wxComboPopupEvtHandler::OnMouseEvent(), when need to relay event to drop-down...
[wxWidgets.git] / src / generic / treectlg.cpp
index da93936fdf2a0d7375a423ed23bbe0e4f8f71080..70f6bfcd3c109f1fadcc2aa56933f1482c399331 100644 (file)
@@ -973,7 +973,7 @@ void wxGenericTreeCtrl::Init()
     m_lastOnSame = false;
 
 #if defined( __WXMAC__ )
-    m_normalFont.CreateSystemFont(wxOSX_SYSTEM_FONT_VIEWS);
+    m_normalFont = wxFont(wxOSX_SYSTEM_FONT_VIEWS);
 #else
     m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
 #endif
@@ -1953,6 +1953,20 @@ void wxGenericTreeCtrl::Unselect()
     }
 }
 
+void wxGenericTreeCtrl::ClearFocusedItem()
+{
+    wxTreeItemId item = GetFocusedItem();
+    if ( item.IsOk() )
+        SelectItem(item, false);
+}
+
+void wxGenericTreeCtrl::SetFocusedItem(const wxTreeItemId& item)
+{
+    wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
+
+    SelectItem(item, true);
+}
+
 void wxGenericTreeCtrl::UnselectAllChildren(wxGenericTreeItem *item)
 {
     if (item->IsSelected())
@@ -3062,6 +3076,21 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
     // end   : go to last item without opening parents
     // alnum : start or continue searching for the item with this prefix
     int keyCode = event.GetKeyCode();
+
+#ifdef __WXOSX__
+    // Make the keys work as they do in the native control:
+    // right => expand
+    // left => collapse if current item is expanded
+    if (keyCode == WXK_RIGHT)
+    {
+        keyCode = '+';
+    }
+    else if (keyCode == WXK_LEFT && IsExpanded(m_current))
+    {
+        keyCode = '-';
+    }
+#endif // __WXOSX__
+
     switch ( keyCode )
     {
         case '+':