mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 12:07:03 -06:00
3.13
This commit is contained in:
23
Windows/Control/ComboBox.cpp
Executable file
23
Windows/Control/ComboBox.cpp
Executable file
@@ -0,0 +1,23 @@
|
||||
// Windows/Control/ComboBox.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Control/ComboBox.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
int CComboBox::GetLBText(int index, CSysString &string)
|
||||
{
|
||||
string.Empty();
|
||||
int aLength = GetLBTextLen(index);
|
||||
if (aLength == CB_ERR)
|
||||
return aLength;
|
||||
aLength = GetLBText(index, string.GetBuffer(aLength));
|
||||
string.ReleaseBuffer();
|
||||
return aLength;
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
55
Windows/Control/ComboBox.h
Executable file
55
Windows/Control/ComboBox.h
Executable file
@@ -0,0 +1,55 @@
|
||||
// Windows/Control/ComboBox.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_COMBOBOX_H
|
||||
#define __WINDOWS_CONTROL_COMBOBOX_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CComboBox: public CWindow
|
||||
{
|
||||
public:
|
||||
void ResetContent()
|
||||
{ SendMessage(CB_RESETCONTENT, 0, 0); }
|
||||
int AddString(LPCTSTR string)
|
||||
{ return SendMessage(CB_ADDSTRING, 0, (LPARAM)string); }
|
||||
int SetCurSel(int index)
|
||||
{ return SendMessage(CB_SETCURSEL, index, 0); }
|
||||
int GetCurSel()
|
||||
{ return SendMessage(CB_GETCURSEL, 0, 0); }
|
||||
int GetCount()
|
||||
{ return SendMessage(CB_GETCOUNT, 0, 0); }
|
||||
|
||||
int GetLBTextLen(int index)
|
||||
{ return SendMessage(CB_GETLBTEXTLEN, index, 0); }
|
||||
int GetLBText(int index, LPTSTR string)
|
||||
{ return SendMessage(CB_GETLBTEXT, index, (LPARAM)string); }
|
||||
int GetLBText(int index, CSysString &string);
|
||||
|
||||
int SetItemData(int index, LPARAM lParam)
|
||||
{ return SendMessage(CB_SETITEMDATA, index, lParam); }
|
||||
int GetItemData(int index)
|
||||
{ return SendMessage(CB_GETITEMDATA, index, 0); }
|
||||
};
|
||||
|
||||
class CComboBoxEx: public CWindow
|
||||
{
|
||||
public:
|
||||
int DeleteItem(int index)
|
||||
{ return SendMessage(CBEM_DELETEITEM, index, 0); }
|
||||
int InsertItem(COMBOBOXEXITEM *item)
|
||||
{ return SendMessage(CBEM_INSERTITEM, 0, (LPARAM)item); }
|
||||
DWORD SetExtendedStyle(DWORD exMask, DWORD exStyle)
|
||||
{ return SendMessage(CBEM_SETEXTENDEDSTYLE, exMask, exStyle); }
|
||||
HWND GetEditControl()
|
||||
{ return (HWND)SendMessage(CBEM_GETEDITCONTROL, 0, 0); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
106
Windows/Control/Dialog.cpp
Executable file
106
Windows/Control/Dialog.cpp
Executable file
@@ -0,0 +1,106 @@
|
||||
// Windows/Control/Dialog.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Control/Dialog.h"
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
BOOL APIENTRY DialogProcedure(HWND dialogHWND, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CWindow aDialogTmp(dialogHWND);
|
||||
if (message == WM_INITDIALOG)
|
||||
aDialogTmp.SetUserDataLongPtr(lParam);
|
||||
CDialog *aDialog = (CDialog *)(aDialogTmp.GetUserDataLongPtr());
|
||||
if (aDialog == NULL)
|
||||
return FALSE;
|
||||
if (message == WM_INITDIALOG)
|
||||
aDialog->Attach(dialogHWND);
|
||||
|
||||
return BoolToBOOL(aDialog->OnMessage(message, wParam, lParam));
|
||||
}
|
||||
|
||||
bool CDialog::OnMessage(UINT message, UINT wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return OnInit();
|
||||
case WM_COMMAND:
|
||||
return OnCommand(wParam, lParam);
|
||||
case WM_NOTIFY:
|
||||
return OnNotify(wParam, (LPNMHDR) lParam);
|
||||
case WM_HELP:
|
||||
{
|
||||
OnHelp((LPHELPINFO)lParam);
|
||||
return true;
|
||||
}
|
||||
case WM_TIMER:
|
||||
{
|
||||
return OnTimer(wParam, lParam);
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CDialog::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return OnCommand(HIWORD(wParam), LOWORD(wParam), lParam);
|
||||
}
|
||||
|
||||
bool CDialog::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
{
|
||||
if (code == BN_CLICKED)
|
||||
return OnButtonClicked(itemID, (HWND)lParam);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
switch(buttonID)
|
||||
{
|
||||
case IDOK:
|
||||
OnOK();
|
||||
break;
|
||||
case IDCANCEL:
|
||||
OnCancel();
|
||||
break;
|
||||
case IDHELP:
|
||||
OnHelp();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CModelessDialog::Create(LPCTSTR templateName, HWND parentWindow)
|
||||
{
|
||||
HWND aHWND = CreateDialogParam(g_hInstance,
|
||||
templateName, parentWindow, DialogProcedure, LPARAM(this));
|
||||
if (aHWND == 0)
|
||||
return false;
|
||||
Attach(aHWND);
|
||||
return true;
|
||||
}
|
||||
|
||||
INT_PTR CModalDialog::Create(LPCTSTR templateName, HWND parentWindow)
|
||||
{
|
||||
return DialogBoxParam(g_hInstance,
|
||||
templateName, parentWindow, DialogProcedure, LPARAM(this));
|
||||
}
|
||||
|
||||
/*
|
||||
INT_PTR CModalDialog::Create(LPCWSTR templateName, HWND parentWindow)
|
||||
{
|
||||
return DialogBoxParamW(g_hInstance,
|
||||
templateName, parentWindow, DialogProcedure, LPARAM(this));
|
||||
}
|
||||
*/
|
||||
|
||||
}}
|
||||
137
Windows/Control/Dialog.h
Executable file
137
Windows/Control/Dialog.h
Executable file
@@ -0,0 +1,137 @@
|
||||
// Windows/Control/Dialog.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_DIALOG_H
|
||||
#define __WINDOWS_CONTROL_DIALOG_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
BOOL APIENTRY DialogProcedure(HWND dialogHWND, UINT message, UINT wParam, LPARAM lParam);
|
||||
|
||||
class CDialog: public CWindow
|
||||
{
|
||||
public:
|
||||
CDialog(HWND wndow = NULL): CWindow(wndow){};
|
||||
virtual ~CDialog() {};
|
||||
|
||||
HWND GetItem(int itemID) const
|
||||
{ return GetDlgItem(_window, itemID); }
|
||||
|
||||
bool EnableItem(int itemID, bool enable) const
|
||||
{ return BOOLToBool(::EnableWindow(GetItem(itemID), BoolToBOOL(enable))); }
|
||||
|
||||
bool SetItemText(int itemID, LPCTSTR s)
|
||||
{ return BOOLToBool(SetDlgItemText(_window, itemID, s)); }
|
||||
|
||||
#ifndef _UNICODE
|
||||
bool SetItemText(int itemID, LPCWSTR s)
|
||||
{
|
||||
CWindow window(GetItem(itemID));
|
||||
return window.SetText(s);
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT GetItemText(int itemID, LPTSTR string, int maxCount)
|
||||
{ return GetDlgItemText(_window, itemID, string, maxCount); }
|
||||
#ifndef _UNICODE
|
||||
/*
|
||||
bool GetItemText(int itemID, LPWSTR string, int maxCount)
|
||||
{
|
||||
CWindow window(GetItem(itemID));
|
||||
return window.GetText(string, maxCount);
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
bool SetItemInt(int itemID, UINT value, bool isSigned)
|
||||
{ return BOOLToBool(SetDlgItemInt(_window, itemID, value, BoolToBOOL(isSigned))); }
|
||||
bool GetItemInt(int itemID, bool isSigned, UINT &value)
|
||||
{
|
||||
BOOL result;
|
||||
value = GetDlgItemInt(_window, itemID, &result, BoolToBOOL(isSigned));
|
||||
return BOOLToBool(result);
|
||||
}
|
||||
|
||||
HWND GetNextGroupItem(HWND control, bool previous)
|
||||
{ return GetNextDlgGroupItem(_window, control, BoolToBOOL(previous)); }
|
||||
HWND GetNextTabItem(HWND control, bool previous)
|
||||
{ return GetNextDlgTabItem(_window, control, BoolToBOOL(previous)); }
|
||||
|
||||
bool MapRect(LPRECT rect)
|
||||
{ return BOOLToBool(MapDialogRect(_window, rect)); }
|
||||
|
||||
bool IsMessage(LPMSG message)
|
||||
{ return BOOLToBool(IsDialogMessage(_window, message)); }
|
||||
|
||||
LRESULT SendItemMessage(int itemID, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{ return SendDlgItemMessage(_window, itemID, message, wParam, lParam); }
|
||||
|
||||
bool CheckButton(int buttonID, UINT checkState)
|
||||
{ return BOOLToBool(CheckDlgButton(_window, buttonID, checkState)); }
|
||||
bool CheckButton(int buttonID, bool checkState)
|
||||
{ return CheckButton(buttonID, UINT(checkState ? BST_CHECKED : BST_UNCHECKED)); }
|
||||
|
||||
UINT IsButtonChecked(int buttonID) const
|
||||
{ return IsDlgButtonChecked(_window, buttonID); }
|
||||
bool IsButtonCheckedBool(int buttonID) const
|
||||
{ return (IsButtonChecked(buttonID) == BST_CHECKED); }
|
||||
|
||||
bool CheckRadioButton(int firstButtonID, int lastButtonID, int checkButtonID)
|
||||
{ return BOOLToBool(::CheckRadioButton(_window, firstButtonID, lastButtonID, checkButtonID)); }
|
||||
|
||||
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
virtual bool OnInit() { return true; }
|
||||
virtual bool OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
virtual bool OnCommand(int code, int itemID, LPARAM lParam);
|
||||
virtual void OnHelp(LPHELPINFO helpInfo) { OnHelp(); };
|
||||
virtual void OnHelp() {};
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
virtual void OnOK() {};
|
||||
virtual void OnCancel() {};
|
||||
virtual bool OnNotify(UINT controlID, LPNMHDR lParam) { return false; }
|
||||
virtual bool OnTimer(WPARAM timerID, LPARAM callback) { return false; }
|
||||
|
||||
LONG_PTR SetMsgResult(LONG_PTR newLongPtr )
|
||||
{ return SetLongPtr(DWLP_MSGRESULT, newLongPtr); }
|
||||
LONG_PTR GetMsgResult() const
|
||||
{ return GetLongPtr(DWLP_MSGRESULT); }
|
||||
};
|
||||
|
||||
class CModelessDialog: public CDialog
|
||||
{
|
||||
public:
|
||||
bool Create(LPCTSTR templateName, HWND parentWindow);
|
||||
virtual void OnOK() { Destroy(); }
|
||||
virtual void OnCancel() { Destroy(); }
|
||||
};
|
||||
|
||||
class CModalDialog: public CDialog
|
||||
{
|
||||
public:
|
||||
INT_PTR Create(LPCTSTR templateName, HWND parentWindow);
|
||||
// INT_PTR Create(LPCWSTR templateName, HWND parentWindow);
|
||||
bool End(INT_PTR result)
|
||||
{ return BOOLToBool(::EndDialog(_window, result)); }
|
||||
virtual void OnOK() { End(IDOK); }
|
||||
virtual void OnCancel() { End(IDCANCEL); }
|
||||
};
|
||||
|
||||
class CDialogChildControl: public NWindows::CWindow
|
||||
{
|
||||
public:
|
||||
int m_ID;
|
||||
void Init(const NWindows::NControl::CDialog &parentDialog, int id)
|
||||
{
|
||||
m_ID = id;
|
||||
Attach(parentDialog.GetItem(id));
|
||||
}
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
23
Windows/Control/Edit.h
Executable file
23
Windows/Control/Edit.h
Executable file
@@ -0,0 +1,23 @@
|
||||
// Windows/Control/Edit.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_EDIT_H
|
||||
#define __WINDOWS_CONTROL_EDIT_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CEdit: public CWindow
|
||||
{
|
||||
public:
|
||||
void SetPasswordChar(WPARAM c)
|
||||
{ SendMessage(EM_SETPASSWORDCHAR, c); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
11
Windows/Control/ImageList.cpp
Executable file
11
Windows/Control/ImageList.cpp
Executable file
@@ -0,0 +1,11 @@
|
||||
// Windows/Control/ImageList.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Control/ImageList.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
}}
|
||||
|
||||
88
Windows/Control/ImageList.h
Executable file
88
Windows/Control/ImageList.h
Executable file
@@ -0,0 +1,88 @@
|
||||
// Windows/Control/ImageList.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_IMAGELIST_H
|
||||
#define __WINDOWS_CONTROL_IMAGELIST_H
|
||||
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CImageList
|
||||
{
|
||||
HIMAGELIST m_Object;
|
||||
public:
|
||||
operator HIMAGELIST() const {return m_Object; }
|
||||
CImageList(): m_Object(NULL) {}
|
||||
bool Attach(HIMAGELIST imageList)
|
||||
{
|
||||
if(imageList == NULL)
|
||||
return false;
|
||||
m_Object = imageList;
|
||||
return true;
|
||||
}
|
||||
|
||||
HIMAGELIST Detach()
|
||||
{
|
||||
HIMAGELIST imageList = m_Object;
|
||||
m_Object = NULL;
|
||||
return imageList;
|
||||
}
|
||||
|
||||
bool Create(int width, int height, UINT flags, int initialNumber, int grow)
|
||||
{
|
||||
HIMAGELIST a = ImageList_Create(width, height, flags,
|
||||
initialNumber, grow);
|
||||
if(a == NULL)
|
||||
return false;
|
||||
return Attach(a);
|
||||
}
|
||||
|
||||
bool Destroy() // DeleteImageList() in MFC
|
||||
{
|
||||
if (m_Object == NULL)
|
||||
return false;
|
||||
return BOOLToBool(ImageList_Destroy(Detach()));
|
||||
}
|
||||
|
||||
~CImageList()
|
||||
{ Destroy(); }
|
||||
|
||||
int GetImageCount() const
|
||||
{ return ImageList_GetImageCount(m_Object); }
|
||||
|
||||
bool GetImageInfo(int index, IMAGEINFO* imageInfo) const
|
||||
{ return BOOLToBool(ImageList_GetImageInfo(m_Object, index, imageInfo)); }
|
||||
|
||||
int Add(HBITMAP hbmImage, HBITMAP hbmMask = 0)
|
||||
{ return ImageList_Add(m_Object, hbmImage, hbmMask); }
|
||||
int AddMasked(HBITMAP hbmImage, COLORREF mask)
|
||||
{ return ImageList_AddMasked(m_Object, hbmImage, mask); }
|
||||
int AddIcon(HICON icon)
|
||||
{ return ImageList_AddIcon(m_Object, icon); }
|
||||
int Replace(int index, HICON icon)
|
||||
{ return ImageList_ReplaceIcon(m_Object, index, icon); }
|
||||
|
||||
// If index is -1, the function removes all images.
|
||||
bool Remove(int index)
|
||||
{ return BOOLToBool(ImageList_Remove(m_Object, index)); }
|
||||
bool RemoveAll()
|
||||
{ return BOOLToBool(ImageList_RemoveAll(m_Object)); }
|
||||
|
||||
HICON ExtractIcon(int index)
|
||||
{ return ImageList_ExtractIcon(NULL, m_Object, index); }
|
||||
HICON GetIcon(int index, UINT flags)
|
||||
{ return ImageList_GetIcon(m_Object, index, flags); }
|
||||
|
||||
bool GetIconSize(int &width, int &height) const
|
||||
{ return BOOLToBool(ImageList_GetIconSize(m_Object, &width, &height)); }
|
||||
bool SetIconSize(int width, int height)
|
||||
{ return BOOLToBool(ImageList_SetIconSize(m_Object, width, height)); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
58
Windows/Control/ListView.cpp
Executable file
58
Windows/Control/ListView.cpp
Executable file
@@ -0,0 +1,58 @@
|
||||
// Windows/Control/ListView.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Control/ListView.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
bool CListView::CreateEx(DWORD exStyle, DWORD style,
|
||||
int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu,
|
||||
HINSTANCE instance, LPVOID createParam)
|
||||
{
|
||||
return CWindow::CreateEx(exStyle, WC_LISTVIEW, TEXT(""), style, x, y, width,
|
||||
height, parentWindow, idOrHMenu, instance, createParam);
|
||||
}
|
||||
|
||||
bool CListView::GetItemParam(int itemIndex, LPARAM ¶m) const
|
||||
{
|
||||
LVITEM item;
|
||||
item.iItem = itemIndex;
|
||||
item.iSubItem = 0;
|
||||
item.mask = LVIF_PARAM;
|
||||
bool aResult = GetItem(&item);
|
||||
param = item.lParam;
|
||||
return aResult;
|
||||
}
|
||||
|
||||
/*
|
||||
int CListView::InsertItem(UINT mask, int item, LPCTSTR itemText,
|
||||
UINT nState, UINT nStateMask, int nImage, LPARAM lParam)
|
||||
{
|
||||
LVITEM item;
|
||||
item.mask = nMask;
|
||||
item.iItem = nItem;
|
||||
item.iSubItem = 0;
|
||||
item.pszText = (LPTSTR)itemText;
|
||||
item.state = nState;
|
||||
item.stateMask = nStateMask;
|
||||
item.iImage = nImage;
|
||||
item.lParam = lParam;
|
||||
return InsertItem(&item);
|
||||
}
|
||||
|
||||
int CListView::InsertItem(int nItem, LPCTSTR itemText)
|
||||
{
|
||||
return InsertItem(LVIF_TEXT, nItem, itemText, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int CListView::InsertItem(int nItem, LPCTSTR itemText, int nImage)
|
||||
{
|
||||
return InsertItem(LVIF_TEXT | LVIF_IMAGE, nItem, itemText, 0, 0, nImage, 0);
|
||||
}
|
||||
*/
|
||||
|
||||
}}
|
||||
|
||||
121
Windows/Control/ListView.h
Executable file
121
Windows/Control/ListView.h
Executable file
@@ -0,0 +1,121 @@
|
||||
// Windows/Control/ListView.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_LISTVIEW_H
|
||||
#define __WINDOWS_CONTROL_LISTVIEW_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CListView: public NWindows::CWindow
|
||||
{
|
||||
public:
|
||||
bool CreateEx(DWORD exStyle, DWORD style,
|
||||
int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu,
|
||||
HINSTANCE instance, LPVOID createParam);
|
||||
|
||||
bool DeleteAllItems()
|
||||
{ return BOOLToBool(ListView_DeleteAllItems(_window)); }
|
||||
int InsertColumn(int columnIndex, const LVCOLUMN *columnInfo)
|
||||
{ return ListView_InsertColumn(_window, columnIndex, columnInfo); }
|
||||
bool DeleteColumn(int columnIndex)
|
||||
{ return BOOLToBool(ListView_DeleteColumn(_window, columnIndex)); }
|
||||
|
||||
int InsertItem(const LVITEM* item)
|
||||
{ return ListView_InsertItem(_window, item); }
|
||||
bool SetItem(const LVITEM* item)
|
||||
{ return BOOLToBool(ListView_SetItem(_window, item)); }
|
||||
bool DeleteItem(int itemIndex)
|
||||
{ return BOOLToBool(ListView_DeleteItem(_window, itemIndex)); }
|
||||
|
||||
UINT GetSelectedCount() const
|
||||
{ return ListView_GetSelectedCount(_window); }
|
||||
int GetItemCount() const
|
||||
{ return ListView_GetItemCount(_window); }
|
||||
|
||||
INT GetSelectionMark()
|
||||
{ return ListView_GetSelectionMark(_window); }
|
||||
|
||||
void SetItemCount(int numItems)
|
||||
{ ListView_SetItemCount(_window, numItems); }
|
||||
void SetItemCountEx(int numItems, DWORD flags)
|
||||
{ ListView_SetItemCountEx(_window, numItems, flags); }
|
||||
|
||||
int GetNextItem(int startIndex, UINT flags) const
|
||||
{ return ListView_GetNextItem(_window, startIndex, flags); }
|
||||
int GetNextSelectedItem(int startIndex) const
|
||||
{ return GetNextItem(startIndex, LVNI_SELECTED); }
|
||||
int GetFocusedItem() const
|
||||
{ return GetNextItem(-1, LVNI_FOCUSED); }
|
||||
|
||||
bool GetItem(LVITEM* item) const
|
||||
{ return BOOLToBool(ListView_GetItem(_window, item)); }
|
||||
bool GetItemParam(int itemIndex, LPARAM ¶m) const;
|
||||
void GetItemText(int itemIndex, int aSubItemIndex, LPTSTR aText, int aTextSizeMax) const
|
||||
{ ListView_GetItemText(_window, itemIndex, aSubItemIndex, aText, aTextSizeMax); }
|
||||
bool SortItems(PFNLVCOMPARE compareFunction, LPARAM dataParam)
|
||||
{ return BOOLToBool(ListView_SortItems(_window, compareFunction, dataParam)); }
|
||||
|
||||
void SetItemState(int index, UINT state, UINT mask)
|
||||
{ ListView_SetItemState(_window, index, state, mask); }
|
||||
UINT GetItemState(int index, UINT mask)
|
||||
{ return ListView_GetItemState(_window, index, mask); }
|
||||
|
||||
bool GetColumn(int columnIndex, LVCOLUMN* columnInfo) const
|
||||
{ return BOOLToBool(ListView_GetColumn(_window, columnIndex, columnInfo)); }
|
||||
|
||||
HIMAGELIST SetImageList(HIMAGELIST imageList, int imageListType)
|
||||
{ return ListView_SetImageList(_window, imageList, imageListType); }
|
||||
|
||||
// version 4.70: NT5 | (NT4 + ie3) | w98 | (w95 + ie3)
|
||||
DWORD GetExtendedListViewStyle()
|
||||
{ return ListView_GetExtendedListViewStyle(_window); }
|
||||
void SetExtendedListViewStyle(DWORD exStyle)
|
||||
{ ListView_SetExtendedListViewStyle(_window, exStyle); }
|
||||
void SetExtendedListViewStyle(DWORD exMask, DWORD exStyle)
|
||||
{ ListView_SetExtendedListViewStyleEx(_window, exMask, exStyle); }
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
void SetCheckState(UINT index, bool checkState)
|
||||
{ ListView_SetCheckState(_window, index, BoolToBOOL(checkState)); }
|
||||
#endif
|
||||
bool GetCheckState(UINT index)
|
||||
{ return BOOLToBool(ListView_GetCheckState(_window, index)); }
|
||||
|
||||
|
||||
bool EnsureVisible(int index, bool partialOK)
|
||||
{ return BOOLToBool(ListView_EnsureVisible(_window, index, BoolToBOOL(partialOK))); }
|
||||
|
||||
bool GetItemRect(int index, RECT *rect, int code)
|
||||
{ return BOOLToBool(ListView_GetItemRect(_window, index, rect, code)); }
|
||||
|
||||
HWND GetEditControl()
|
||||
{ return ListView_GetEditControl(_window) ; }
|
||||
HWND EditLabel(int itemIndex)
|
||||
{ return ListView_EditLabel(_window, itemIndex) ; }
|
||||
|
||||
bool RedrawItems(int firstIndex, int lastIndex)
|
||||
{ return BOOLToBool(ListView_RedrawItems(_window, firstIndex, lastIndex)); }
|
||||
bool RedrawAllItems()
|
||||
{
|
||||
if (GetItemCount() > 0)
|
||||
return RedrawItems(0, GetItemCount() - 1);
|
||||
return true;
|
||||
}
|
||||
bool RedrawItem(int index)
|
||||
{ return RedrawItems(index, index); }
|
||||
|
||||
int HitTest(LPLVHITTESTINFO info)
|
||||
{ return ListView_HitTest(_window, info); }
|
||||
|
||||
COLORREF GetBkColor()
|
||||
{ return ListView_GetBkColor(_window); }
|
||||
};
|
||||
|
||||
}}
|
||||
#endif
|
||||
43
Windows/Control/ProgressBar.h
Executable file
43
Windows/Control/ProgressBar.h
Executable file
@@ -0,0 +1,43 @@
|
||||
// Windows/Control/ProgressBar.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_PROGRESSBAR_H
|
||||
#define __WINDOWS_CONTROL_PROGRESSBAR_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CProgressBar: public CWindow
|
||||
{
|
||||
public:
|
||||
LRESULT SetPos(int pos)
|
||||
{ return SendMessage(PBM_SETPOS, pos, 0); }
|
||||
LRESULT DeltaPos(int increment)
|
||||
{ return SendMessage(PBM_DELTAPOS, increment, 0); }
|
||||
UINT GetPos()
|
||||
{ return SendMessage(PBM_GETPOS, 0, 0); }
|
||||
LRESULT SetRange(unsigned short minValue, unsigned short maxValue)
|
||||
{ return SendMessage(PBM_SETRANGE, 0, MAKELPARAM(minValue, maxValue)); }
|
||||
DWORD SetRange32(int minValue, int maxValue)
|
||||
{ return SendMessage(PBM_SETRANGE32, minValue, maxValue); }
|
||||
int SetStep(int aStep)
|
||||
{ return SendMessage(PBM_SETSTEP, aStep, 0); }
|
||||
int StepIt()
|
||||
{ return SendMessage(PBM_STEPIT, 0, 0); }
|
||||
|
||||
int GetRange(bool minValue, PPBRANGE range)
|
||||
{ return SendMessage(PBM_GETRANGE, BoolToBOOL(minValue), (LPARAM)range); }
|
||||
|
||||
COLORREF SetBarColor(COLORREF color)
|
||||
{ return SendMessage(PBM_SETBARCOLOR, 0, color); }
|
||||
COLORREF SetBackgroundColor(COLORREF color)
|
||||
{ return SendMessage(PBM_SETBKCOLOR, 0, color); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
59
Windows/Control/PropertyPage.cpp
Executable file
59
Windows/Control/PropertyPage.cpp
Executable file
@@ -0,0 +1,59 @@
|
||||
// Windows/Control/PropertyPage.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Control/PropertyPage.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
BOOL APIENTRY ProperyPageProcedure(HWND dialogHWND, UINT message,
|
||||
UINT wParam, LONG lParam)
|
||||
{
|
||||
CDialog tempDialog(dialogHWND);
|
||||
if (message == WM_INITDIALOG)
|
||||
tempDialog.SetUserDataLongPtr(((PROPSHEETPAGE *)lParam)->lParam);
|
||||
CDialog *dialog = (CDialog *)(tempDialog.GetUserDataLongPtr());
|
||||
if (message == WM_INITDIALOG)
|
||||
dialog->Attach(dialogHWND);
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return dialog->OnInit();
|
||||
case WM_COMMAND:
|
||||
return dialog->OnCommand(wParam, lParam);
|
||||
case WM_NOTIFY:
|
||||
return dialog->OnNotify(wParam, (LPNMHDR) lParam);
|
||||
}
|
||||
if (dialog == NULL)
|
||||
return false;
|
||||
return dialog->OnMessage(message, wParam, lParam);
|
||||
}
|
||||
|
||||
bool CPropertyPage::OnNotify(UINT controlID, LPNMHDR lParam)
|
||||
{
|
||||
switch(lParam->code)
|
||||
{
|
||||
case PSN_APPLY:
|
||||
SetMsgResult(OnApply(LPPSHNOTIFY(lParam)));
|
||||
break;
|
||||
case PSN_KILLACTIVE:
|
||||
SetMsgResult(BoolToBOOL(OnKillActive(LPPSHNOTIFY(lParam))));
|
||||
break;
|
||||
case PSN_SETACTIVE:
|
||||
SetMsgResult(OnSetActive(LPPSHNOTIFY(lParam)));
|
||||
break;
|
||||
case PSN_RESET:
|
||||
OnReset(LPPSHNOTIFY(lParam));
|
||||
break;
|
||||
case PSN_HELP:
|
||||
OnNotifyHelp(LPPSHNOTIFY(lParam));
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
41
Windows/Control/PropertyPage.h
Executable file
41
Windows/Control/PropertyPage.h
Executable file
@@ -0,0 +1,41 @@
|
||||
// Windows/Control/PropertyPage.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_PROPERTYPAGE_H
|
||||
#define __WINDOWS_CONTROL_PROPERTYPAGE_H
|
||||
|
||||
#include "Windows/Control/Dialog.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
BOOL APIENTRY ProperyPageProcedure(HWND dialogHWND, UINT message, UINT wParam, LONG lParam);
|
||||
|
||||
class CPropertyPage: public CDialog
|
||||
{
|
||||
public:
|
||||
CPropertyPage(HWND window = NULL): CDialog(window){};
|
||||
|
||||
void Changed() { PropSheet_Changed(GetParent(), HWND(*this)); }
|
||||
void UnChanged() { PropSheet_UnChanged(GetParent(), HWND(*this)); }
|
||||
|
||||
virtual bool OnNotify(UINT controlID, LPNMHDR lParam);
|
||||
|
||||
virtual bool OnKillActive() { return false; } // false = OK
|
||||
virtual bool OnKillActive(const PSHNOTIFY *aPSHNOTIFY) { return OnKillActive(); }
|
||||
virtual LONG OnSetActive() { return false; } // false = OK
|
||||
virtual LONG OnSetActive(const PSHNOTIFY *aPSHNOTIFY) { return OnKillActive(); }
|
||||
virtual LONG OnApply() { return PSNRET_NOERROR; }
|
||||
virtual LONG OnApply(const PSHNOTIFY *aPSHNOTIFY) { return OnApply(); }
|
||||
virtual void OnNotifyHelp() { }
|
||||
virtual void OnNotifyHelp(const PSHNOTIFY *aPSHNOTIFY) { OnNotifyHelp(); }
|
||||
virtual void OnReset() { }
|
||||
virtual void OnReset(const PSHNOTIFY *aPSHNOTIFY) { OnReset(); }
|
||||
};
|
||||
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
37
Windows/Control/ReBar.h
Executable file
37
Windows/Control/ReBar.h
Executable file
@@ -0,0 +1,37 @@
|
||||
// Windows/Control/ReBar.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_REBAR_H
|
||||
#define __WINDOWS_CONTROL_REBAR_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CReBar: public NWindows::CWindow
|
||||
{
|
||||
public:
|
||||
bool SetBarInfo(LPREBARINFO barInfo)
|
||||
{ return BOOLToBool(SendMessage(RB_SETBARINFO, 0, (LPARAM)barInfo)); }
|
||||
bool InsertBand(int index, LPREBARBANDINFO bandInfo)
|
||||
{ return BOOLToBool(SendMessage(RB_INSERTBAND, index, (LPARAM)bandInfo)); }
|
||||
bool SetBandInfo(int index, LPREBARBANDINFO bandInfo)
|
||||
{ return BOOLToBool(SendMessage(RB_SETBANDINFO, index, (LPARAM)bandInfo)); }
|
||||
void MaximizeBand(int index, bool ideal)
|
||||
{ SendMessage(RB_MAXIMIZEBAND, index, BoolToBOOL(ideal)); }
|
||||
bool SizeToRect(LPRECT rect)
|
||||
{ return BOOLToBool(SendMessage(RB_SIZETORECT, 0, (LPARAM)rect)); }
|
||||
UINT GetHeight()
|
||||
{ return SendMessage(RB_GETBARHEIGHT); }
|
||||
UINT GetBandCount()
|
||||
{ return SendMessage(RB_GETBANDCOUNT); }
|
||||
bool DeleteBand(UINT index)
|
||||
{ return BOOLToBool(SendMessage(RB_DELETEBAND, index)); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
29
Windows/Control/Static.h
Executable file
29
Windows/Control/Static.h
Executable file
@@ -0,0 +1,29 @@
|
||||
// Windows/Control/Static.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_STATIC_H
|
||||
#define __WINDOWS_CONTROL_STATIC_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CStatic: public CWindow
|
||||
{
|
||||
public:
|
||||
HICON SetIcon(HICON icon)
|
||||
{ return (HICON)SendMessage(STM_SETICON, (WPARAM)icon, 0); }
|
||||
HICON GetIcon()
|
||||
{ return (HICON)SendMessage(STM_GETICON, 0, 0); }
|
||||
HANDLE SetImage(WPARAM imageType, HANDLE handle)
|
||||
{ return (HANDLE)SendMessage(STM_SETIMAGE, imageType, (LPARAM)handle); }
|
||||
HANDLE GetImage(WPARAM imageType)
|
||||
{ return (HANDLE)SendMessage(STM_GETIMAGE, imageType, 0); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
33
Windows/Control/StatusBar.h
Executable file
33
Windows/Control/StatusBar.h
Executable file
@@ -0,0 +1,33 @@
|
||||
// Windows/Control/StatusBar.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_STATUSBAR_H
|
||||
#define __WINDOWS_CONTROL_STATUSBAR_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CStatusBar: public NWindows::CWindow
|
||||
{
|
||||
public:
|
||||
bool Create(LONG style, LPCTSTR text, HWND hwndParent, UINT id)
|
||||
{ return (_window = ::CreateStatusWindow(style, text, hwndParent, id)) != 0; }
|
||||
bool SetParts(int numParts, const int *edgePostions)
|
||||
{ return BOOLToBool(SendMessage(SB_SETPARTS, numParts, (LPARAM)edgePostions)); }
|
||||
bool SetText(LPCTSTR text)
|
||||
{ return CWindow::SetText(text); }
|
||||
bool SetText(int index, LPCTSTR text, UINT type)
|
||||
{ return BOOLToBool(SendMessage(SB_SETTEXT, index | type, (LPARAM)text)); }
|
||||
bool SetText(int index, LPCTSTR text)
|
||||
{ return SetText(index, text, 0); }
|
||||
void Simple(bool simple)
|
||||
{ SendMessage(SB_SIMPLE, BoolToBOOL(simple), 0); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
32
Windows/Control/ToolBar.h
Executable file
32
Windows/Control/ToolBar.h
Executable file
@@ -0,0 +1,32 @@
|
||||
// Windows/Control/ToolBar.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_TOOLBAR_H
|
||||
#define __WINDOWS_CONTROL_TOOLBAR_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CToolBar: public NWindows::CWindow
|
||||
{
|
||||
public:
|
||||
bool GetMaxSize(LPSIZE size)
|
||||
{ return BOOLToBool(SendMessage(TB_GETMAXSIZE, 0, (LPARAM)size)); }
|
||||
bool EnableButton(UINT buttonID, bool enable)
|
||||
{ return BOOLToBool(SendMessage(TB_ENABLEBUTTON, buttonID,
|
||||
MAKELONG(BoolToBOOL(enable), 0))); }
|
||||
void ButtonStructSize()
|
||||
{ SendMessage(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON)); }
|
||||
HIMAGELIST SetImageList(UINT listIndex, HIMAGELIST imageList)
|
||||
{ return HIMAGELIST(SendMessage(TB_SETIMAGELIST, listIndex, (LPARAM)imageList)); }
|
||||
bool AddButton(UINT numButtons, LPTBBUTTON buttons)
|
||||
{ return BOOLToBool(SendMessage(TB_ADDBUTTONS, numButtons, (LPARAM)buttons)); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
30
Windows/Control/Trackbar.h
Executable file
30
Windows/Control/Trackbar.h
Executable file
@@ -0,0 +1,30 @@
|
||||
// Windows/Control/Trackbar.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_TRACKBAR_H
|
||||
#define __WINDOWS_CONTROL_TRACKBAR_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CTrackbar: public CWindow
|
||||
{
|
||||
public:
|
||||
void SetRange(int minimum, int maximum, bool redraw = true)
|
||||
{ SendMessage(TBM_SETRANGE, BoolToBOOL(redraw), MAKELONG(minimum, maximum)); }
|
||||
void SetPos(int pos, bool redraw = true)
|
||||
{ SendMessage(TBM_SETPOS, BoolToBOOL(redraw), pos); }
|
||||
void SetTicFreq(int freq)
|
||||
{ SendMessage(TBM_SETTICFREQ, freq); }
|
||||
|
||||
int GetPos()
|
||||
{ return SendMessage(TBM_GETPOS); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
125
Windows/Control/Window2.cpp
Executable file
125
Windows/Control/Window2.cpp
Executable file
@@ -0,0 +1,125 @@
|
||||
// Windows/Control/Window2.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Control/Window2.h"
|
||||
|
||||
// extern HINSTANCE g_hInstance;
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
static LRESULT CALLBACK WindowProcedure(HWND aHWND, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CWindow tempWindow(aHWND);
|
||||
if (message == WM_NCCREATE)
|
||||
tempWindow.SetUserDataLongPtr(
|
||||
LONG_PTR(((LPCREATESTRUCT)lParam)->lpCreateParams));
|
||||
CWindow2 *window = (CWindow2*)(tempWindow.GetUserDataLongPtr());
|
||||
if (window == NULL)
|
||||
return FALSE;
|
||||
if (message == WM_NCCREATE)
|
||||
window->Attach(aHWND);
|
||||
if (window == 0)
|
||||
return DefWindowProc(aHWND, message, wParam, lParam);
|
||||
return window->OnMessage(message, wParam, lParam);
|
||||
}
|
||||
|
||||
bool CWindow2::CreateEx(DWORD exStyle, LPCTSTR className,
|
||||
LPCTSTR windowName, DWORD style,
|
||||
int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu,
|
||||
HINSTANCE instance)
|
||||
{
|
||||
WNDCLASS windowClass;
|
||||
if(!::GetClassInfo(instance, className, &windowClass))
|
||||
{
|
||||
// windowClass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
windowClass.style = 0;
|
||||
|
||||
windowClass.lpfnWndProc = WindowProcedure;
|
||||
windowClass.cbClsExtra = NULL;
|
||||
windowClass.cbWndExtra = NULL;
|
||||
windowClass.hInstance = instance;
|
||||
windowClass.hIcon = NULL;
|
||||
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
windowClass.lpszMenuName = NULL;
|
||||
windowClass.lpszClassName = className;
|
||||
if (::RegisterClass(&windowClass) == 0)
|
||||
return false;
|
||||
}
|
||||
return CWindow::CreateEx(exStyle, className, windowName,
|
||||
style, x, y, width, height, parentWindow,
|
||||
idOrHMenu, instance, this);
|
||||
}
|
||||
|
||||
LRESULT CWindow2::OnMessage(UINT message, UINT wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT result;
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
if (!OnCreate((CREATESTRUCT *)lParam))
|
||||
return -1;
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
if (OnCommand(wParam, lParam, result))
|
||||
return result;
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
if (OnNotify(wParam, (LPNMHDR) lParam, result))
|
||||
return result;
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
OnDestroy();
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
OnClose();
|
||||
return 0;
|
||||
case WM_SIZE:
|
||||
if (OnSize(wParam, LOWORD(lParam), HIWORD(lParam)))
|
||||
return 0;
|
||||
}
|
||||
return DefProc(message, wParam, lParam);
|
||||
}
|
||||
|
||||
bool CWindow2::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT &result)
|
||||
{
|
||||
return OnCommand(HIWORD(wParam), LOWORD(wParam), lParam, result);
|
||||
}
|
||||
|
||||
bool CWindow2::OnCommand(int code, int itemID, LPARAM lParam, LRESULT &result)
|
||||
{
|
||||
return false;
|
||||
// return DefProc(message, wParam, lParam);
|
||||
/*
|
||||
if (code == BN_CLICKED)
|
||||
return OnButtonClicked(itemID, (HWND)lParam);
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
bool CDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
switch(aButtonID)
|
||||
{
|
||||
case IDOK:
|
||||
OnOK();
|
||||
break;
|
||||
case IDCANCEL:
|
||||
OnCancel();
|
||||
break;
|
||||
case IDHELP:
|
||||
OnHelp();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}}
|
||||
54
Windows/Control/Window2.h
Executable file
54
Windows/Control/Window2.h
Executable file
@@ -0,0 +1,54 @@
|
||||
// Windows/Control/Window2.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_WINDOW2_H
|
||||
#define __WINDOWS_CONTROL_WINDOW2_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CWindow2: public CWindow
|
||||
{
|
||||
public:
|
||||
CWindow2(HWND newWindow = NULL): CWindow(newWindow){};
|
||||
virtual ~CWindow2() {};
|
||||
|
||||
LRESULT DefProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{ return ::DefWindowProc(_window, message, wParam, lParam); }
|
||||
|
||||
bool CreateEx(DWORD exStyle, LPCTSTR className,
|
||||
LPCTSTR windowName, DWORD style,
|
||||
int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu,
|
||||
HINSTANCE instance);
|
||||
|
||||
virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
virtual bool OnCreate(CREATESTRUCT *createStruct) { return true; }
|
||||
// virtual LRESULT OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
virtual bool OnCommand(WPARAM wParam, LPARAM lParam, LRESULT &result);
|
||||
virtual bool OnCommand(int code, int itemID, LPARAM lParam, LRESULT &result);
|
||||
virtual bool OnSize(WPARAM wParam, int xSize, int ySize) { return false; }
|
||||
virtual bool OnNotify(UINT controlID, LPNMHDR lParam, LRESULT &result) { return false; }
|
||||
virtual void OnDestroy() { PostQuitMessage(0); }
|
||||
virtual void OnClose() { Destroy(); }
|
||||
/*
|
||||
virtual LRESULT OnHelp(LPHELPINFO helpInfo) { OnHelp(); };
|
||||
virtual LRESULT OnHelp() {};
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
virtual void OnOK() {};
|
||||
virtual void OnCancel() {};
|
||||
*/
|
||||
|
||||
LONG_PTR SetMsgResult(LONG_PTR newLongPtr )
|
||||
{ return SetLongPtr(DWLP_MSGRESULT, newLongPtr); }
|
||||
LONG_PTR GetMsgResult() const
|
||||
{ return GetLongPtr(DWLP_MSGRESULT); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user