From 9b00bb1626a28272e58728633f431c0c2996cd2d Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 7 Dec 1999 10:47:21 +0000 Subject: [PATCH] Various things related to wxFileDialog and attributes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4852 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/listctrl.h | 4 ++++ src/generic/filedlgg.cpp | 3 ++- src/generic/listctrl.cpp | 23 +++++++++++++++++++++++ src/generic/treectrl.cpp | 2 +- src/msw/listctrl.cpp | 23 +++++++++++++++++++++++ 5 files changed, 53 insertions(+), 2 deletions(-) diff --git a/include/wx/listctrl.h b/include/wx/listctrl.h index 667d975b4d..8807a74488 100644 --- a/include/wx/listctrl.h +++ b/include/wx/listctrl.h @@ -148,6 +148,10 @@ public: wxListItem(); ~wxListItem() { delete m_attr; } + // resetting + void Clear(); + void ClearAttributes(); + // setters void SetMask(long mask) { m_mask = mask; } void SetId(long id) { m_itemId = id; } diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index c76bb9c2c6..78ceba169a 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -244,6 +244,7 @@ void wxFileData::SetNewName( const wxString &name, const wxString &fname ) void wxFileData::MakeItem( wxListItem &item ) { item.m_text = m_name; + item.ClearAttributes(); if (IsExe()) item.SetTextColour(*wxRED); if (IsDir()) item.SetTextColour(*wxBLUE); item.m_image = IsDir() ? 0 : -1; @@ -575,7 +576,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, m_dialogStyle = style; if ((m_dialogStyle & wxMULTIPLE ) && !(m_dialogStyle & wxOPEN)) - m_dialogStyle &= ~wxMULTIPLE; + m_dialogStyle |= wxOPEN; m_dir = defaultDir; if (m_dir.IsEmpty()) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 8194d96925..816c94f3da 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2575,6 +2575,29 @@ wxListItem::wxListItem() m_attr = NULL; } +void wxListItem::Clear() +{ + m_mask = 0; + m_itemId = 0; + m_col = 0; + m_state = 0; + m_stateMask = 0; + m_image = 0; + m_data = 0; + m_format = wxLIST_FORMAT_CENTRE; + m_width = 0; + m_text = wxEmptyString; + + if (m_attr) delete m_attr; + m_attr = NULL; +} + +void wxListItem::ClearAttributes() +{ + if (m_attr) delete m_attr; + m_attr = NULL; +} + // ------------------------------------------------------------------------------------- // wxListEvent // ------------------------------------------------------------------------------------- diff --git a/src/generic/treectrl.cpp b/src/generic/treectrl.cpp index b9fcda1414..36f8be5bfa 100644 --- a/src/generic/treectrl.cpp +++ b/src/generic/treectrl.cpp @@ -436,7 +436,7 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest( const wxPoint& point, } if (point.x < m_x) - flags |= wxTREE_HITTEST_ONITEMIDENT; + flags |= wxTREE_HITTEST_ONITEMINDENT; if (point.x > m_x+m_width) flags |= wxTREE_HITTEST_ONITEMRIGHT; diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 3c11d4448f..756a9bea2c 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1601,6 +1601,29 @@ wxListItem::wxListItem() m_attr = NULL; } +void wxListItem::Clear() +{ + m_mask = 0; + m_itemId = 0; + m_col = 0; + m_state = 0; + m_stateMask = 0; + m_image = 0; + m_data = 0; + m_format = wxLIST_FORMAT_CENTRE; + m_width = 0; + m_text = wxEmptyString; + + if (m_attr) delete m_attr; + m_attr = NULL; +} + +void wxListItem::ClearAttributes() +{ + if (m_attr) delete m_attr; + m_attr = NULL; +} + static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& lvItem, HWND getFullInfo) { info.m_data = lvItem.lParam; -- 2.45.2