From 06aa78b482a7d694483420a16015c3ad122fb340 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 22 Nov 2000 22:51:27 +0000 Subject: [PATCH] --- source/gui/gfactory.cpp | 132 ++++++++++++++++++++++++++++++++++++++++ source/gui/gfactory.h | 61 +++++++++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 source/gui/gfactory.cpp create mode 100644 source/gui/gfactory.h diff --git a/source/gui/gfactory.cpp b/source/gui/gfactory.cpp new file mode 100644 index 000000000..7a1e13555 --- /dev/null +++ b/source/gui/gfactory.cpp @@ -0,0 +1,132 @@ +/*========================================================================= + + gfactory.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2000 Climax Development Ltd + +===========================================================================*/ + + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "gui\gfactory.h" + +#ifndef __GUI_GUI_H__ +#include "gui\gui.h" +#endif + +#ifndef __GUI_GTEXTBOX_H__ +#include "gui\gtextbox.h" +#endif + +#ifndef __GUI_GFRAME_H__ +#include "gui\gframe.h" +#endif + +#ifndef __GUI_GBUTTON_H__ +#include "gui\gbutton.h" +#endif + +#ifndef __GUI_GREADOUT_H__ +#include "gui\greadout.h" +#endif + +#ifndef __MEMORY_HEADER__ +#include "mem\memory.h" +#endif + + +/* Std Lib + ------- */ + +/* Data + ---- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +/*---------------------------------------------------------------------- + Function Prototypes + ------------------- */ + +/*---------------------------------------------------------------------- + Vars + ---- */ + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CGUIFactory::createValueButtonFrame(class CGUIObject *_parent, + int _x,int _y,int _w, int _h, + int _textId, + int *_target,int _value) +{ + CGUIGroupFrame *fr; + CGUITextBox *tb; + CGUIValueButton *vb; + + fr=new ("frame") CGUIGroupFrame(); + fr->init(_parent); + fr->setObjectXYWH(_x,_y,_w,_h); + tb=new ("textbox") CGUITextBox(); + tb->init(fr); + tb->setObjectXYWH(0,0,_w,_h); + tb->setText(_textId); + vb=new ("valuebutton") CGUIValueButton(); + vb->init(fr); + vb->setButtonTarget(_target); + vb->setButtonValue(_value); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CGUIFactory::createSliderButtonFrame(class CGUIObject *_parent, + int _x,int _y,int _w, int _h, + int _textId, + int *_target,int _min, int _max) +{ + CGUIGroupFrame *fr; + CGUITextBox *tb; + CGUISliderButton *sb; + CGUIBarReadout *br; + + fr=new ("frame") CGUIGroupFrame(); + fr->init(_parent); + fr->setObjectXYWH(_x,_y,_w,_h); + tb=new ("textbox") CGUITextBox(); + tb->init(fr); + tb->setObjectXYWH(0,0,_w,(_h*2)/3); + tb->setText(_textId); + sb=new ("sliderbutton") CGUISliderButton(); + sb->init(fr); + sb->setButtonTarget(_target); + sb->setButtonRange(_min,_max); + br=new ("barreadout") CGUIBarReadout(); + br->init(fr); + br->setObjectXYWH(0,(_h*2)/3,_w,(_h*1)/3); + br->setReadoutTarget(_target); + br->setReadoutRange(_min,_max); +} + + +/*=========================================================================== + end */ diff --git a/source/gui/gfactory.h b/source/gui/gfactory.h new file mode 100644 index 000000000..6a01543c3 --- /dev/null +++ b/source/gui/gfactory.h @@ -0,0 +1,61 @@ +/*========================================================================= + + gfactory.h + + Author: PKG + Created: + Project: Spongebob + Purpose: A factory to simplify the creation of actual UI objects. Rather than + creating the constituent parts of an item yourself, just call the + member functions here. + + Copyright (c) 2000 Climax Development Ltd + +===========================================================================*/ + +#ifndef __GUI_GFACTORY_H__ +#define __GUI_GFACTORY_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CGUIFactory +{ +public: + static void createValueButtonFrame(class CGUIObject *_parent, + int _x,int _y,int _w, int _h, + int _textId, + int *_target,int _value); + static void createSliderButtonFrame(class CGUIObject *_parent, + int _x,int _y,int _w, int _h, + int _textId, + int *_target,int _min, int _max); +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __GUI_GFACTORY_H__ */ + +/*=========================================================================== + end */