listview has LVS_EX_FULLROWSELECT style when supported

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 1999-02-22 23:15:21 +00:00
parent 3e4efd7cb9
commit 0b5efdc724

View File

@ -10,18 +10,18 @@
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "listctrl.h"
#pragma implementation "listctrl.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/wx.h"
#endif
#if defined(__WIN95__)
@ -32,25 +32,24 @@
#include "wx/msw/private.h"
#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__)
#include <commctrl.h>
#include <commctrl.h>
#endif
#ifndef __TWIN32__
#ifdef __GNUWIN32__
#include "wx/msw/gnuwin32/extra.h"
#endif
#ifdef __GNUWIN32__
#include "wx/msw/gnuwin32/extra.h"
#endif
#endif
static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& tvItem);
static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& tvItem, HWND getFullInfo = 0);
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
#endif // USE_SHARED_LIBRARY
#endif
wxListCtrl::wxListCtrl(void)
wxListCtrl::wxListCtrl()
{
m_imageListNormal = NULL;
m_imageListSmall = NULL;
@ -60,8 +59,13 @@ wxListCtrl::wxListCtrl(void)
m_textCtrl = NULL;
}
bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxValidator& validator, const wxString& name)
bool wxListCtrl::Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name)
{
m_imageListNormal = NULL;
m_imageListSmall = NULL;
@ -125,6 +129,16 @@ bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
return FALSE;
}
// for comctl32.dll v 4.70+ we want to have this attribute because it's
// prettier (and also because wxGTK does it like this)
#ifdef ListView_SetExtendedListViewStyle
if ( wstyle & LVS_REPORT )
{
ListView_SetExtendedListViewStyle((HWND)GetHWND(),
LVS_EX_FULLROWSELECT);
}
#endif // ListView_SetExtendedListViewStyle
wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(parent->GetForegroundColour());
@ -136,7 +150,7 @@ bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
return TRUE;
}
wxListCtrl::~wxListCtrl(void)
wxListCtrl::~wxListCtrl()
{
if (m_textCtrl)
{
@ -189,14 +203,14 @@ void wxListCtrl::SetWindowStyleFlag(long flag)
RecreateWindow();
}
void wxListCtrl::RecreateWindow(void)
void wxListCtrl::RecreateWindow()
{
if ( GetHWND() )
{
long oldStyle = 0;
long style = ConvertToMSWStyle(oldStyle, m_windowStyle);
style |= m_baseStyle;
// ::SetWindowLong((HWND) GetHWND(), GWL_STYLE, style);
// ::SetWindowLong((HWND) GetHWND(), GWL_STYLE, style);
// The following recreation of the window appears to be necessary
// because SetWindowLong doesn't seem to do it.
@ -226,6 +240,14 @@ void wxListCtrl::RecreateWindow(void)
m_hWnd = (WXHWND) hWndListControl;
SubclassWin((WXHWND) m_hWnd);
#ifdef ListView_SetExtendedListViewStyle
if ( style & LVS_REPORT )
{
ListView_SetExtendedListViewStyle((HWND)GetHWND(),
LVS_EX_FULLROWSELECT);
}
#endif // ListView_SetExtendedListViewStyle
if ( m_imageListNormal )
SetImageList(m_imageListNormal, wxIMAGE_LIST_NORMAL);
if ( m_imageListSmall )
@ -280,6 +302,7 @@ long wxListCtrl::ConvertToMSWStyle(long& oldStyle, long style) const
oldStyle -= LVS_LIST;
if ( (oldStyle & LVS_TYPEMASK) == LVS_SMALLICON )
oldStyle -= LVS_SMALLICON;
wstyle |= LVS_REPORT;
}
@ -301,10 +324,10 @@ long wxListCtrl::ConvertToMSWStyle(long& oldStyle, long style) const
wstyle |= LVS_AUTOARRANGE;
// Apparently, no such style (documentation wrong?)
/*
/*
if ( style & wxLC_BUTTON )
wstyle |= LVS_BUTTON;
*/
*/
if ( style & wxLC_NO_SORT_HEADER )
wstyle |= LVS_NOSORTHEADER;
@ -361,7 +384,7 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const
bool success = (ListView_GetColumn((HWND) GetHWND(), col, & lvCol) != 0);
// item.m_subItem = lvCol.iSubItem;
// item.m_subItem = lvCol.iSubItem;
item.m_width = lvCol.cx;
if ( (item.m_mask & wxLIST_MASK_TEXT) && lvCol.pszText )
@ -806,13 +829,13 @@ bool wxListCtrl::DeleteItem(long item)
}
// Deletes all items
bool wxListCtrl::DeleteAllItems(void)
bool wxListCtrl::DeleteAllItems()
{
return (ListView_DeleteAllItems((HWND) GetHWND()) != 0);
}
// Deletes all items
bool wxListCtrl::DeleteAllColumns(void)
bool wxListCtrl::DeleteAllColumns()
{
int i;
for ( i = 0; i < m_colCount; i++)
@ -834,7 +857,7 @@ bool wxListCtrl::DeleteColumn(int col)
}
// Clears items, and columns if there are any.
void wxListCtrl::ClearAll(void)
void wxListCtrl::ClearAll()
{
DeleteAllItems();
if ( m_colCount > 0 )
@ -867,7 +890,7 @@ bool wxListCtrl::EndEditLabel(bool cancel)
{
wxFAIL;
/* I don't know how to implement this: there's no such macro as ListView_EndEditLabelNow.
/* I don't know how to implement this: there's no such macro as ListView_EndEditLabelNow.
* ???
bool success = (ListView_EndEditLabelNow((HWND) GetHWND(), cancel) != 0);
@ -879,7 +902,7 @@ bool wxListCtrl::EndEditLabel(bool cancel)
m_textCtrl = NULL;
}
return success;
*/
*/
return FALSE;
}
@ -1160,7 +1183,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
case LVN_DELETEALLITEMS:
{
eventType = wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS;
// NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
// NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
event.m_itemIndex = -1;
break;
}
@ -1182,7 +1205,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
}
case LVN_GETDISPINFO:
{
// return FALSE;
// return FALSE;
// TODO: some text buffering here, I think
// TODO: API for getting Windows to retrieve values
// on demand.
@ -1254,7 +1277,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
info->item.cchTextMax = strlen(info->item.pszText) + 1;
}
}
// wxConvertToMSWListItem(this, event.m_item, info->item);
// wxConvertToMSWListItem(this, event.m_item, info->item);
}
*result = !event.IsAllowed();
@ -1276,7 +1299,7 @@ char *wxListCtrl::AddPool(const wxString& str)
}
// List item structure
wxListItem::wxListItem(void)
wxListItem::wxListItem()
{
m_mask = 0;
m_itemId = 0;
@ -1313,7 +1336,7 @@ static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, L
lvItem.pszText = new char[513];
lvItem.cchTextMax = 512;
}
// lvItem.mask |= TVIF_HANDLE | TVIF_STATE | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM ;
// lvItem.mask |= TVIF_HANDLE | TVIF_STATE | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM ;
lvItem.mask |= LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM ;
::SendMessage(getFullInfo, LVM_GETITEM, 0, (LPARAM)& lvItem) ;
}
@ -1438,7 +1461,7 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_
IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent)
wxListEvent::wxListEvent(wxEventType commandType, int id)
: wxNotifyEvent(commandType, id)
: wxNotifyEvent(commandType, id)
{
m_code = 0;
m_itemIndex = 0;