]> git.saurik.com Git - wxWidgets.git/blame - src/generic/headerctrlg.cpp
Implement wxWindow::DoGetBorderSize() for all ports.
[wxWidgets.git] / src / generic / headerctrlg.cpp
CommitLineData
56873923
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/generic/headerctrlg.cpp
3// Purpose: generic wxHeaderCtrl implementation
4// Author: Vadim Zeitlin
5// Created: 2008-12-03
6// RCS-ID: $Id$
7// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19// for compilers that support precompilation, includes "wx.h".
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
e721a2a2 26#if wxUSE_HEADERCTRL
56873923
VZ
27
28#include "wx/headerctrl.h"
29
30#ifdef wxHAS_GENERIC_HEADERCTRL
31
b63f9a33
VZ
32#include "wx/dcbuffer.h"
33#include "wx/renderer.h"
34
35// ----------------------------------------------------------------------------
36// constants
37// ----------------------------------------------------------------------------
38
39namespace
40{
41
b63f9a33
VZ
42const unsigned COL_NONE = (unsigned)-1;
43
44} // anonymous namespace
45
56873923 46// ============================================================================
b63f9a33 47// wxHeaderCtrl implementation
56873923
VZ
48// ============================================================================
49
b63f9a33
VZ
50// ----------------------------------------------------------------------------
51// wxHeaderCtrl creation
52// ----------------------------------------------------------------------------
53
54void wxHeaderCtrl::Init()
55{
40dc2ae6 56 m_numColumns = 0;
aef252d9 57 m_hover =
6327cdd5
VZ
58 m_colBeingResized =
59 m_colBeingReordered = COL_NONE;
60 m_dragOffset = 0;
b63f9a33
VZ
61 m_scrollOffset = 0;
62}
63
64bool wxHeaderCtrl::Create(wxWindow *parent,
65 wxWindowID id,
66 const wxPoint& pos,
67 const wxSize& size,
68 long style,
69 const wxString& name)
70{
71 if ( !wxHeaderCtrlBase::Create(parent, id, pos, size,
72 style, wxDefaultValidator, name) )
73 return false;
74
75 // tell the system to not paint the background at all to avoid flicker as
76 // we paint the entire window area in our OnPaint()
77 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
78
79 return true;
80}
81
82wxHeaderCtrl::~wxHeaderCtrl()
83{
84}
85
86// ----------------------------------------------------------------------------
87// wxHeaderCtrl columns manipulation
88// ----------------------------------------------------------------------------
89
40dc2ae6
VZ
90void wxHeaderCtrl::DoSetCount(unsigned int count)
91{
f6655391
VZ
92 // update the column indices order array before changing m_numColumns
93 DoResizeColumnIndices(m_colIndices, count);
74d283aa 94
40dc2ae6
VZ
95 m_numColumns = count;
96
7bf5be6b 97 InvalidateBestSize();
40dc2ae6
VZ
98 Refresh();
99}
100
b63f9a33
VZ
101unsigned int wxHeaderCtrl::DoGetCount() const
102{
40dc2ae6
VZ
103 return m_numColumns;
104}
105
106void wxHeaderCtrl::DoUpdate(unsigned int idx)
107{
7bf5be6b
VZ
108 InvalidateBestSize();
109
40dc2ae6
VZ
110 // we need to refresh not only this column but also the ones after it in
111 // case it was shown or hidden or its width changed -- it would be nice to
112 // avoid doing this unnecessary by storing the old column width (TODO)
113 RefreshColsAfter(idx);
b63f9a33
VZ
114}
115
b63f9a33
VZ
116// ----------------------------------------------------------------------------
117// wxHeaderCtrl scrolling
118// ----------------------------------------------------------------------------
119
120void wxHeaderCtrl::DoScrollHorz(int dx)
121{
122 m_scrollOffset += dx;
123
124 // don't call our own version which calls this function!
125 wxControl::ScrollWindow(dx, 0);
126}
127
128// ----------------------------------------------------------------------------
129// wxHeaderCtrl geometry
130// ----------------------------------------------------------------------------
131
132wxSize wxHeaderCtrl::DoGetBestSize() const
133{
b047e876
RR
134 wxWindow *win = GetParent();
135 int height = wxRendererNative::Get().GetHeaderButtonHeight( win );
136
b63f9a33
VZ
137 // the vertical size is rather arbitrary but it looks better if we leave
138 // some space around the text
7bf5be6b
VZ
139 const wxSize size(IsEmpty() ? wxHeaderCtrlBase::DoGetBestSize().x
140 : GetColEnd(GetColumnCount() - 1),
b047e876 141 height ); // (7*GetCharHeight())/4);
7bf5be6b
VZ
142 CacheBestSize(size);
143 return size;
b63f9a33
VZ
144}
145
146int wxHeaderCtrl::GetColStart(unsigned int idx) const
147{
04a33b50 148 int pos = m_scrollOffset;
6327cdd5 149 for ( unsigned n = 0; ; n++ )
b63f9a33 150 {
6327cdd5
VZ
151 const unsigned i = m_colIndices[n];
152 if ( i == idx )
153 break;
154
482d06f8 155 const wxHeaderColumn& col = GetColumn(i);
b63f9a33
VZ
156 if ( col.IsShown() )
157 pos += col.GetWidth();
158 }
159
160 return pos;
161}
162
6327cdd5
VZ
163int wxHeaderCtrl::GetColEnd(unsigned int idx) const
164{
165 int x = GetColStart(idx);
166
482d06f8 167 return x + GetColumn(idx).GetWidth();
6327cdd5
VZ
168}
169
170unsigned int wxHeaderCtrl::FindColumnAtPoint(int x, bool *onSeparator) const
fa3d4aaf 171{
fa3d4aaf
VZ
172 int pos = 0;
173 const unsigned count = GetColumnCount();
174 for ( unsigned n = 0; n < count; n++ )
175 {
6327cdd5 176 const unsigned idx = m_colIndices[n];
482d06f8 177 const wxHeaderColumn& col = GetColumn(idx);
fa3d4aaf
VZ
178 if ( col.IsHidden() )
179 continue;
180
181 pos += col.GetWidth();
182
183 // if the column is resizeable, check if we're approximatively over the
184 // line separating it from the next column
185 //
186 // TODO: don't hardcode sensitivity
187 if ( col.IsResizeable() && abs(x - pos) < 8 )
188 {
6327cdd5
VZ
189 if ( onSeparator )
190 *onSeparator = true;
191 return idx;
fa3d4aaf
VZ
192 }
193
194 // inside this column?
195 if ( x < pos )
196 {
6327cdd5
VZ
197 if ( onSeparator )
198 *onSeparator = false;
199 return idx;
fa3d4aaf
VZ
200 }
201 }
202
22f4180e
VZ
203 if ( onSeparator )
204 *onSeparator = false;
fa3d4aaf
VZ
205 return COL_NONE;
206}
207
b63f9a33
VZ
208// ----------------------------------------------------------------------------
209// wxHeaderCtrl repainting
210// ----------------------------------------------------------------------------
211
212void wxHeaderCtrl::RefreshCol(unsigned int idx)
213{
214 wxRect rect = GetClientRect();
215 rect.x += GetColStart(idx);
40dc2ae6 216 rect.width = GetColumn(idx).GetWidth();
b63f9a33
VZ
217
218 RefreshRect(rect);
219}
220
6090efab
VZ
221void wxHeaderCtrl::RefreshColIfNotNone(unsigned int idx)
222{
223 if ( idx != COL_NONE )
224 RefreshCol(idx);
225}
226
b63f9a33
VZ
227void wxHeaderCtrl::RefreshColsAfter(unsigned int idx)
228{
229 wxRect rect = GetClientRect();
230 const int ofs = GetColStart(idx);
231 rect.x += ofs;
232 rect.width -= ofs;
233
234 RefreshRect(rect);
235}
236
aef252d9 237// ----------------------------------------------------------------------------
6327cdd5 238// wxHeaderCtrl dragging/resizing/reordering
aef252d9
VZ
239// ----------------------------------------------------------------------------
240
e36dcd10
VZ
241bool wxHeaderCtrl::IsResizing() const
242{
243 return m_colBeingResized != COL_NONE;
244}
245
6327cdd5
VZ
246bool wxHeaderCtrl::IsReordering() const
247{
248 return m_colBeingReordered != COL_NONE;
249}
250
251void wxHeaderCtrl::ClearMarkers()
252{
253 wxClientDC dc(this);
254
255 wxDCOverlay dcover(m_overlay, &dc);
256 dcover.Clear();
257}
258
aef252d9
VZ
259void wxHeaderCtrl::EndDragging()
260{
58e914f0
RR
261 // We currently only use markers for reordering, not for resizing
262 if (IsReordering())
263 {
264 ClearMarkers();
265 m_overlay.Reset();
266 }
10118a24
VZ
267
268 // don't use the special dragging cursor any more
269 SetCursor(wxNullCursor);
aef252d9
VZ
270}
271
6327cdd5
VZ
272void wxHeaderCtrl::CancelDragging()
273{
274 wxASSERT_MSG( IsDragging(),
275 "shouldn't be called if we're not dragging anything" );
276
277 EndDragging();
278
279 unsigned int& col = IsResizing() ? m_colBeingResized : m_colBeingReordered;
280
281 wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED, GetId());
282 event.SetEventObject(this);
283 event.SetColumn(col);
284
285 GetEventHandler()->ProcessEvent(event);
286
287 col = COL_NONE;
288}
289
a45caa71
VZ
290int wxHeaderCtrl::ConstrainByMinWidth(unsigned int col, int& xPhysical)
291{
292 const int xStart = GetColStart(col);
293
294 // notice that GetMinWidth() returns 0 if there is no minimal width so it
295 // still makes sense to use it even in this case
296 const int xMinEnd = xStart + GetColumn(col).GetMinWidth();
297
298 if ( xPhysical < xMinEnd )
299 xPhysical = xMinEnd;
300
301 return xPhysical - xStart;
302}
303
304void wxHeaderCtrl::StartOrContinueResizing(unsigned int col, int xPhysical)
305{
306 wxHeaderCtrlEvent event(IsResizing() ? wxEVT_COMMAND_HEADER_RESIZING
307 : wxEVT_COMMAND_HEADER_BEGIN_RESIZE,
308 GetId());
309 event.SetEventObject(this);
310 event.SetColumn(col);
311
312 event.SetWidth(ConstrainByMinWidth(col, xPhysical));
313
314 if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() )
315 {
316 if ( IsResizing() )
317 {
318 ReleaseMouse();
6327cdd5 319 CancelDragging();
a45caa71
VZ
320 }
321 //else: nothing to do -- we just don't start to resize
322 }
323 else // go ahead with resizing
324 {
325 if ( !IsResizing() )
326 {
327 m_colBeingResized = col;
328 SetCursor(wxCursor(wxCURSOR_SIZEWE));
329 CaptureMouse();
330 }
331 //else: we had already done the above when we started
332
a45caa71
VZ
333 }
334}
335
336void wxHeaderCtrl::EndResizing(int xPhysical)
aef252d9 337{
e36dcd10 338 wxASSERT_MSG( IsResizing(), "shouldn't be called if we're not resizing" );
aef252d9
VZ
339
340 EndDragging();
341
6327cdd5 342 ReleaseMouse();
565804f2 343
6327cdd5 344 wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_END_RESIZE, GetId());
aef252d9
VZ
345 event.SetEventObject(this);
346 event.SetColumn(m_colBeingResized);
6327cdd5 347 event.SetWidth(ConstrainByMinWidth(m_colBeingResized, xPhysical));
aef252d9
VZ
348
349 GetEventHandler()->ProcessEvent(event);
350
351 m_colBeingResized = COL_NONE;
352}
353
6327cdd5
VZ
354void wxHeaderCtrl::UpdateReorderingMarker(int xPhysical)
355{
356 wxClientDC dc(this);
357
358 wxDCOverlay dcover(m_overlay, &dc);
359 dcover.Clear();
360
361 dc.SetPen(*wxBLUE);
362 dc.SetBrush(*wxTRANSPARENT_BRUSH);
363
364 // draw the phantom position of the column being dragged
365 int x = xPhysical - m_dragOffset;
366 int y = GetClientSize().y;
367 dc.DrawRectangle(x, 0,
368 GetColumn(m_colBeingReordered).GetWidth(), y);
369
370 // and also a hint indicating where it is going to be inserted if it's
371 // dropped now
372 unsigned int col = FindColumnAtPoint(xPhysical);
373 if ( col != COL_NONE )
374 {
375 static const int DROP_MARKER_WIDTH = 4;
376
377 dc.SetBrush(*wxBLUE);
378 dc.DrawRectangle(GetColEnd(col) - DROP_MARKER_WIDTH/2, 0,
379 DROP_MARKER_WIDTH, y);
380 }
381}
382
383void wxHeaderCtrl::StartReordering(unsigned int col, int xPhysical)
384{
385 wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_BEGIN_REORDER, GetId());
386 event.SetEventObject(this);
387 event.SetColumn(col);
388
389 if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() )
390 {
391 // don't start dragging it, nothing to do otherwise
392 return;
393 }
394
395 m_dragOffset = xPhysical - GetColStart(col);
396
397 m_colBeingReordered = col;
398 SetCursor(wxCursor(wxCURSOR_HAND));
399 CaptureMouse();
400
59704b49
VZ
401 // do not call UpdateReorderingMarker() here: we don't want to give
402 // feedback for reordering until the user starts to really move the mouse
403 // as he might want to just click on the column and not move it at all
6327cdd5
VZ
404}
405
59704b49 406bool wxHeaderCtrl::EndReordering(int xPhysical)
6327cdd5
VZ
407{
408 wxASSERT_MSG( IsReordering(), "shouldn't be called if we're not reordering" );
409
410 EndDragging();
411
412 ReleaseMouse();
413
59704b49
VZ
414 const int colOld = m_colBeingReordered,
415 colNew = FindColumnAtPoint(xPhysical);
6327cdd5 416
59704b49 417 m_colBeingReordered = COL_NONE;
6327cdd5 418
59704b49
VZ
419 if ( xPhysical - GetColStart(colOld) == m_dragOffset )
420 return false;
421
422 if ( colNew != colOld )
6327cdd5 423 {
59704b49
VZ
424 wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_END_REORDER, GetId());
425 event.SetEventObject(this);
426 event.SetColumn(colOld);
427
428 const unsigned pos = GetColumnPos(FindColumnAtPoint(xPhysical));
429 event.SetNewOrder(pos);
430
431 if ( !GetEventHandler()->ProcessEvent(event) || event.IsAllowed() )
432 {
433 // do reorder the columns
434 DoMoveCol(colOld, pos);
435 }
6327cdd5
VZ
436 }
437
59704b49
VZ
438 // whether we moved the column or not, the user did move the mouse and so
439 // did try to do it so return true
440 return true;
6327cdd5
VZ
441}
442
20db5469
VZ
443// ----------------------------------------------------------------------------
444// wxHeaderCtrl column reordering
445// ----------------------------------------------------------------------------
446
447void wxHeaderCtrl::DoSetColumnsOrder(const wxArrayInt& order)
448{
449 m_colIndices = order;
450 Refresh();
451}
452
453wxArrayInt wxHeaderCtrl::DoGetColumnsOrder() const
454{
455 return m_colIndices;
456}
457
6327cdd5
VZ
458void wxHeaderCtrl::DoMoveCol(unsigned int idx, unsigned int pos)
459{
1bb74626 460 MoveColumnInOrderArray(m_colIndices, idx, pos);
6327cdd5
VZ
461
462 Refresh();
463}
464
b63f9a33
VZ
465// ----------------------------------------------------------------------------
466// wxHeaderCtrl event handlers
467// ----------------------------------------------------------------------------
468
3bfaa5a7 469BEGIN_EVENT_TABLE(wxHeaderCtrl, wxHeaderCtrlBase)
b63f9a33
VZ
470 EVT_PAINT(wxHeaderCtrl::OnPaint)
471
472 EVT_MOUSE_EVENTS(wxHeaderCtrl::OnMouse)
aef252d9
VZ
473
474 EVT_MOUSE_CAPTURE_LOST(wxHeaderCtrl::OnCaptureLost)
e36dcd10
VZ
475
476 EVT_KEY_DOWN(wxHeaderCtrl::OnKeyDown)
b63f9a33
VZ
477END_EVENT_TABLE()
478
479void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
480{
481 int w, h;
482 GetClientSize(&w, &h);
03647350 483
b047e876 484#ifdef __WXGTK__
6a2a30a8
RR
485// int vw;
486// GetVirtualSize(&vw, NULL);
b047e876 487#endif
b63f9a33
VZ
488
489 wxAutoBufferedPaintDC dc(this);
490
491 dc.SetBackground(GetBackgroundColour());
492 dc.Clear();
493
494 // account for the horizontal scrollbar offset in the parent window
495 dc.SetDeviceOrigin(m_scrollOffset, 0);
496
40dc2ae6 497 const unsigned int count = m_numColumns;
b63f9a33
VZ
498 int xpos = 0;
499 for ( unsigned int i = 0; i < count; i++ )
500 {
6327cdd5 501 const unsigned idx = m_colIndices[i];
dcb6cbec 502 const wxHeaderColumn& col = GetColumn(idx);
b63f9a33
VZ
503 if ( col.IsHidden() )
504 continue;
505
b047e876 506 int colWidth = col.GetWidth();
b63f9a33
VZ
507
508 wxHeaderSortIconType sortArrow;
40dc2ae6 509 if ( col.IsSortKey() )
b63f9a33 510 {
40dc2ae6
VZ
511 sortArrow = col.IsSortOrderAscending() ? wxHDR_SORT_ICON_UP
512 : wxHDR_SORT_ICON_DOWN;
513 }
514 else // not sorting by this column
515 {
516 sortArrow = wxHDR_SORT_ICON_NONE;
b63f9a33
VZ
517 }
518
519 int state = 0;
520 if ( IsEnabled() )
521 {
6327cdd5 522 if ( idx == m_hover )
b63f9a33
VZ
523 state = wxCONTROL_CURRENT;
524 }
525 else // disabled
526 {
527 state = wxCONTROL_DISABLED;
528 }
03647350 529
b047e876
RR
530 if (i == 0)
531 state |= wxCONTROL_SPECIAL;
b63f9a33
VZ
532
533 wxHeaderButtonParams params;
534 params.m_labelText = col.GetTitle();
535 params.m_labelBitmap = col.GetBitmap();
536 params.m_labelAlignment = col.GetAlignment();
03647350 537
b047e876
RR
538#ifdef __WXGTK__
539 if (i == count-1)
540 {
6a2a30a8 541// colWidth = wxMax( colWidth, vw - xpos );
6f91f3a3 542 state |= wxCONTROL_DIRTY;
b047e876
RR
543 }
544#endif
b63f9a33
VZ
545
546 wxRendererNative::Get().DrawHeaderButton
547 (
548 this,
549 dc,
550 wxRect(xpos, 0, colWidth, h),
551 state,
552 sortArrow,
553 &params
554 );
555
556 xpos += colWidth;
557 }
558}
559
aef252d9
VZ
560void wxHeaderCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event))
561{
6327cdd5
VZ
562 if ( IsDragging() )
563 CancelDragging();
e36dcd10
VZ
564}
565
566void wxHeaderCtrl::OnKeyDown(wxKeyEvent& event)
567{
6327cdd5 568 if ( event.GetKeyCode() == WXK_ESCAPE )
e36dcd10 569 {
6327cdd5
VZ
570 if ( IsDragging() )
571 {
572 ReleaseMouse();
573 CancelDragging();
574
575 return;
576 }
e36dcd10 577 }
6327cdd5
VZ
578
579 event.Skip();
aef252d9
VZ
580}
581
fa3d4aaf 582void wxHeaderCtrl::OnMouse(wxMouseEvent& mevent)
b63f9a33 583{
aef252d9
VZ
584 // do this in advance to allow simply returning if we're not interested,
585 // we'll undo it if we do handle the event below
fa3d4aaf
VZ
586 mevent.Skip();
587
aef252d9 588
04a33b50 589 // account for the control displacement
aef252d9
VZ
590 const int xPhysical = mevent.GetX();
591 const int xLogical = xPhysical - m_scrollOffset;
592
593 // first deal with the [continuation of any] dragging operations in
594 // progress
e36dcd10 595 if ( IsResizing() )
aef252d9
VZ
596 {
597 if ( mevent.LeftUp() )
a45caa71 598 EndResizing(xPhysical);
aef252d9 599 else // update the live separator position
a45caa71 600 StartOrContinueResizing(m_colBeingResized, xPhysical);
aef252d9
VZ
601
602 return;
603 }
604
6327cdd5
VZ
605 if ( IsReordering() )
606 {
59704b49
VZ
607 if ( !mevent.LeftUp() )
608 {
609 // update the column position
6327cdd5
VZ
610 UpdateReorderingMarker(xPhysical);
611
59704b49
VZ
612 return;
613 }
614
615 // finish reordering and continue to generate a click event below if we
616 // didn't really reorder anything
617 if ( EndReordering(xPhysical) )
618 return;
6327cdd5
VZ
619 }
620
04a33b50 621
fa3d4aaf
VZ
622 // find if the event is over a column at all
623 bool onSeparator;
6090efab
VZ
624 const unsigned col = mevent.Leaving()
625 ? (onSeparator = false, COL_NONE)
6327cdd5 626 : FindColumnAtPoint(xLogical, &onSeparator);
aef252d9 627
6090efab
VZ
628
629 // update the highlighted column if it changed
630 if ( col != m_hover )
631 {
632 const unsigned hoverOld = m_hover;
633 m_hover = col;
634
635 RefreshColIfNotNone(hoverOld);
636 RefreshColIfNotNone(m_hover);
637 }
638
fa3d4aaf
VZ
639 // update mouse cursor as it moves around
640 if ( mevent.Moving() )
641 {
642 SetCursor(onSeparator ? wxCursor(wxCURSOR_SIZEWE) : wxNullCursor);
643 return;
644 }
645
aef252d9
VZ
646 // all the other events only make sense when they happen over a column
647 if ( col == COL_NONE )
648 return;
649
650
651 // enter various dragging modes on left mouse press
fa3d4aaf
VZ
652 if ( mevent.LeftDown() )
653 {
fa3d4aaf 654 if ( onSeparator )
aef252d9
VZ
655 {
656 // start resizing the column
6327cdd5 657 wxASSERT_MSG( !IsResizing(), "reentering column resize mode?" );
a45caa71 658 StartOrContinueResizing(col, xPhysical);
aef252d9
VZ
659 }
660 else // on column itself
661 {
6327cdd5
VZ
662 // start dragging the column
663 wxASSERT_MSG( !IsReordering(), "reentering column move mode?" );
664
665 StartReordering(col, xPhysical);
aef252d9 666 }
fa3d4aaf
VZ
667
668 return;
669 }
670
aef252d9 671 // determine the type of header event corresponding to click events
3bfaa5a7
VZ
672 wxEventType evtType = wxEVT_NULL;
673 const bool click = mevent.ButtonUp(),
674 dblclk = mevent.ButtonDClick();
675 if ( click || dblclk )
fa3d4aaf
VZ
676 {
677 switch ( mevent.GetButton() )
678 {
679 case wxMOUSE_BTN_LEFT:
3bfaa5a7
VZ
680 // treat left double clicks on separator specially
681 if ( onSeparator && dblclk )
682 {
683 evtType = wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK;
684 }
685 else // not double click on separator
686 {
687 evtType = click ? wxEVT_COMMAND_HEADER_CLICK
688 : wxEVT_COMMAND_HEADER_DCLICK;
689 }
fa3d4aaf
VZ
690 break;
691
692 case wxMOUSE_BTN_RIGHT:
693 evtType = click ? wxEVT_COMMAND_HEADER_RIGHT_CLICK
694 : wxEVT_COMMAND_HEADER_RIGHT_DCLICK;
695 break;
696
697 case wxMOUSE_BTN_MIDDLE:
698 evtType = click ? wxEVT_COMMAND_HEADER_MIDDLE_CLICK
699 : wxEVT_COMMAND_HEADER_MIDDLE_DCLICK;
700 break;
701
702 default:
703 // ignore clicks from other mouse buttons
3bfaa5a7 704 ;
fa3d4aaf 705 }
3bfaa5a7
VZ
706 }
707
708 if ( evtType == wxEVT_NULL )
709 return;
fa3d4aaf 710
3bfaa5a7
VZ
711 wxHeaderCtrlEvent event(evtType, GetId());
712 event.SetEventObject(this);
713 event.SetColumn(col);
fa3d4aaf 714
3bfaa5a7
VZ
715 if ( GetEventHandler()->ProcessEvent(event) )
716 mevent.Skip(false);
b63f9a33
VZ
717}
718
56873923 719#endif // wxHAS_GENERIC_HEADERCTRL
e721a2a2
VZ
720
721#endif // wxUSE_HEADERCTRL