4.44 beta

This commit is contained in:
Igor Pavlov
2007-01-20 00:00:00 +00:00
committed by Kornel Lesiński
parent 804edc5756
commit d9666cf046
1331 changed files with 10535 additions and 13791 deletions

View File

@@ -0,0 +1,102 @@
// ListViewDialog.cpp
#include "StdAfx.h"
#include "ListViewDialog.h"
#include "Common/Vector.h"
#ifdef LANG
#include "../../LangUtils.h"
static CIDLangPair kIDLangPairs[] =
{
{ IDOK, 0x02000702 },
{ IDCANCEL, 0x02000710 }
};
#endif
bool CListViewDialog::OnInit()
{
#ifdef LANG
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
_listView.Attach(GetItem(IDC_LISTVIEW_LIST));
SetText(Title);
LVCOLUMN columnInfo;
columnInfo.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
columnInfo.fmt = LVCFMT_LEFT;
columnInfo.iSubItem = 0;
columnInfo.cx = 1000;
_listView.InsertColumn(0, &columnInfo);
for(int i = 0; i < Strings.Size(); i++)
{
LVITEMW item;
item.mask = LVIF_TEXT;
item.iItem = i;
item.pszText = (LPWSTR)(LPCWSTR)Strings[i];
item.iSubItem = 0;
_listView.InsertItem(&item);
}
if (Strings.Size() > 0)
_listView.SetItemState(0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
StringsWereChanged = false;
return CModalDialog::OnInit();
}
bool CListViewDialog::OnNotify(UINT /* controlID */, LPNMHDR header)
{
if (header->hwndFrom != _listView)
return false;
switch(header->code)
{
case LVN_KEYDOWN:
{
LPNMLVKEYDOWN keyDownInfo = LPNMLVKEYDOWN(header);
switch(keyDownInfo->wVKey)
{
case VK_DELETE:
{
if (!DeleteIsAllowed)
return false;
int focusedIndex = _listView.GetFocusedItem();
if (focusedIndex < 0)
focusedIndex = 0;
for (;;)
{
int index = _listView.GetNextSelectedItem(-1);
if (index < 0)
break;
StringsWereChanged = true;
_listView.DeleteItem(index);
Strings.Delete(index);
}
if (focusedIndex >= _listView.GetItemCount())
focusedIndex = _listView.GetItemCount() - 1;
if (focusedIndex >= 0)
_listView.SetItemState(focusedIndex, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
return true;
}
case 'A':
{
bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
if (ctrl)
{
int numItems = _listView.GetItemCount();
for (int i = 0; i < numItems; i++)
_listView.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
return true;
}
}
}
}
}
return false;
}
void CListViewDialog::OnOK()
{
FocusedItemIndex = _listView.GetFocusedItem();
CModalDialog::OnOK();
}

View File

@@ -0,0 +1,30 @@
// ListViewDialog.h
#ifndef __LISTVIEWDIALOG_H
#define __LISTVIEWDIALOG_H
#include "Windows/Control/Dialog.h"
#include "Windows/Control/ListView.h"
#include "resource.h"
class CListViewDialog: public NWindows::NControl::CModalDialog
{
NWindows::NControl::CListView _listView;
virtual void OnOK();
virtual bool OnInit();
virtual bool OnNotify(UINT controlID, LPNMHDR header);
public:
UString Title;
bool DeleteIsAllowed;
UStringVector Strings;
bool StringsWereChanged;
int FocusedItemIndex;
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_LISTVIEW, wndParent); }
CListViewDialog(): DeleteIsAllowed(false) {}
};
#endif

View File

@@ -0,0 +1,16 @@
// stdafx.h
#ifndef __STDAFX_H
#define __STDAFX_H
#define _WIN32_WINNT 0x0400
// it's for Windows NT supporting (MENUITEMINFOW)
#define WINVER 0x0400
#include <windows.h>
#include <commctrl.h>
#include "Common/NewHandler.h"
#endif

View File

@@ -0,0 +1,3 @@
#define IDD_DIALOG_LISTVIEW 201
#define IDC_LISTVIEW_LIST 1000

View File

@@ -0,0 +1,26 @@
#include "resource.h"
#include "../../../GuiCommon.rc"
#define xSize2 342
#define ySize2 220
#define xSize (xSize2 + marg + marg)
#define ySize (ySize2 + marg + marg)
#define bYPos (ySize - marg - bYSize)
#define b1XPos (xSize - marg - bXSize)
#define b2XPos (b1XPos - 10 - bXSize)
IDD_DIALOG_LISTVIEW DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
CAPTION "ListView"
MY_FONT
BEGIN
CONTROL "List1", IDC_LISTVIEW_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS |
LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,
marg, marg, xSize2, ySize2 - bYSize - 10
DEFPUSHBUTTON "OK", IDOK, b2XPos, bYPos, bXSize, bYSize
PUSHBUTTON "Cancel", IDCANCEL, b1XPos, bYPos, bXSize, bYSize
END