#pragma hdrstop
#endif
-#ifndef WX_PRECOMP
-#endif // WX_PRECOMP
+#if wxUSE_HEADERCTRL
#include "wx/headerctrl.h"
namespace
{
-const unsigned NO_SORT = (unsigned)-1;
-
const unsigned COL_NONE = (unsigned)-1;
} // anonymous namespace
wxSize wxHeaderCtrl::DoGetBestSize() const
{
+ wxWindow *win = GetParent();
+ int height = wxRendererNative::Get().GetHeaderButtonHeight( win );
+
// the vertical size is rather arbitrary but it looks better if we leave
// some space around the text
const wxSize size(IsEmpty() ? wxHeaderCtrlBase::DoGetBestSize().x
: GetColEnd(GetColumnCount() - 1),
- (7*GetCharHeight())/4);
+ height ); // (7*GetCharHeight())/4);
CacheBestSize(size);
return size;
}
int wxHeaderCtrl::GetColStart(unsigned int idx) const
{
- wxHeaderCtrl * const self = const_cast<wxHeaderCtrl *>(this);
-
int pos = m_scrollOffset;
for ( unsigned n = 0; ; n++ )
{
if ( i == idx )
break;
- const wxHeaderColumn& col = self->GetColumn(i);
+ const wxHeaderColumn& col = GetColumn(i);
if ( col.IsShown() )
pos += col.GetWidth();
}
{
int x = GetColStart(idx);
- return x + const_cast<wxHeaderCtrl *>(this)->GetColumn(idx).GetWidth();
+ return x + GetColumn(idx).GetWidth();
}
unsigned int wxHeaderCtrl::FindColumnAtPoint(int x, bool *onSeparator) const
{
- wxHeaderCtrl * const self = const_cast<wxHeaderCtrl *>(this);
-
int pos = 0;
const unsigned count = GetColumnCount();
for ( unsigned n = 0; n < count; n++ )
{
const unsigned idx = m_colIndices[n];
- const wxHeaderColumn& col = self->GetColumn(idx);
+ const wxHeaderColumn& col = GetColumn(idx);
if ( col.IsHidden() )
continue;
pos += col.GetWidth();
- // if the column is resizeable, check if we're approximatively over the
+ // if the column is resizable, check if we're approximatively over the
// line separating it from the next column
//
// TODO: don't hardcode sensitivity
dcover.Clear();
}
-void wxHeaderCtrl::UpdateResizingMarker(int xPhysical)
-{
- wxClientDC dc(this);
-
- wxDCOverlay dcover(m_overlay, &dc);
- dcover.Clear();
-
- // unfortunately drawing the marker over the parent window doesn't work as
- // it's usually covered by another window (the main control view) so just
- // draw the marker over the header itself, even if it makes it not very
- // useful
- dc.SetPen(*wxLIGHT_GREY_PEN);
- dc.DrawLine(xPhysical, 0, xPhysical, GetClientSize().y);
-}
-
void wxHeaderCtrl::EndDragging()
{
- ClearMarkers();
-
- m_overlay.Reset();
+ // We currently only use markers for reordering, not for resizing
+ if (IsReordering())
+ {
+ ClearMarkers();
+ m_overlay.Reset();
+ }
// don't use the special dragging cursor any more
SetCursor(wxNullCursor);
}
//else: we had already done the above when we started
- UpdateResizingMarker(xPhysical);
}
}
int w, h;
GetClientSize(&w, &h);
+#ifdef __WXGTK__
+// int vw;
+// GetVirtualSize(&vw, NULL);
+#endif
+
wxAutoBufferedPaintDC dc(this);
dc.SetBackground(GetBackgroundColour());
if ( col.IsHidden() )
continue;
- const int colWidth = col.GetWidth();
+ int colWidth = col.GetWidth();
wxHeaderSortIconType sortArrow;
if ( col.IsSortKey() )
state = wxCONTROL_DISABLED;
}
+ if (i == 0)
+ state |= wxCONTROL_SPECIAL;
+
wxHeaderButtonParams params;
params.m_labelText = col.GetTitle();
params.m_labelBitmap = col.GetBitmap();
params.m_labelAlignment = col.GetAlignment();
+#ifdef __WXGTK__
+ if (i == count-1)
+ {
+// colWidth = wxMax( colWidth, vw - xpos );
+ state |= wxCONTROL_DIRTY;
+ }
+#endif
+
wxRendererNative::Get().DrawHeaderButton
(
this,
}
#endif // wxHAS_GENERIC_HEADERCTRL
+
+#endif // wxUSE_HEADERCTRL