// common part of all ctors
void Init();
+ void SendListEvent(wxEventType type, wxPoint pos);
+
DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
DECLARE_EVENT_TABLE()
};
// suspend/resume redrawing the control
void Freeze();
void Thaw();
-
+
void SetFocus();
void OnRenameTimer();
if (m_isDragging)
{
+ SendListEvent(wxEVT_COMMAND_LIST_COL_DRAGGING,
+ event.GetPosition());
+
// we don't draw the line beyond our window, but we allow dragging it
// there
int w = 0;
m_isDragging = FALSE;
m_dirty = TRUE;
m_owner->SetColumnWidth( m_column, m_currentX - m_minX );
+ SendListEvent(wxEVT_COMMAND_LIST_COL_END_DRAG,
+ event.GetPosition());
}
else
{
m_currentX = x;
DrawCurrent();
CaptureMouse();
+ SendListEvent(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG,
+ event.GetPosition());
}
else // click on a column
{
- wxWindow *parent = GetParent();
- wxListEvent le( event.LeftDown()
+ SendListEvent( event.LeftDown()
? wxEVT_COMMAND_LIST_COL_CLICK
: wxEVT_COMMAND_LIST_COL_RIGHT_CLICK,
- parent->GetId() );
- le.SetEventObject( parent );
- le.m_pointDrag = event.GetPosition();
-
- // the position should be relative to the parent window, not
- // this one for compatibility with MSW and common sense: the
- // user code doesn't know anything at all about this header
- // window, so why should it get positions relative to it?
- le.m_pointDrag.y -= GetSize().y;
-
- le.m_col = m_column;
- parent->GetEventHandler()->ProcessEvent( le );
+ event.GetPosition());
}
}
else if (event.Moving())
m_owner->SetFocus();
}
+void wxListHeaderWindow::SendListEvent(wxEventType type, wxPoint pos)
+{
+ wxWindow *parent = GetParent();
+ wxListEvent le( type, parent->GetId() );
+ le.SetEventObject( parent );
+ le.m_pointDrag = pos;
+
+ // the position should be relative to the parent window, not
+ // this one for compatibility with MSW and common sense: the
+ // user code doesn't know anything at all about this header
+ // window, so why should it get positions relative to it?
+ le.m_pointDrag.y -= GetSize().y;
+
+ le.m_col = m_column;
+ parent->GetEventHandler()->ProcessEvent( le );
+}
+
//-----------------------------------------------------------------------------
// wxListRenameTimer (internal)
//-----------------------------------------------------------------------------
(*m_accept) = TRUE;
(*m_res) = GetValue();
-
+
if ((*m_res) != m_startValue)
m_owner->OnRenameAccept();
}
#ifdef __WXGTK__
// FIXME: wxGTK generates bad sequence of events prior to doubleclick
- // ("down, up, down, double, up" while other ports
+ // ("down, up, down, double, up" while other ports
// do "down, up, double, up"). We have to have this hack
// in place till somebody fixes wxGTK...
if ( current == m_lineBeforeLastClicked )
void wxListMainWindow::SetFocus()
{
// VS: wxListMainWindow derives from wxPanel (via wxScrolledWindow) and wxPanel
- // overrides SetFocus in such way that it does never change focus from
+ // overrides SetFocus in such way that it does never change focus from
// panel's child to the panel itself. Unfortunately, we must be able to change
- // focus to the panel from wxListTextCtrl because the text control should
+ // focus to the panel from wxListTextCtrl because the text control should
// disappear when the user clicks outside it.
wxWindow *oldFocus = FindFocus();
-
+
if ( oldFocus && oldFocus->GetParent() == this )
{
wxWindow::SetFocus();
int clientWidth,
clientHeight;
GetSize( &clientWidth, &clientHeight );
-
+
if ( HasFlag(wxLC_REPORT) )
{
// all lines have the same height
{
// We start with 4 for the border around all items
entireWidth = 4;
-
+
if (tries == 1)
{
// Now we have decided that the items do not fit into the
// a scrollbar at the bottom of its client area.
entireWidth += SCROLL_UNIT_X;
}
-
+
// Start at 2,2 so the text does not touch the border
int x = 2;
int y = 2;
entireWidth += maxWidth+6;
maxWidth = 0;
}
-
+
// We have reached the last item.
if ( i == count - 1 )
entireWidth += maxWidth;
-
+
if ( (tries == 0) && (entireWidth+SCROLL_UNIT_X > clientWidth) )
{
clientHeight -= 15; // We guess the scrollbar height. (FIXME)
currentlyVisibleLines = 0;
break;
}
-
+
if ( i == count - 1 )
tries = 1; // Everything fits, no second try required.
}