summaryrefslogtreecommitdiff
path: root/application.c
blob: e0545f5181650a96834012b74eb25fb9ff38445c (plain)
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
#include <skygi/skygi.h>

#include "application.h"

CApplication::CApplication() {
	this->hWnd = NULL;
	GI_Initialize();
	this->app = GI_ApplicationStructCreate();
	this->StyleApplication = 0;
	this->StyleFrame = 0;
	this->StyleTitle = 0;
	this->StyleMenu = 0;
	this->StyleBar = 0;
	this->StyleClient = 0;
}

void CApplication::SetStyle(unsigned int Application, unsigned int Frame, unsigned int Title, unsigned int Menu, unsigned int Bar, unsigned int Client) {
	this->StyleApplication = Application;
	this->StyleFrame = Frame;
	this->StyleTitle = Title;
	this->StyleMenu = Menu;
	this->StyleBar = Bar;
	this->StyleClient = Client;
}

HRESULT CApplication::Create(char * name, int x, int y, unsigned int w, unsigned int h, void * (*event)(HANDLE hWnd, s_gi_msg *msg)) {
	strncpy(this->app->ucApplicationName, name, 254);
	this->app->uiX = x;
	this->app->uiY = y;
	this->app->uiWidth = w;
	this->app->uiHeight = h;
	this->app->uiStyleApplication = this->StyleApplication;
	this->app->uiStyleFrame = this->StyleFrame;
	this->app->uiStyleTitle = this->StyleTitle;
	this->app->uiStyleMenu = this->StyleMenu;
	this->app->uiStyleBar = this->StyleBar;
	this->app->uiStyleClient = this->StyleClient;
	this->app->fwndClient = (void *)event;
	
	this->hWnd = GI_ApplicationCreate(this->app);
	if (this->hWnd != NULL) {
		return S_OK;
	}
	return S_FALSE;
}

HRESULT CApplication::Destroy() {
	return GI_WindowDestroy(this->hWnd);
}

HRESULT CApplication::Show() {
	return GI_ApplicationWindowShow(this->hWnd);
}

HRESULT CApplication::Hide() {
	return GI_ApplicationWindowHide(this->hWnd);
}

HRESULT CApplication::SetPos(int x, int y) {
	return GI_WindowSetPos(this->hWnd, x, y);
}

HRESULT CApplication::SetSize(int w, int h) {
	return GI_WindowSetSize(this->hWnd, w, h);
}

HANDLE CApplication::GetHANDLE() {
	return this->hWnd;
}