// headers
// ---------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(__APPLE__)
- #pragma implementation "treelistctrl.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// wxTreeListHeaderWindow
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow,wxWindow);
+IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow,wxWindow)
BEGIN_EVENT_TABLE(wxTreeListHeaderWindow,wxWindow)
EVT_ERASE_BACKGROUND (wxTreeListHeaderWindow::OnEraseBackground)
m_owner = owner;
m_resizeCursor = new wxCursor(wxCURSOR_SIZEWE);
- SetBackgroundColour(wxSystemSettings::GetSystemColour(
+ SetBackgroundColour(wxSystemSettings::GetColour(
wxSYS_COLOUR_BTNFACE));
}
dc->SetBrush( *wxTRANSPARENT_BRUSH );
- dc->SetPen( wxPen(wxSystemSettings::GetSystemColour(
+ dc->SetPen( wxPen(wxSystemSettings::GetColour(
wxSYS_COLOUR_BTNSHADOW), 1, wxSOLID));
dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer)
dc->DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer)
dc->DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
- wxPen pen(wxSystemSettings::GetSystemColour(
+ wxPen pen(wxSystemSettings::GetColour(
wxSYS_COLOUR_BTNSHADOW ), 1, wxSOLID);
dc->SetPen( pen );
// function to set it separately
//dc.SetTextForeground( *wxBLACK );
dc.SetTextForeground(wxSystemSettings::
- GetSystemColour( wxSYS_COLOUR_WINDOWTEXT ));
+ GetColour( wxSYS_COLOUR_WINDOWTEXT ));
int x = HEADER_OFFSET_X;
// end of the current column
int xpos = 0;
- // find the column where this event occured
+ // find the column where this event occurred
int countCol = GetColumnCount();
for (int col = 0; col < countCol; col++)
{
m_hilightBrush = new wxBrush
(
- wxSystemSettings::GetSystemColour
+ wxSystemSettings::GetColour
(
wxSYS_COLOUR_HIGHLIGHT
),
m_hilightUnfocusedBrush = new wxBrush
(
- wxSystemSettings::GetSystemColour
+ wxSystemSettings::GetColour
(
wxSYS_COLOUR_BTNSHADOW
),
m_underMouse = NULL;
-#if defined( __WXMAC__ ) && defined(__WXMAC_CARBON__)
+#ifdef __WXMAC_CARBON__
m_normalFont.MacCreateThemeFont( kThemeViewsFont ) ;
#else
m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
SetValidator( validator );
#endif
- SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_LISTBOX ) );
+ SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ) );
#ifdef __WXMSW__
{
if ( data != NULL )
{
- data->SetId((long)item);
+ data->SetId((void*)item);
}
parent->Insert( item, previous );
#endif
if ( data != NULL )
{
- data->SetId((long)m_anchor);
+ data->SetId((void*)m_anchor);
}
if (!HasFlag(wxTR_MULTIPLE))
void wxTreeListMainWindow::SendDeleteEvent(wxTreeListItem *item)
{
wxTreeEvent event( wxEVT_COMMAND_TREE_DELETE_ITEM, m_owner->GetId() );
- event.SetItem((long) item);
+ event.SetItem((void*)item);
event.SetEventObject( /*this*/m_owner );
m_owner->ProcessEvent( event );
}
return;
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_EXPANDING, m_owner->GetId() );
- event.SetItem( (long) item );
+ event.SetItem( (void*)item );
event.SetEventObject( /*this*/m_owner );
if ( m_owner->ProcessEvent( event ) && !event.IsAllowed() )
return;
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_COLLAPSING, m_owner->GetId() );
- event.SetItem( (long) item );
+ event.SetItem( (void*)item );
event.SetEventObject( /*this*/m_owner );
if ( m_owner->ProcessEvent( event ) && !event.IsAllowed() )
{
}
wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, m_owner->GetId() );
- event.SetItem( (long) item );
- event.SetOldItem( (long) m_current );
+ event.SetItem( (void*)item );
+ event.SetOldItem( (void*)m_current );
event.SetEventObject( /*this*/m_owner );
// TODO : Here we don't send any selection mode yet !
wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, m_owner->GetId() );
event.SetItem( GetRootItem() );
- event.SetOldItem( (long) m_current );
+ event.SetOldItem( (void*) m_current );
event.SetEventObject( /*this*/m_owner );
// TODO : Here we don't send any selection mode yet !
if (item->IsSelected() && HasFlag(wxTR_FULL_ROW_HIGHLIGHT)) {
dc.SetBrush(*(m_hasFocus ? m_hilightBrush : m_hilightUnfocusedBrush));
dc.SetPen(*wxBLACK_PEN);
- colText = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
+ colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
} else {
wxColour colBg;
if (attr && attr->HasBackgroundColour()) {
int width = wxMin(text_w+2, colwidth - text_x - x_colstart);
dc.DrawRectangle(text_x-1, item->GetY() + offset, width, total_h-offset);
dc.SetBackgroundMode(wxTRANSPARENT);
- dc.SetTextForeground(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
+ dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
}else{
dc.SetTextForeground(colText);
}
{
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED,
m_owner->GetId() );
- event.SetItem( (long) m_current);
+ event.SetItem( (void*) m_current);
event.SetEventObject( /*this*/m_owner );
m_owner->GetEventHandler()->ProcessEvent( event );
}
m_currentEdit = (wxTreeListItem*) item.m_pItem;
wxTreeEvent te( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, m_owner->GetId() );
- te.SetItem( (long) m_currentEdit);
+ te.SetItem( (void*) m_currentEdit);
te.SetEventObject( /*this*/m_owner );
m_owner->GetEventHandler()->ProcessEvent( te );
{
// TODO if the validator fails this causes a crash
wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, m_owner->GetId() );
- le.SetItem( (long) m_currentEdit );
+ le.SetItem( (void*)m_currentEdit );
le.SetEventObject( /*this*/m_owner );
le.SetLabel( m_renameRes );
m_owner->GetEventHandler()->ProcessEvent( le );
int flags = 0;
wxTreeListItem *item = m_anchor->HitTest(pt, this, flags, 0);
wxTreeListItem *underMouse = item;
+#if wxUSE_TOOLTIPS
+ bool underMouseChanged = (underMouse != m_underMouse) ;
+#endif // wxUSE_TOOLTIPS
if (underMouse && (flags & wxTREE_HITTEST_ONITEMBUTTON) &&
!event.LeftIsDown() && !m_isDragging &&
RefreshLine( m_underMouse );
}
+#if wxUSE_TOOLTIPS
+ // Determines what item we are hovering over and need a tooltip for
+ wxTreeItemId hoverItem = item;
+
+ // We do not want a tooltip if we are dragging, or if the rename timer is running
+ if (underMouseChanged && hoverItem.IsOk() && !m_isDragging && (!m_renameTimer || !m_renameTimer->IsRunning()))
+ {
+ // Ask the tree control what tooltip (if any) should be shown
+ wxTreeEvent hevent(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, GetId());
+ hevent.SetItem(hoverItem);
+ hevent.SetEventObject(this);
+
+ if ( GetEventHandler()->ProcessEvent(hevent) && hevent.IsAllowed() )
+ {
+ SetToolTip(hevent.GetLabel());
+ }
+ }
+#endif
+
// we process left mouse up event (enables in-place edit), right down
// (pass to the user code), left dbl click (activate item) and
// dragging/moving events for items drag-and-drop
: wxEVT_COMMAND_TREE_BEGIN_DRAG;
wxTreeEvent nevent( command,/*ALB*/ m_owner->GetId() );
- nevent.SetItem( (long) m_current);
+ nevent.SetItem( (void*)m_current);
nevent.SetEventObject(/*this*/m_owner); // ALB
+ nevent.SetPoint(pt);
// by default the dragging is not supported, the user code must
// explicitly allow the event for it to take place
// generate the drag end event
wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG,/*ALB*/m_owner->GetId());
- event.SetItem( (long) item );
+ event.SetItem( (void*)item );
event.SetPoint( wxPoint(x, y) );
event.SetEventObject(/*this*/m_owner);
SetFocus();
wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK,
m_owner->GetId());
- nevent.SetItem( (long) item );
+ nevent.SetItem( (void*)item );
int nx, ny;
CalcScrolledPosition(x, y, &nx, &ny);
nevent.SetPoint( wxPoint(nx, ny));
// send activate event first
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED,
m_owner->GetId() );
- nevent.SetItem( (long) item );
+ nevent.SetItem( (void*)item );
int nx, ny;
CalcScrolledPosition(x, y, &nx, &ny);
nevent.SetPoint( wxPoint(nx, ny) );
// wxTreeListCtrl
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxTreeListCtrl, wxControl);
+IMPLEMENT_DYNAMIC_CLASS(wxTreeListCtrl, wxControl)
BEGIN_EVENT_TABLE(wxTreeListCtrl, wxControl)
EVT_SIZE(wxTreeListCtrl::OnSize)
+ EVT_TREE_ITEM_GETTOOLTIP(wxID_ANY, wxTreeListCtrl::OnGetToolTip)
END_EVENT_TABLE();
bool wxTreeListCtrl::Create(wxWindow *parent, wxWindowID id,
// something is better than nothing...
return wxSize(100,80);
}
+
+// Process the tooltip event, to speed up event processing.
+// Doesn't actually get a tooltip.
+void wxTreeListCtrl::OnGetToolTip( wxTreeEvent &event )
+{
+ event.Veto();
+}
+