Skip to content

Commit

Permalink
・エディットボックスクラスの定義
Browse files Browse the repository at this point in the history
  • Loading branch information
miura committed Jan 30, 2017
1 parent 7607003 commit ce36933
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 9 deletions.
Binary file modified Debug/ObjeqtNote.exe
Binary file not shown.
19 changes: 19 additions & 0 deletions ObjeqtNote/EditBox.cpp
@@ -0,0 +1,19 @@
// 二重インクルード防止
#pragma once // #pragma onceで二重インクルード防止.

// ヘッダのインクルード
// 独自のヘッダ
#include "EditBox.h" // エディットボックスクラス

// コンストラクタCEditBox()
CEditBox::CEditBox() : CCustomControl() {

}

// ウィンドウ作成関数Create(lpctszClassName省略)
BOOL CEditBox::Create(LPCTSTR lpctszWindowName, DWORD dwStyle, int x, int y, int iWidth, int iHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance){

// ウィンドウの作成.
return CCustomControl::Create(_T("Edit"), lpctszWindowName, dwStyle, x, y, iWidth, iHeight, hWndParent, hMenu, hInstance); // CCustomControl::Createでウィンドウを作成し, その戻り値をreturnで返す.

}
19 changes: 19 additions & 0 deletions ObjeqtNote/EditBox.h
@@ -0,0 +1,19 @@
// 二重インクルード防止
#pragma once // #pragma onceで二重インクルード防止.

// 独自のヘッダ
#include "CustomControl.h" // カスタムコントロールクラス

// エディットボックスクラスCEditBox
class CEditBox : public CCustomControl {

// publicメンバ
public:

// コンストラクタ・デストラクタ
CEditBox(); // コンストラクタCEditBox()

// メンバ関数
virtual BOOL Create(LPCTSTR lpctszWindowName, DWORD dwStyle, int x, int y, int iWidth, int iHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance); // ウィンドウ作成関数Create(lpctszClassName省略)

};
14 changes: 7 additions & 7 deletions ObjeqtNote/MainWindow.cpp
Expand Up @@ -17,17 +17,17 @@ CMainWindow::CMainWindow() : CStandardWindow() {

// メンバの初期化
m_pUserControl = NULL; // m_pUserControlをNULLで初期化.
m_pCustomControl = NULL; // m_pCustomControlをNULLで初期化.
m_pEditBox = NULL; // m_pEditBoxをNULLで初期化.

}

// デストラクタ~CMainWindow()
CMainWindow::~CMainWindow() {

// メンバの終了処理.
if (m_pCustomControl != NULL) {
delete m_pCustomControl; // deleteでm_pCustomControlを解放.
m_pCustomControl = NULL; // m_pCustomControlをNULLで埋める.
if (m_pEditBox != NULL) {
delete m_pEditBox; // deleteでm_pEditBoxを解放.
m_pEditBox = NULL; // m_pEditBoxをNULLで埋める.
}
if (m_pUserControl != NULL) {
delete m_pUserControl; // deleteでm_pUserControlを解放.
Expand All @@ -54,9 +54,9 @@ int CMainWindow::OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct) {
m_pUserControl = new CUserControl(); // CUserControlオブジェクトを作成し, ポインタをm_pUserControlに格納.
m_pUserControl->Create(_T("UserControl"), _T(""), WS_BORDER, 50, 50, 100, 100, hwnd, (HMENU)(WM_APP + 1), lpCreateStruct->hInstance); // m_pUserControl->Createでウィンドウクラス名"UserControl"なウィンドウを作成.

// カスタムコントロールの作成.
m_pCustomControl = new CCustomControl(); // CCustomControlオブジェクトを作成し, ポインタをm_pCustomControlに格納.
m_pCustomControl->Create(_T("Edit"), _T(""), WS_BORDER | ES_MULTILINE | ES_AUTOVSCROLL, 150, 150, 200, 50, hwnd, (HMENU)(WM_APP + 2), lpCreateStruct->hInstance); // m_pCustomControl->Createでウィンドウクラス名"Edit"なウィンドウを作成.
// エディットボックスの作成.
m_pEditBox = new CEditBox(); // CEditBoxオブジェクトを作成し, ポインタをm_pEditBoxに格納.
m_pEditBox->Create(_T(""), WS_BORDER | ES_MULTILINE | ES_AUTOVSCROLL, 150, 150, 200, 50, hwnd, (HMENU)(WM_APP + 2), lpCreateStruct->hInstance); // m_pEditBox->Createでエディットボックスを作成.

// 成功.
return 0; // 成功なので0を返す.
Expand Down
4 changes: 2 additions & 2 deletions ObjeqtNote/MainWindow.h
Expand Up @@ -3,7 +3,7 @@

// 独自のヘッダ
#include "StandardWindow.h" // スタンダードウィンドウクラス
#include "CustomControl.h" // カスタムコントロールクラス
#include "EditBox.h" // エディットボックスクラス
#include "UserControl.h" // ユーザコントロールクラス

// メインウィンドウクラスCMainWindow
Expand All @@ -14,7 +14,7 @@ class CMainWindow : public CStandardWindow {

// publicメンバ変数
CUserControl *m_pUserControl; // CUserControl *型ユーザコントロールオブジェクトポインタm_pUserControl
CCustomControl *m_pCustomControl; // CCustomControl *型カスタムコントロールオブジェクトポインタm_pCustomControl
CEditBox *m_pEditBox; // CEditBox *型エディットボックスオブジェクトポインタm_pEditBox

// publicメンバ関数
// staticメンバ関数
Expand Down
Binary file modified ObjeqtNote/ObjeqtNote.rc
Binary file not shown.
2 changes: 2 additions & 0 deletions ObjeqtNote/ObjeqtNote.vcxproj
Expand Up @@ -150,6 +150,7 @@
<ClCompile Include="BasicApplication.cpp" />
<ClCompile Include="BasicWindow.cpp" />
<ClCompile Include="CustomControl.cpp" />
<ClCompile Include="EditBox.cpp" />
<ClCompile Include="MainApplication.cpp" />
<ClCompile Include="MainWindow.cpp" />
<ClCompile Include="MenuBar.cpp" />
Expand All @@ -165,6 +166,7 @@
<ClInclude Include="BasicApplication.h" />
<ClInclude Include="BasicWindow.h" />
<ClInclude Include="CustomControl.h" />
<ClInclude Include="EditBox.h" />
<ClInclude Include="MainApplication.h" />
<ClInclude Include="MainWindow.h" />
<ClInclude Include="MenuBar.h" />
Expand Down
Binary file modified Release/ObjeqtNote.exe
Binary file not shown.

0 comments on commit ce36933

Please sign in to comment.