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