My Project
interface.cpp
Go to the documentation of this file.
1 #include "stdafx.h"
2 #include "../stdafx.h"
3 #include "interface.h"
4 
7 
9 {
10 
11 }
12 
14 {
15  this->hWnd = hWnd;
16  this->hInst = hInst;
17 }
18 
20 {
21 
22 }
23 
25 {
26 
27 }
28 
30 {
31  for (int i = 0; i < this->interfaceCtrlList.size(); i++)
32  {
33  this->interfaceCtrlList[i]->_BaseInterfaceCtrl->remove();
34  delete this->interfaceCtrlList[i]->_BaseInterfaceCtrl;
35  }
36  this->interfaceCtrlList.clear();
37 }
38 
40 {
41  for (int i = 0; i < this->interfaceCtrlList.size(); i++)
42  {
43  if ((this->interfaceCtrlList[i]->id == ID) && (this->interfaceCtrlList[i]->type == EBUTTON))
44  {
45  return (Button*)this->interfaceCtrlList[i]->_BaseInterfaceCtrl;
46  }
47  }
48  InterfaceCtrl* btn = new InterfaceCtrl;
49  btn->type = EBUTTON;
50  btn->id = ID;
51  btn->_BaseInterfaceCtrl = new Button(ID);
52  this->interfaceCtrlList.push_back(btn);
53  return (Button*)btn->_BaseInterfaceCtrl;
54 }
55 
57 {
58  for (int i = 0; i < this->interfaceCtrlList.size(); i++)
59  {
60  if ((this->interfaceCtrlList[i]->id == ID) && (this->interfaceCtrlList[i]->type == ECOMBO))
61  {
62  return (Combobox*)this->interfaceCtrlList[i]->_BaseInterfaceCtrl;
63  }
64  }
65  InterfaceCtrl* cb = new InterfaceCtrl;
66  cb->type = ECOMBO;
67  cb->id = ID;
68  cb->_BaseInterfaceCtrl = new Combobox(ID);
69  this->interfaceCtrlList.push_back(cb);
70  return (Combobox*)cb->_BaseInterfaceCtrl;
71 }
72 
74 {
75  for (int i = 0; i < this->interfaceCtrlList.size(); i++)
76  {
77  if ((this->interfaceCtrlList[i]->id == ID) && (this->interfaceCtrlList[i]->type == EEDITFIELD))
78  {
79  return (Editfield*)this->interfaceCtrlList[i]->_BaseInterfaceCtrl;
80  }
81  }
82  InterfaceCtrl* cb = new InterfaceCtrl;
83  cb->type = EEDITFIELD;
84  cb->id = ID;
85  cb->_BaseInterfaceCtrl = new Editfield(ID);
86  this->interfaceCtrlList.push_back(cb);
87  return (Editfield*)cb->_BaseInterfaceCtrl;
88 }
89 
91 {
92  for (int i = 0; i < this->interfaceCtrlList.size(); i++)
93  {
94  if (this->interfaceCtrlList[i]->id == ID)
95  {
96  this->interfaceCtrlList[i]->_BaseInterfaceCtrl->remove();
97  delete this->interfaceCtrlList[i]->_BaseInterfaceCtrl;
98  this->interfaceCtrlList.erase(this->interfaceCtrlList.begin() + i);
99  }
100  }
101 }
102 
103 COLORREF colorDialog()
104 {
105  CHOOSECOLOR cc = { 0 };
106  cc.lStructSize = sizeof(cc);
107  COLORREF cust_colors[16] = { 0 };
108  cc.lpCustColors = cust_colors;
109 
110  if (ChooseColor(&cc)) {
111  return cc.rgbResult;
112  }
113 
114  return RGB(255, 255, 255);
115 }
static HINSTANCE hInst
Definition: interface.h:61
Button.
Definition: interface.h:101
int id
Unique ID of element.
Definition: interface.h:113
Editfield * editfield(int ID)
Definition: interface.cpp:73
Combobox * combobox(int ID)
Definition: interface.cpp:56
Common draw interface class.
COLORREF colorDialog()
Definition: interface.cpp:103
Combobox.
Definition: interface.h:103
Combobox interface class Provide interface for creating/removing/updating combobox.
Definition: combobox.h:24
enum InterfaceCtrlType type
Interface Element type.
Definition: interface.h:112
Editfield interface class Provide interface for creating/removing editfield.
Definition: editfield.h:24
Edit field.
Definition: interface.h:102
void remove(int ID)
Definition: interface.cpp:90
BaseInterfaceCtrl * _BaseInterfaceCtrl
Pointer to object of Ctrl.
Definition: interface.h:114
Button interface class Provide interface for creating/removing button.
Definition: button.h:24
static HWND hWnd
Definition: interface.h:60
Button * button(int ID)
Definition: interface.cpp:39