diff options
author | Matt Turner <mattst88@gmail.com> | 2006-12-26 19:37:43 +0000 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2006-12-26 19:37:43 +0000 |
commit | 38a93f5b90ddb6300e25934c4e43240b64d5f761 (patch) | |
tree | bc6253802a5fa1d96980d30aa900a52dabd3b1a9 | |
parent | 1c918cfffabb39f2ec977c46cef43c43072a5c3c (diff) |
Starting work again. Added CApplication class for easier creation of the main window. Next looks like it's going to be a message class (GI_Message* function wrapper).HEADmaster
git-svn-id: svn://mattst88.com/svn/skygipp/trunk@4 a71248a0-261a-0410-b604-901f7c0bd773
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | application.c | 69 | ||||
-rw-r--r-- | application.h | 33 | ||||
-rw-r--r-- | skygipp.h | 1 |
4 files changed, 106 insertions, 3 deletions
@@ -2,9 +2,9 @@ CC=g++ CPPFLAGS=-Os -pipe -fPIC -DPIC
LDFLAGS=-Wl,-O1
-OBJECTS=widget.o widgetbutton.o widgetcheckbox.o widgetform.o \
- widgettextfield.o widgetprogressbar.o widgetslider.o \
- widgettitle.o widgettooltip.o
+OBJECTS=application.o widget.o widgetbutton.o widgetcheckbox.o \
+ widgetform.o widgettextfield.o widgetprogressbar.o \
+ widgetslider.o widgettitle.o widgettooltip.o
all: ${OBJECTS}
${CC} ${LDFLAGS},-s -shared -o libskygi++.so ${OBJECTS}
diff --git a/application.c b/application.c new file mode 100644 index 0000000..e0545f5 --- /dev/null +++ b/application.c @@ -0,0 +1,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; +} diff --git a/application.h b/application.h new file mode 100644 index 0000000..1643bb7 --- /dev/null +++ b/application.h @@ -0,0 +1,33 @@ +#ifndef APPLICATION_H
+#define APPLICATION_H
+
+#include <skygi/skygi.h>
+
+class CApplication {
+ public:
+ CApplication();
+ void SetStyle(unsigned int Application,
+ unsigned int Frame,
+ unsigned int Title,
+ unsigned int Menu,
+ unsigned int Bar,
+ unsigned int Client);
+ HRESULT Create(char * name, int x, int y, unsigned int w, unsigned int h, void * (*event)(HANDLE hWnd, s_gi_msg *msg));
+ HRESULT Destroy();
+ HRESULT Show();
+ HRESULT Hide();
+ HRESULT SetPos(int x, int y);
+ HRESULT SetSize(int w, int h);
+ HANDLE GetHANDLE();
+ private:
+ HANDLE hWnd;
+ sCreateApplication * app;
+ unsigned int StyleApplication;
+ unsigned int StyleFrame;
+ unsigned int StyleTitle;
+ unsigned int StyleMenu;
+ unsigned int StyleBar;
+ unsigned int StyleClient;
+};
+
+#endif
@@ -1,6 +1,7 @@ #ifndef SKYGIPP_H
#define SKYGIPP_H
+#include "application.h"
#include "widget.h"
#include "widgetbutton.h"
#include "widgetcheckbox.h"
|