There would be an Array which stores the windows and information about them:
wID - Window ID (What the window is identified by throught the Operating System)
wCaption - Window Caption
wX - X position
wY - Y position
wState - (Minimized, Maximized, etc)
Then in each window have an array of the Controls within each window.
I am not sure as to how I would handle the clicks on a button or handle keyboard input for textbox's but I managed to whip up a theory on a sort of header of a control.
wID (ID of the Window it belongs to) (Sanity)
cID - ID the Control is identified by
cX - X Position of Control
cY - Y Position of Control
from there I am totally lost as to how associate control events and I want to have the controls have this header so that others can develop thier own controls similiar to ActiveX controls in Microsoft.
Thats all since I am going home now.
Regards,
Warrior
Edit: Looking at a Tutorial on Bona Fide I saw it used x and x2 as well as y and y2 (Why is that)
Anyway I wrote some sample code to get possible feedback on
Code: Select all
/* GUI.c */
#include <system.h>
struct wSize
{
long x1;
long y1;
long x2;
long y2;
};
struct wInfo
{
dword wID;
wSize wPos;
byte *wCaption;
dword wState;
byte repaint;
cInfo *wControls
};
void paint_window(dword wID)
{
/* Repaints the Window if it needs to be repainted */
}
void gui_init()
{
/* Sets up the Enviroment for the GUI */
/* Also initializes the Desktop (Will most likely be a big window with
several child Windows (our Windows) */
}
void handle_window(dword wID)
{
/* This code handles the Window Events (wClick, wLoad, wUnload)
I really should leave this to the discretion of the Program */
}