controls.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. #ifndef __CONTROLS_
  2. #define __CONTROLS_
  3. #define BUTTON_LARGE 0
  4. #define BUTTON_SMALL 1
  5. typedef void (* CONTROL_CALLBACK)(void *p_control);
  6. typedef struct _HDC_EDIT_CONTROL
  7. {
  8. int hdcEdit;
  9. } HDC_EDIT_CONTROL;
  10. typedef struct _HDC_COMBO_CONTROL
  11. {
  12. int hdcCombo;
  13. int hdcComboEnd;
  14. int hdcComboMid;
  15. int hdcComboUp;
  16. int hdcComboDown;
  17. int hdcComboDrop;
  18. int hdcComboMover;
  19. int hdcComboMoverb;
  20. } HDC_COMBO_CONTROL;
  21. typedef struct _HDC_BUTTON_CONTROL
  22. {
  23. int hdcButtonL;
  24. int hdcButtonS;
  25. } HDC_BUTTON_CONTROL;
  26. typedef struct _HDC_FRAME_CONTROL
  27. {
  28. int hdcFrame;
  29. } HDC_FRAME_CONTROL;
  30. typedef struct _HDC_PROGRES_CONTROL
  31. {
  32. int hdcLine;
  33. int hdcMover;
  34. } HDC_PROGRES_CONTROL;
  35. typedef struct _HDC_CHECKBOX_CONTROL
  36. {
  37. int hdcCheck;
  38. int hdcGray;
  39. } HDC_CHECKBOX_CONTROL;
  40. typedef struct _HDC_LIST_CONTROL
  41. {
  42. int hdcListDown;
  43. int hdcListUp;
  44. int hdcListMover;
  45. int hdcListTop;
  46. int hdcListBottom;
  47. int hdcListLeft;
  48. int hdcListRight;
  49. int hdcListTL;
  50. int hdcListTR;
  51. int hdcListBL;
  52. int hdcListBR;
  53. } HDC_LIST_CONTROL;
  54. typedef struct _COMBO_ITEM
  55. {
  56. char text[256];
  57. int Sel;
  58. int Norm;
  59. float fValue;
  60. } COMBO_ITEM;
  61. typedef struct _COMBO_CONTROL
  62. {
  63. int comboID;
  64. int x;
  65. int y;
  66. int Width;
  67. int WidthR;
  68. int Hight;
  69. int ListHight;
  70. int ListMaxHight;
  71. int ListMaxHightR;
  72. int Selected;
  73. int CSelected;
  74. int SSelected;
  75. int OSelected;
  76. COMBO_ITEM *pItem;
  77. int CounfOfItems;
  78. int CounfOfItemsL;
  79. RECT coEditRect;
  80. RECT coDownRect;
  81. RECT coListRect;
  82. RECT coLUp;
  83. RECT coLDown;
  84. RECT coLMov;
  85. RECT coLMovA;
  86. char bEdit;
  87. char bList;
  88. char bOpen;
  89. int *pBDC;
  90. int xmstart;
  91. int xm;
  92. int xmp;
  93. char bIn;
  94. } COMBO_CONTROL;
  95. typedef struct _COMBO_DROP_CONTROL
  96. {
  97. int dropID;
  98. RECT coLUp;
  99. RECT coLDown;
  100. int x;
  101. int y;
  102. int Selected;
  103. COMBO_ITEM *pItem;
  104. int CounfOfItems;
  105. } COMBO_DROP_CONTROL;
  106. typedef struct _BUTTON_CONTROL
  107. {
  108. int x;
  109. int y;
  110. int type;
  111. RECT Rect;
  112. int dc;
  113. int ButtonID;
  114. char bActivated;
  115. } BUTTON_CONTROL;
  116. typedef struct _CHECKBOX_CONTROL
  117. {
  118. int x;
  119. int y;
  120. RECT Rect;
  121. RECT RectFull;
  122. int iDC;
  123. int checkID;
  124. char bChecked;
  125. char bChange;
  126. void *p_callback_data;
  127. CONTROL_CALLBACK p_callback;
  128. } CHECKBOX_CONTROL;
  129. typedef struct _PROGRES_CONTROL
  130. {
  131. RECT rectMover;
  132. RECT rectProgres;
  133. int progID;
  134. int min;
  135. int max;
  136. int pos;
  137. int cor;
  138. int x;
  139. int y;
  140. int bDC;
  141. char bIn;
  142. char bChange;
  143. char bExclusive;
  144. RECT RectFull;
  145. int iDC;
  146. } PROGRES_CONTROL;
  147. typedef struct _LIST_VIEW_ITEM
  148. {
  149. int iValue;
  150. char *cValue;
  151. WCHAR *wcValue;
  152. } LIST_VIEW_ITEM;
  153. typedef struct _LIST_VIEW_CONTROL
  154. {
  155. int listID;
  156. int dx;
  157. int listnum;
  158. int x;
  159. int y;
  160. int mpmin;
  161. int mpmax;
  162. int mpos;
  163. RECT rectList;
  164. RECT rectUp;
  165. RECT rectDown;
  166. RECT rectMoverA;
  167. RECT rectMover;
  168. int bDCn;
  169. int bDCs;
  170. int bDCm;
  171. char bIn;
  172. char bInE;
  173. int Selected;
  174. int Pushc;
  175. DWORD pTime;
  176. int cSelected;
  177. int cClckSel;
  178. char bClck;
  179. char bDblClck;
  180. int bSelection;
  181. LIST_VIEW_ITEM *piValue;
  182. } LIST_VIEW_CONTROL;
  183. typedef struct _CONTROL_EDIT
  184. {
  185. int bDC;
  186. //int bDCb;
  187. int x;
  188. int y;
  189. WCHAR wtext[128];
  190. int lchar;
  191. int editID;
  192. RECT rect;
  193. char bActive;
  194. char bcActive;
  195. DWORD pTime;
  196. int tx;
  197. } CONTROL_EDIT;
  198. typedef struct _CONTROL_LIST_ITEM
  199. {
  200. COMBO_CONTROL *p_combo;
  201. BUTTON_CONTROL *p_button;
  202. CHECKBOX_CONTROL *p_check;
  203. PROGRES_CONTROL *p_prog;
  204. LIST_VIEW_CONTROL *p_list;
  205. CONTROL_EDIT *p_edit;
  206. COMBO_DROP_CONTROL *p_combod;
  207. int iTab;
  208. char bActive;
  209. char bFocus;
  210. char bDisabled;
  211. } CONTROL_LIST_ITEM;
  212. int co_Load_Graphic(int combo_var);
  213. int co_Release_Graphic(void);
  214. COMBO_CONTROL *co_Create_Combo(int hdc, int x, int y, int maxlisthight,
  215. int id);
  216. int co_Combo_Add_String(COMBO_CONTROL * p_co, char *text);
  217. int co_Combo_Add_StringWC(COMBO_CONTROL * p_co, char *text);
  218. int co_Combo_Add_StringWC2(COMBO_CONTROL * p_co, WCHAR * wc, char *text);
  219. int co_Combo_Set_Params(COMBO_CONTROL * p_co, int itemnum);
  220. int co_Combo_Set_Sel(int hdc, COMBO_CONTROL * p_co, int i);
  221. int co_Combo_Get_Sel(CONTROL_LIST_ITEM * p_list, int lsize, int id);
  222. void co_Release_Combo(COMBO_CONTROL * p_co);
  223. BUTTON_CONTROL *co_Create_Button(int hdc, int x, int y, int type, char *text,
  224. int isection, int buttonID);
  225. int co_Is_Button_Activated(CONTROL_LIST_ITEM * p_list, int lsize, int id);
  226. void co_Release_Button(BUTTON_CONTROL * p_bu);
  227. CHECKBOX_CONTROL *co_Create_CheckBox(int hdc, int x, int y, char *text,
  228. int isection, int checkID,
  229. CONTROL_CALLBACK p_callback = NULL,
  230. void *p_callback_data = NULL);
  231. int co_Check_Get_State(CONTROL_LIST_ITEM * p_list, int lsize, int id);
  232. int co_Check_Set_State(CHECKBOX_CONTROL * p_ch, int hdc, int state,
  233. char bDraw);
  234. void co_Release_CheckBox(CHECKBOX_CONTROL * p_ch);
  235. PROGRES_CONTROL *co_Create_Progres(int hdc, int x, int y, int min, int max,
  236. int progID);
  237. int co_Progres_Set(PROGRES_CONTROL * p_pr, int hdc, int i);
  238. int co_Progres_Get(CONTROL_LIST_ITEM * p_list, int lsize, int id);
  239. int co_Progres_Changed(CONTROL_LIST_ITEM * p_list, int lsize, int id);
  240. void co_Release_Progres(PROGRES_CONTROL * p_pr);
  241. int co_Set_Text(int hdc, int x, int y, char *text, int isection);
  242. int co_Set_Text_Center(int hdc, char *text, int isection, RECT r);
  243. int co_Set_Text_Right(int hdc, char *text, int isection, int x, int y);
  244. int co_Set_Text_RightWC(int hdc, char *text, int isection, int x, int y);
  245. LIST_VIEW_CONTROL *co_Create_List(int hdc, int x, int y, int width, int hight,
  246. int id, int numofitems, int bSelection);
  247. int co_List_Add_String(LIST_VIEW_CONTROL * p_li, int index, int x, char *text,
  248. int iValue, char bSelected);
  249. int co_List_Add_StringWC(LIST_VIEW_CONTROL * p_li, int index, int x,
  250. char *text, int iValue, char bSelected);
  251. int co_List_Add_StringWC2(LIST_VIEW_CONTROL * p_li, int index, int x,
  252. WCHAR * wc, char *text, int iValue, char bSelected);
  253. int co_List_Redraw(int hdc, LIST_VIEW_CONTROL * p_li, int y);
  254. int co_List_Get_Dbclck(CONTROL_LIST_ITEM * p_list, int lsize, int id,
  255. LIST_VIEW_CONTROL ** p_li);
  256. int co_List_Get_Clck(CONTROL_LIST_ITEM * p_list, int lsize, int id,
  257. LIST_VIEW_CONTROL ** p_li);
  258. int co_List_Get_Value(CONTROL_LIST_ITEM * p_list, int lsize, int id,
  259. int index);
  260. int co_List_Delete_Item(LIST_VIEW_CONTROL * p_li, char **cValue);
  261. void co_Release_List(LIST_VIEW_CONTROL * p_li);
  262. CONTROL_EDIT *co_Create_Edit(int hdc, int x, int y, int editID);
  263. WCHAR *co_Edit_Get_Text(CONTROL_EDIT * p_ed);
  264. COMBO_DROP_CONTROL *co_Create_Combo_Drop(int hdc, int x, int y, int id);
  265. int co_Combo_Drop_Add_String(COMBO_DROP_CONTROL * p_co, char *text,
  266. float fValue);
  267. int co_Combo_Drop_Set_Sel(int hdc, COMBO_DROP_CONTROL * p_co, int i);
  268. int co_Combo_Drop_Set_String(int hdc, COMBO_DROP_CONTROL * p_co, int xcor,
  269. int ycor);
  270. int co_Combo_Drop_Add_StringWC(COMBO_DROP_CONTROL * p_co, char *text,
  271. float fValue);
  272. int co_Combo_Drop_Get_Sel(CONTROL_LIST_ITEM * p_list, int lsize, int id,
  273. float *pf);
  274. void co_Handle_Controls(CONTROL_LIST_ITEM * p_list, int lsize, int x, int y,
  275. int hdc, int xcor, int ycor);
  276. void co_Handle_Release(CONTROL_LIST_ITEM * p_list, int lsize);
  277. int co_Rect_Hit(RECT rect, int x, int y);
  278. int co_Combo_Get_Sel_Not_Opend(CONTROL_LIST_ITEM * p_list, int lsize, int id);
  279. void co_Cleare_List(LIST_VIEW_CONTROL * p_li, int numofitems, int hdc,
  280. int xcor, int ycor);
  281. void co_Release_Combo_Drop(COMBO_DROP_CONTROL * p_co);
  282. void co_Check_Disable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM * p_list,
  283. int lsize, int id);
  284. void co_Check_Enable(int hdc, int xcor, int ycor, CONTROL_LIST_ITEM * p_list,
  285. int lsize, int id);
  286. int co_Check_Get_State_Change(CONTROL_LIST_ITEM * p_list, int lsize, int id);
  287. void co_Progres_Disable(int hdc, int xcor, int ycor,
  288. CONTROL_LIST_ITEM * p_list, int lsize, int id, char bSave, int shdc);
  289. void co_Progres_Enable(int hdc, int xcor, int ycor,
  290. CONTROL_LIST_ITEM * p_list, int lsize, int id);
  291. #endif