Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
191 additions
and
6 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// ヘッダのインクルード | ||
// 独自のヘッダ | ||
#include "ListControl.h" // リストコントロールクラス | ||
|
||
// コンストラクタCListControl() | ||
CListControl::CListControl() : CCustomControl() { | ||
|
||
} | ||
|
||
// デストラクタ~CListControl() | ||
CListControl::~CListControl() { | ||
|
||
} | ||
|
||
// ウィンドウ作成関数Create(lpctszClassName省略) | ||
BOOL CListControl::Create(LPCTSTR lpctszWindowName, DWORD dwStyle, int x, int y, int iWidth, int iHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance) { | ||
|
||
// ウィンドウの作成. | ||
return CCustomControl::Create(_T("SysListView32"), lpctszWindowName, dwStyle, x, y, iWidth, iHeight, hWndParent, hMenu, hInstance); // CCustomControl::Createでウィンドウを作成し, その戻り値をreturnで返す. | ||
|
||
} | ||
|
||
// ウィンドウ破棄関数Destroy | ||
void CListControl::Destroy() { | ||
|
||
// 自分のウィンドウも破棄. | ||
CWindow::Destroy(); // CWindow::Destroyで自身のウィンドウも破棄. | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 二重インクルード防止 | ||
#pragma once // #pragma onceで二重インクルード防止. | ||
|
||
// 独自のヘッダ | ||
#include "CustomControl.h" // カスタムコントロールクラス | ||
|
||
// リストコントロールクラスCListControl | ||
class CListControl : public CCustomControl { | ||
|
||
// publicメンバ | ||
public: | ||
|
||
// コンストラクタ・デストラクタ | ||
CListControl(); // コンストラクタCListControl() | ||
virtual ~CListControl(); // デストラクタ~CListControl() | ||
|
||
// メンバ関数 | ||
virtual BOOL Create(LPCTSTR lpctszWindowName, DWORD dwStyle, int x, int y, int iWidth, int iHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance); // ウィンドウ作成関数Create(lpctszClassName省略) | ||
virtual void Destroy(); // ウィンドウ破棄関数Destroy | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// ヘッダのインクルード | ||
// 独自のヘッダ | ||
#include "ListControlPanel.h" // リストコントロールパネルクラス | ||
// 既定のヘッダ | ||
#include <commctrl.h> // コモンコントロール | ||
|
||
// ウィンドウクラス登録関数RegisterClass | ||
BOOL CListControlPanel::RegisterClass(HINSTANCE hInstance) { | ||
|
||
// ユーザコントロールとして登録. | ||
return CUserControl::RegisterClass(hInstance, _T("ListControlPanel")); // CUserControl::RegisterClassでウィンドウクラス"ListControlPanel"を登録. | ||
|
||
} | ||
|
||
// コンストラクタCListControlPanel | ||
CListControlPanel::CListControlPanel() : CUserControl() { | ||
|
||
// メンバの初期化 | ||
m_pListControl = NULL; // m_pListControlをNULLで初期化. | ||
|
||
} | ||
|
||
// デストラクタ~CListControlPanel() | ||
CListControlPanel::~CListControlPanel() { | ||
|
||
// メンバの終了処理. | ||
Destroy(); // Destroyで破棄. | ||
|
||
} | ||
|
||
// ウィンドウ作成関数Create | ||
BOOL CListControlPanel::Create(LPCTSTR lpctszWindowName, DWORD dwStyle, int x, int y, int iWidth, int iHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance) { | ||
|
||
// ユーザコントロールで作成. | ||
m_nId = hMenu; | ||
return CUserControl::Create(_T("ListControlPanel"), lpctszWindowName, dwStyle, x, y, iWidth, iHeight, hWndParent, m_nId, hInstance); // CUserControl::Createでウィンドウクラス"ListControlPanel"なウィンドウを作成. | ||
|
||
} | ||
|
||
// ウィンドウ破棄関数Destroy | ||
void CListControlPanel::Destroy() { | ||
|
||
// 子ウィンドウの破棄. | ||
if (m_pListControl != NULL) { | ||
m_pListControl->Destroy(); // m_pListControlのウィンドウを破棄. | ||
delete m_pListControl; // deleteで解放. | ||
m_pListControl = NULL; // NULLで埋める. | ||
} | ||
|
||
// 自分のウィンドウも破棄. | ||
CWindow::Destroy(); // CWindow::Destroyで自身のウィンドウも破棄. | ||
|
||
} | ||
|
||
// ウィンドウ作成時のハンドラOnCreate. | ||
int CListControlPanel::OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct) { | ||
|
||
// 子リストコントロールの生成. | ||
m_pListControl = new CListControl(); // CListControlオブジェクトを作成し, ポインタをm_pListControlに格納. | ||
m_pListControl->Create(_T(""), WS_BORDER | WS_VSCROLL | WS_HSCROLL | LVS_ICON, PADDING, PADDING, m_iWidth - (PADDING * 2), m_iHeight - (PADDING * 2), hwnd, m_nId + 100, lpCreateStruct->hInstance); // m_pListControl->Createでリストコントロール作成. | ||
|
||
// 成功なので0を返す. | ||
return 0; | ||
|
||
} | ||
|
||
// ウィンドウサイズが変更された時のハンドラOnSize. | ||
void CListControlPanel::OnSize(UINT nType, int cx, int cy) { | ||
|
||
// 実際のウィンドウサイズを格納. | ||
m_iWidth = cx; // m_iWidthにcxをセット. | ||
m_iHeight = cy; // m_iHeightにcyをセット. | ||
|
||
// 子ウィンドウのリサイズ | ||
if (m_pListControl != NULL) { | ||
m_pListControl->MoveWindow(PADDING, PADDING, m_iWidth - (PADDING * 2), m_iHeight - (PADDING * 2)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 二重インクルード防止 | ||
#pragma once // #pragma onceで二重インクルード防止. | ||
|
||
// 独自のヘッダ | ||
#include "UserControl.h" // ユーザコントロールクラス | ||
#include "ListControl.h" // リストコントロールクラス | ||
|
||
// リストコントロールパネルクラスCListControlPanel | ||
class CListControlPanel : public CUserControl { | ||
|
||
// publicメンバ | ||
public: | ||
|
||
// publicメンバ変数 | ||
CListControl *m_pListControl; // CListControl *型ポインタm_pListControl. | ||
HMENU m_nId; // HMENU型リソースID, m_nId. | ||
|
||
// publicメンバ関数 | ||
// staticメンバ関数 | ||
static BOOL RegisterClass(HINSTANCE hInstance); // ウィンドウクラス登録関数RegisterClass | ||
|
||
// コンストラクタ・デストラクタ | ||
CListControlPanel(); // コンストラクタCListControlPanel | ||
virtual ~CListControlPanel(); // デストラクタ~CListControlPanel() | ||
|
||
// メンバ関数 | ||
virtual BOOL Create(LPCTSTR lpctszWindowName, DWORD dwStyle, int x, int y, int iWidth, int iHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance); // ウィンドウ作成関数Create | ||
virtual void Destroy(); // ウィンドウ破棄関数Destroy | ||
virtual int OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct); // ウィンドウ作成時のハンドラOnCreate. | ||
virtual void OnSize(UINT nType, int cx, int cy); // ウィンドウサイズが変更された時のハンドラOnSize. | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters