1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
#include "engine.h"
//------------Implementations-of-the-BASE-class---------------------------------------------
BASE::BASE(int show)
{
how_to_show=show;
}
int BASE::Fill(HINSTANCE inst,WNDPROC WindowProceedure,
LPCTSTR clsname,LPCTSTR menuname,UINT clsstyle,
LPCTSTR idc,LPCTSTR idi)
{
wcex.cbClsExtra=0;
wcex.cbSize=sizeof(WNDCLASSEX);
wcex.cbWndExtra=0;
wcex.hbrBackground=(HBRUSH) GetStockObject(WHITE_BRUSH);
wcex.hCursor=(HCURSOR)LoadImage(inst,MAKEINTRESOURCE(idc),IMAGE_CURSOR,16,16,LR_DEFAULTSIZE);
wcex.hIcon=(HICON)LoadImage(inst,MAKEINTRESOURCE(idi),IMAGE_ICON,32,32,LR_DEFAULTSIZE);
wcex.hIconSm=(HICON)LoadImage(inst,MAKEINTRESOURCEW(idi),IMAGE_ICON,16,16,LR_DEFAULTSIZE);
wcex.hInstance=inst;
wcex.lpfnWndProc=WindowProceedure;
wcex.lpszClassName=clsname;
wcex.lpszMenuName=menuname;
wcex.style=clsstyle;
if(wcex.cbSize!=0)
return 0;
else
return 1;
}
int BASE::Register()
{
ATOM temp=NULL;
temp=RegisterClassEx(&wcex);
if(temp!=NULL)
return 0;
else
return 1;
}
int BASE::Create(HINSTANCE inst,
HMENU hMenu,HWND hParent,
LPCWSTR clsname,LPCWSTR wndname,
DWORD wndstyle,DWORD exwndstyle,
int posx,int posy,int wid,int hei)
{
mhwnd=0;
mhwnd=CreateWindowExW(exwndstyle,
clsname,
wndname,
wndstyle,
posx,
posy,
wid,
hei,
hParent,
hMenu,
inst,
NULL);
if(mhwnd==0)
return 1;
else
return 0;
}
int BASE::Show()
{
BOOL temp=0;
temp=ShowWindow(mhwnd,how_to_show);
if(temp==0)
return 0;
else
return 1;
}
int BASE::Update()
{
BOOL temp=0;
temp=UpdateWindow(mhwnd);
if(temp==0)
return 1;
else
return 0;
}
int EXTRA::Toolbar(HINSTANCE instance,int idt)
{
iccex.dwICC=ICC_BAR_CLASSES;
iccex.dwSize=sizeof(INITCOMMONCONTROLSEX);
InitCommonControlsEx(&iccex);
const int no_of_buttons=7;
hwndToolbar=NULL;
TBBUTTON tbbuttons[no_of_buttons];
tbbuttons[0].dwData=0L;
tbbuttons[0].fsState=TBSTATE_ENABLED;
tbbuttons[0].fsStyle=TBSTYLE_BUTTON;
tbbuttons[0].iBitmap=0;
tbbuttons[0].idCommand=0;
tbbuttons[0].iString=0;
tbbuttons[0].dwData=0L;
tbbuttons[0].fsState=TBSTATE_ENABLED;
tbbuttons[0].fsStyle=TBSTYLE_BUTTON;
tbbuttons[0].iBitmap=1;
tbbuttons[0].idCommand=0;
tbbuttons[0].iString=0;
tbbuttons[0].dwData=0L;
tbbuttons[0].fsState=TBSTATE_ENABLED;
tbbuttons[0].fsStyle=TBSTYLE_BUTTON;
tbbuttons[0].iBitmap=2;
tbbuttons[0].idCommand=0;
tbbuttons[0].iString=0;
tbbuttons[0].dwData=0L;
tbbuttons[0].fsState=TBSTATE_ENABLED;
tbbuttons[0].fsStyle=TBSTYLE_BUTTON;
tbbuttons[0].iBitmap=3;
tbbuttons[0].idCommand=0;
tbbuttons[0].iString=0;
tbbuttons[0].dwData=0L;
tbbuttons[0].fsState=TBSTATE_ENABLED;
tbbuttons[0].fsStyle=TBSTYLE_SEP;
tbbuttons[0].iBitmap=0;
tbbuttons[0].idCommand=0;
tbbuttons[0].iString=0;
tbbuttons[0].dwData=0L;
tbbuttons[0].fsState=TBSTATE_ENABLED;
tbbuttons[0].fsStyle=TBSTYLE_BUTTON;
tbbuttons[0].iBitmap=4;
tbbuttons[0].idCommand=0;
tbbuttons[0].iString=0;
tbbuttons[0].dwData=0L;
tbbuttons[0].fsState=TBSTATE_ENABLED;
tbbuttons[0].fsStyle=TBSTYLE_BUTTON;
tbbuttons[0].iBitmap=5;
tbbuttons[0].idCommand=0;
tbbuttons[0].iString=0;
hwndToolbar=CreateToolbarEx(mhwnd,
WS_CHILD|WS_VISIBLE|WS_BORDER,
idt,
no_of_buttons,
instance,
idt,
tbbuttons,
no_of_buttons,
16,16,16,16,
sizeof(TBBUTTON));
if(hwndToolbar!=NULL)
return 0;
else
return 1;
}
|