X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/70a9e561dfbcfc43f7f0f8efe0acd56024d4cb06..9a7b7798282622e445efc3318b6c85ff0bed9af8:/src/generic/datavgen.cpp diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index fa031653a4..1b6a371e82 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -134,8 +134,6 @@ public: ~wxDataViewHeaderWindowMSW(); - void OnPaint(wxPaintEvent &event); - // called when any column setting is changed and/or changed // the column count virtual void UpdateDisplay(); @@ -156,9 +154,9 @@ protected: { return GetColumn(GetColumnIdxFromHeader(nmHDR)); } int m_scrollOffsetX; + int m_buttonHeight; private: - DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxDataViewHeaderWindowMSW) }; @@ -407,7 +405,7 @@ int LINKAGEMODE wxGenericTreeModelItemCmp( void ** id1, void ** id2) WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(unsigned int, wxDataViewSelection, WXDLLIMPEXP_ADV); WX_DECLARE_LIST(wxDataViewItem, ItemList); -WX_DEFINE_LIST(ItemList); +WX_DEFINE_LIST(ItemList) class wxDataViewMainWindow: public wxWindow { @@ -1200,29 +1198,26 @@ int WXDLLIMPEXP_CORE wxMSWGetColumnClicked(NMHDR *nmhdr, POINT *ptClick); IMPLEMENT_ABSTRACT_CLASS(wxDataViewHeaderWindowMSW, wxWindow) -BEGIN_EVENT_TABLE(wxDataViewHeaderWindowMSW, wxDataViewHeaderWindowBase) - // EVT_PAINT (wxDataViewHeaderWindowMSW::OnPaint) -END_EVENT_TABLE() - bool wxDataViewHeaderWindowMSW::Create( wxDataViewCtrl *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, const wxString &name ) { m_owner = parent; - m_scrollOffsetX = 0;; + m_scrollOffsetX = 0; + m_buttonHeight = wxRendererNative::Get().GetHeaderButtonHeight( this ) + 10; int x = pos.x == wxDefaultCoord ? 0 : pos.x, y = pos.y == wxDefaultCoord ? 0 : pos.y, w = size.x == wxDefaultCoord ? 1 : size.x, - h = size.y == wxDefaultCoord ? 22 : size.y; + h = size.y == wxDefaultCoord ? m_buttonHeight : size.y; if ( !CreateControl(parent, id, pos, size, 0, wxDefaultValidator, name) ) return false; // create the native WC_HEADER window: WXHWND hwndParent = (HWND)parent->GetHandle(); - WXDWORD msStyle = WS_CHILD | HDS_BUTTONS | HDS_HORZ | HDS_HOTTRACK | HDS_FULLDRAG; + WXDWORD msStyle = WS_CHILD | HDS_DRAGDROP | HDS_BUTTONS | HDS_HORZ | HDS_HOTTRACK | HDS_FULLDRAG; if ( m_isShown ) msStyle |= WS_VISIBLE; @@ -1260,57 +1255,7 @@ wxDataViewHeaderWindowMSW::~wxDataViewHeaderWindow() wxSize wxDataViewHeaderWindowMSW::DoGetBestSize() const { - return wxSize(80, 22); -} - -void wxDataViewHeaderWindowMSW::OnPaint(wxPaintEvent &event) -{ - wxClientDC dc(this); - - int sortArrow = wxHDR_SORT_ICON_UP; - - wxRect rect(0,0,80,22); - - // Draw an up or down arrow - int arrowSpace = 0; - if (sortArrow != wxHDR_SORT_ICON_NONE ) - { - wxRect ar = rect; - - // make a rect for the arrow - ar.height = 4; - ar.width = 8; - ar.y += (rect.height - ar.height)/2; - ar.x = ar.x + rect.width - 3*ar.width/2; - arrowSpace = 3*ar.width/2; // space to preserve when drawing the label - - wxPoint triPt[3]; - if ( sortArrow & wxHDR_SORT_ICON_UP ) - { - triPt[0].x = ar.width / 2; - triPt[0].y = 0; - triPt[1].x = ar.width; - triPt[1].y = ar.height; - triPt[2].x = 0; - triPt[2].y = ar.height; - } - else - { - triPt[0].x = 0; - triPt[0].y = 0; - triPt[1].x = ar.width; - triPt[1].y = 0; - triPt[2].x = ar.width / 2; - triPt[2].y = ar.height; - } - - wxColour c = wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW); - dc.SetPen(wxPen(c)); - dc.SetBrush(wxBrush(c)); - dc.DrawPolygon( 3, triPt, ar.x, ar.y); - } - - event.Skip(); + return wxSize(80, m_buttonHeight ); } void wxDataViewHeaderWindowMSW::UpdateDisplay() @@ -1340,10 +1285,8 @@ void wxDataViewHeaderWindowMSW::UpdateDisplay() { //The Microsoft Comctrl32.dll 6.0 support SORTUP/SORTDOWN, but they are not default //see http://msdn2.microsoft.com/en-us/library/ms649534.aspx for more detail - - // if (col->IsSortOrderAscending()) - // hdi.fmt |= col->IsSortOrderAscending() ? HDF_SORTUP : HDF_SORTDOWN; - // ; + // VZ: works with 5.81 + hdi.fmt |= col->IsSortOrderAscending() ? HDF_SORTUP : HDF_SORTDOWN; } // lParam is reserved for application's use: @@ -1373,7 +1316,7 @@ void wxDataViewHeaderWindowMSW::UpdateDisplay() default: // such alignment is not allowed for the column header! - wxFAIL; + break; // wxFAIL; } SendMessage((HWND)m_hWnd, HDM_INSERTITEM, @@ -1548,7 +1491,8 @@ bool wxDataViewHeaderWindowMSW::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARA return true; } -void wxDataViewHeaderWindowMSW::ScrollWindow(int dx, int dy, const wxRect *rect ) +void wxDataViewHeaderWindowMSW::ScrollWindow(int dx, int WXUNUSED(dy), + const wxRect * WXUNUSED(rect)) { m_scrollOffsetX += dx; @@ -1559,7 +1503,8 @@ void wxDataViewHeaderWindowMSW::DoSetSize(int x, int y, int w, int h, int f) { - wxControl::DoSetSize( x+m_scrollOffsetX, y, w-m_scrollOffsetX, h, f ); + // TODO: why is there a border + 2px around it? + wxControl::DoSetSize( x+m_scrollOffsetX+1, y+1, w-m_scrollOffsetX-2, h-2, f ); } #else // !defined(__WXMSW__) @@ -1890,7 +1835,7 @@ END_EVENT_TABLE() wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, const wxString &name ) : - wxWindow( parent, id, pos, size, wxWANTS_CHARS, name ), + wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE, name ), m_selection( wxDataViewSelectionCmp ) { @@ -3672,7 +3617,7 @@ wxDataViewItem wxDataViewMainWindow::GetSelection() const //----------------------------------------------------------------------------- // wxDataViewCtrl //----------------------------------------------------------------------------- -WX_DEFINE_LIST(wxDataViewColumnList); +WX_DEFINE_LIST(wxDataViewColumnList) IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase) @@ -3696,7 +3641,7 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, long style, const wxValidator& validator ) { if (!wxControl::Create( parent, id, pos, size, - style | wxScrolledWindowStyle|wxSUNKEN_BORDER, validator)) + style | wxScrolledWindowStyle|wxBORDER_SUNKEN, validator)) return false; SetInitialSize(size);