#define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space
-#ifdef __WXGTK20__
-#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES)
+// make the default control appearance look more native-like depending on the
+// platform
+#if defined(__WXGTK20__)
+ #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES)
+#elif defined(__WXMAC__)
+ #define wxTR_DEFAULT_STYLE \
+ (wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxTR_FULL_ROW_HIGHLIGHT)
#else
-#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)
+ #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)
#endif
#if WXWIN_COMPATIBILITY_2_6
wxTreeTextCtrl(wxGenericTreeCtrl *owner, wxGenericTreeItem *item);
void EndEdit( bool discardChanges );
-
+
const wxGenericTreeItem* item() const { return m_itemEdited; }
protected:
void wxTreeTextCtrl::EndEdit(bool discardChanges)
{
m_aboutToFinish = true;
-
+
if ( discardChanges )
{
m_owner->OnRenameCancelled(m_itemEdited);
-
+
Finish( true );
}
else
{
if ( !AcceptChanges() )
m_owner->OnRenameCancelled( m_itemEdited );
-
+
Finish( false );
}
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,
{
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;
#else
rect.x -= 1;
rect.width += 2;
-
+
int flags = wxCONTROL_SELECTED;
if (m_hasFocus)
flags |= wxCONTROL_FOCUSED;
{
rect.x -= 1;
rect.width += 2;
-
+
int flags = wxCONTROL_SELECTED;
if (m_hasFocus)
flags |= wxCONTROL_FOCUSED;