X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4bae66a8deb5432ff0426f2b0de60f13e3bdb0bf..e41a1b1cbb37808d2bbd532b0d2a4bd49924c81a:/src/generic/datavgen.cpp diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index c12b0bb688..a6c94b1e5d 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -154,6 +154,7 @@ protected: { return GetColumn(GetColumnIdxFromHeader(nmHDR)); } int m_scrollOffsetX; + int m_buttonHeight; private: DECLARE_DYNAMIC_CLASS(wxDataViewHeaderWindowMSW) @@ -404,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 { @@ -1192,6 +1193,13 @@ void wxDataViewHeaderWindowBase::SendEvent(wxEventType type, unsigned int n) #if defined(__WXMSW__) && USE_NATIVE_HEADER_WINDOW +#ifndef HDS_DRAGDROP + #define HDS_DRAGDROP 0x0040 +#endif +#ifndef HDS_FULLDRAG + #define HDS_FULLDRAG 0x0080 +#endif + // implemented in msw/listctrl.cpp: int WXDLLIMPEXP_CORE wxMSWGetColumnClicked(NMHDR *nmhdr, POINT *ptClick); @@ -1203,19 +1211,20 @@ bool wxDataViewHeaderWindowMSW::Create( wxDataViewCtrl *parent, wxWindowID id, { 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; @@ -1253,16 +1262,9 @@ wxDataViewHeaderWindowMSW::~wxDataViewHeaderWindow() wxSize wxDataViewHeaderWindowMSW::DoGetBestSize() const { - return wxSize(80, 22); + return wxSize(80, m_buttonHeight ); } -#ifndef HDF_SORTUP -#define HDF_SORTUP 0x0400 -#endif -#ifndef HDF_SORTDOWN -#define HDF_SORTDOWN 0x0200 -#endif - void wxDataViewHeaderWindowMSW::UpdateDisplay() { // remove old columns @@ -1321,7 +1323,7 @@ void wxDataViewHeaderWindowMSW::UpdateDisplay() default: // such alignment is not allowed for the column header! - wxFAIL; + break; // wxFAIL; } SendMessage((HWND)m_hWnd, HDM_INSERTITEM, @@ -1496,7 +1498,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; @@ -1507,7 +1510,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__) @@ -1838,7 +1842,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 ) { @@ -3620,7 +3624,7 @@ wxDataViewItem wxDataViewMainWindow::GetSelection() const //----------------------------------------------------------------------------- // wxDataViewCtrl //----------------------------------------------------------------------------- -WX_DEFINE_LIST(wxDataViewColumnList); +WX_DEFINE_LIST(wxDataViewColumnList) IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase) @@ -3644,7 +3648,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);