// status inquiries
bool HasChildren() const { return !m_children.IsEmpty(); }
- bool IsSelected() const { return m_hasHilight; }
+ bool IsSelected() const { return m_hasHilight != 0; }
bool IsExpanded() const { return !m_isCollapsed; }
bool HasPlus() const { return m_hasPlus || HasChildren(); }
- bool IsBold() const { return m_isBold; }
+ bool IsBold() const { return m_isBold != 0; }
// attributes
// get them - may be NULL
m_imageListNormal =
m_imageListState = (wxImageList *) NULL;
+ m_ownsImageListNormal =
+ m_ownsImageListState = FALSE;
m_dragCount = 0;
m_isDragging = FALSE;
const wxValidator &validator,
const wxString& name )
{
- Init();
-
wxScrolledWindow::Create( parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name );
#if wxUSE_VALIDATORS
DeleteAllItems();
delete m_renameTimer;
+ if (m_ownsImageListNormal) delete m_imageListNormal;
+ if (m_ownsImageListState) delete m_imageListState;
}
// -----------------------------------------------------------------------------
if ( data != NULL )
{
- data->m_pItem = item;
+ data->m_pItem = (long) item;
}
parent->Insert( item, previous );
image, selImage, data);
if ( data != NULL )
{
- data->m_pItem = m_anchor;
+ data->m_pItem = (long) m_anchor;
}
if (!HasFlag(wxTR_MULTIPLE))
void wxGenericTreeCtrl::SendDeleteEvent(wxGenericTreeItem *item)
{
wxTreeEvent event( wxEVT_COMMAND_TREE_DELETE_ITEM, GetId() );
- event.m_item = item;
+ event.m_item = (long) item;
event.SetEventObject( this );
ProcessEvent( event );
}
return;
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_EXPANDING, GetId() );
- event.m_item = item;
+ event.m_item = (long) item;
event.SetEventObject( this );
if ( ProcessEvent( event ) && !event.IsAllowed() )
return;
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_COLLAPSING, GetId() );
- event.m_item = item;
+ event.m_item = (long) item;
event.SetEventObject( this );
if ( ProcessEvent( event ) && !event.IsAllowed() )
{
}
wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, GetId() );
- event.m_item = item;
- event.m_itemOld = m_current;
+ event.m_item = (long) item;
+ event.m_itemOld = (long) m_current;
event.SetEventObject( this );
// TODO : Here we don't send any selection mode yet !
void wxGenericTreeCtrl::SetImageList(wxImageList *imageList)
{
+ if (m_ownsImageListNormal) delete m_imageListNormal;
+
m_imageListNormal = imageList;
+ m_ownsImageListNormal = FALSE;
if ( !m_imageListNormal )
return;
void wxGenericTreeCtrl::SetStateImageList(wxImageList *imageList)
{
+ if (m_ownsImageListState) delete m_imageListState;
m_imageListState = imageList;
+ m_ownsImageListState = FALSE;
+}
+
+void wxGenericTreeCtrl::AssignImageList(wxImageList *imageList)
+{
+ SetImageList(imageList);
+ m_ownsImageListNormal = TRUE;
+}
+
+void wxGenericTreeCtrl::AssignStateImageList(wxImageList *imageList)
+{
+ SetStateImageList(imageList);
+ m_ownsImageListState = TRUE;
}
// -----------------------------------------------------------------------------
if ( attr && attr->HasTextColour() )
colText = attr->GetTextColour();
else
- colText = *wxBLACK;
+ colText = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOWTEXT );
}
// prepare to draw
case WXK_RETURN:
{
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
- event.m_item = m_current;
+ event.m_item = (long) m_current;
event.m_code = 0;
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
m_currentEdit = (wxGenericTreeItem*) item.m_pItem;
wxTreeEvent te( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, GetId() );
- te.m_item = m_currentEdit;
+ te.m_item = (long) m_currentEdit;
te.SetEventObject( this );
GetEventHandler()->ProcessEvent( te );
void wxGenericTreeCtrl::OnRenameAccept()
{
wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, GetId() );
- le.m_item = m_currentEdit;
+ le.m_item = (long) m_currentEdit;
le.SetEventObject( this );
le.m_label = m_renameRes;
GetEventHandler()->ProcessEvent( le );
: wxEVT_COMMAND_TREE_BEGIN_DRAG;
wxTreeEvent nevent( command, GetId() );
- nevent.m_item = m_current;
+ nevent.m_item = (long) m_current;
nevent.SetEventObject(this);
// by default the dragging is not supported, the user code must
// generate the drag end event
wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG, GetId());
- event.m_item = item;
+ event.m_item = (long) item;
event.m_pointDrag = wxPoint(x, y);
event.SetEventObject(this);
if ( event.RightDown() )
{
wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId());
- nevent.m_item = item;
+ nevent.m_item = (long) item;
nevent.m_code = 0;
nevent.SetEventObject(this);
GetEventHandler()->ProcessEvent(nevent);
}
- else if ( event.LeftUp() && m_lastOnSame )
+ else if ( event.LeftUp() )
{
- if ( (item == m_current) &&
- (flags & wxTREE_HITTEST_ONITEMLABEL) &&
- HasFlag(wxTR_EDIT_LABELS) )
+ if ( m_lastOnSame )
{
- m_renameTimer->Start( 100, TRUE );
- }
+ if ( (item == m_current) &&
+ (flags & wxTREE_HITTEST_ONITEMLABEL) &&
+ HasFlag(wxTR_EDIT_LABELS) )
+ {
+ if ( m_renameTimer->IsRunning() )
+ m_renameTimer->Stop();
- m_lastOnSame = FALSE;
+ m_renameTimer->Start( 100, TRUE );
+ }
+
+ m_lastOnSame = FALSE;
+ }
}
else
{
m_lastOnSame = FALSE;
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
- nevent.m_item = item;
+ nevent.m_item = (long) item;
nevent.m_code = 0;
nevent.SetEventObject( this );
GetEventHandler()->ProcessEvent( nevent );