This commit is contained in:
Paul 2001-07-31 15:57:19 +00:00
parent 57168f717a
commit e550fe1868
4 changed files with 118 additions and 84 deletions

View File

@ -71,7 +71,7 @@
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CGUIFactory::createValueButtonFrame(class CGUIObject *_parent, CGUIObject *CGUIFactory::createValueButtonFrame(class CGUIObject *_parent,
int _x,int _y,int _w,int _h, int _x,int _y,int _w,int _h,
int _textId, int _textId,
int *_target,int _value) int *_target,int _value)
@ -91,6 +91,8 @@ void CGUIFactory::createValueButtonFrame(class CGUIObject *_parent,
vb->init(fr); vb->init(fr);
vb->setButtonTarget(_target); vb->setButtonTarget(_target);
vb->setButtonValue(_value); vb->setButtonValue(_value);
return fr;
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -99,7 +101,7 @@ void CGUIFactory::createValueButtonFrame(class CGUIObject *_parent,
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CGUIFactory::createCycleButtonFrame(class CGUIObject *_parent, CGUIObject *CGUIFactory::createCycleButtonFrame(class CGUIObject *_parent,
int _x,int _y,int _w,int _h, int _x,int _y,int _w,int _h,
int _textId, int _textId,
int *_target,int *_data,CGUITextReadout::TextReadoutData *_readoutData) int *_target,int *_data,CGUITextReadout::TextReadoutData *_readoutData)
@ -125,6 +127,8 @@ void CGUIFactory::createCycleButtonFrame(class CGUIObject *_parent,
tr->setObjectXYWH(0,(_h*2)/3,_w,(_h*1)/3); tr->setObjectXYWH(0,(_h*2)/3,_w,(_h*1)/3);
tr->setReadoutTarget(_target); tr->setReadoutTarget(_target);
tr->setReadoutData(_readoutData); tr->setReadoutData(_readoutData);
return fr;
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -133,7 +137,7 @@ void CGUIFactory::createCycleButtonFrame(class CGUIObject *_parent,
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CGUIFactory::createSliderButtonFrame(class CGUIObject *_parent, CGUIObject *CGUIFactory::createSliderButtonFrame(class CGUIObject *_parent,
int _x,int _y,int _w,int _h, int _x,int _y,int _w,int _h,
int _textId, int _textId,
int *_target,int _min,int _max) int *_target,int _min,int _max)
@ -159,6 +163,8 @@ void CGUIFactory::createSliderButtonFrame(class CGUIObject *_parent,
br->setObjectXYWH(0,(_h*2)/3,_w,(_h*1)/3); br->setObjectXYWH(0,(_h*2)/3,_w,(_h*1)/3);
br->setReadoutTarget(_target); br->setReadoutTarget(_target);
br->setReadoutRange(_min,_max); br->setReadoutRange(_min,_max);
return fr;
} }

View File

@ -40,22 +40,22 @@ class CGUIFactory
{ {
public: public:
// Creates a frame containing a value button with text label // Creates a frame containing a value button with text label
static void createValueButtonFrame(class CGUIObject *_parent, static CGUIObject *createValueButtonFrame(class CGUIObject *_parent,
int _x,int _y,int _w,int _h, int _x,int _y,int _w,int _h,
int _textId, int _textId,
int *_target,int _value); int *_target,int _value);
// Creates a frame containing a cycle button, text readout and text label // Creates a frame containing a cycle button, text readout and text label
static void createCycleButtonFrame(class CGUIObject *_parent, static CGUIObject *createCycleButtonFrame(class CGUIObject *_parent,
int _x,int _y,int _w,int _h, int _x,int _y,int _w,int _h,
int _textId, int _textId,
int *_target,int *_data,CGUITextReadout::TextReadoutData *_readoutData); int *_target,int *_data,CGUITextReadout::TextReadoutData *_readoutData);
// Creates a frame containing a slider button, readout and text label // Creates a frame containing a slider button, readout and text label
static void createSliderButtonFrame(class CGUIObject *_parent, static CGUIObject *createSliderButtonFrame(class CGUIObject *_parent,
int _x,int _y,int _w,int _h, int _x,int _y,int _w,int _h,
int _textId, int _textId,
int *_target,int _min,int _max); int *_target,int _min,int _max);
}; };

View File

@ -100,15 +100,18 @@ int CGUIGroupFrame::isSelectable()
CGUIObject *pGUI; CGUIObject *pGUI;
int selectable=false; int selectable=false;
pGUI=getChild(); if(!isHidden())
while(pGUI)
{ {
if(pGUI->isSelectable()) pGUI=getChild();
while(pGUI)
{ {
selectable=true; if(pGUI->isSelectable())
break; {
selectable=true;
break;
}
pGUI=pGUI->getNext();
} }
pGUI=pGUI->getNext();
} }
return selectable; return selectable;
@ -143,8 +146,6 @@ int CGUIGroupFrame::isUnselectable()
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:
@ -161,71 +162,12 @@ void CGUIControlFrame::think(int _frames)
pad=PadGetRepeat(0); pad=PadGetRepeat(0);
if(pad&PAD_DOWN) if(pad&PAD_DOWN)
{ {
CGUIObject *pGUI; selectNextItem();
pGUI=getChild();
if(pGUI)
{
// Get current selection and deselect it
while(!pGUI->isSelected())
{
ASSERT(pGUI);
pGUI=pGUI->getNext();
}
if(pGUI->isUnselectable())
{
pGUI->unselect();
// Find next selectable object and select it
do
{
pGUI=pGUI->getNext();
if(!pGUI)pGUI=getChild();
}
while(!pGUI->isSelectable());
pGUI->select();
}
}
makeNoise=true; makeNoise=true;
} }
else if(pad&PAD_UP) else if(pad&PAD_UP)
{ {
CGUIObject *pGUI,*prevGUI; selectPreviousItem();
pGUI=getChild();
prevGUI=0;
if(pGUI)
{
// Get current selection and deselect it
while(!pGUI->isSelected())
{
ASSERT(pGUI);
if(pGUI->isSelectable())
{
prevGUI=pGUI;
}
pGUI=pGUI->getNext();
}
if(pGUI->isUnselectable())
{
pGUI->unselect();
// Find previous selectable object and select it
if(!prevGUI)
{
do
{
if(pGUI->isSelectable())
{
prevGUI=pGUI;
}
pGUI=pGUI->getNext();
}
while(pGUI);
}
prevGUI->select();
}
}
makeNoise=true; makeNoise=true;
} }
@ -257,6 +199,89 @@ void CGUIControlFrame::setFlags(GUI_FLAGS _flags)
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGUIControlFrame::selectPreviousItem()
{
CGUIObject *pGUI,*prevGUI;
pGUI=getChild();
prevGUI=0;
if(pGUI)
{
// Get current selection and deselect it
while(!pGUI->isSelected())
{
ASSERT(pGUI);
if(pGUI->isSelectable())
{
prevGUI=pGUI;
}
pGUI=pGUI->getNext();
}
if(pGUI->isUnselectable())
{
pGUI->unselect();
// Find previous selectable object and select it
if(!prevGUI)
{
do
{
if(pGUI->isSelectable())
{
prevGUI=pGUI;
}
pGUI=pGUI->getNext();
}
while(pGUI);
}
prevGUI->select();
}
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGUIControlFrame::selectNextItem()
{
CGUIObject *pGUI;
pGUI=getChild();
if(pGUI)
{
// Get current selection and deselect it
while(!pGUI->isSelected())
{
ASSERT(pGUI);
pGUI=pGUI->getNext();
}
if(pGUI->isUnselectable())
{
pGUI->unselect();
// Find next selectable object and select it
do
{
pGUI=pGUI->getNext();
if(!pGUI)pGUI=getChild();
}
while(!pGUI->isSelectable());
pGUI->select();
}
}
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -58,6 +58,9 @@ public:
virtual void setFlags(GUI_FLAGS _flags); virtual void setFlags(GUI_FLAGS _flags);
virtual void clearFlags(GUI_FLAGS _flags); virtual void clearFlags(GUI_FLAGS _flags);
void selectPreviousItem();
void selectNextItem();
protected: protected:
GUI_FLAGS getInitialFlags() {return FLAG_DRAWBORDER;} GUI_FLAGS getInitialFlags() {return FLAG_DRAWBORDER;}