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,19 +40,19 @@ 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,6 +100,8 @@ int CGUIGroupFrame::isSelectable()
CGUIObject *pGUI; CGUIObject *pGUI;
int selectable=false; int selectable=false;
if(!isHidden())
{
pGUI=getChild(); pGUI=getChild();
while(pGUI) while(pGUI)
{ {
@ -110,6 +112,7 @@ int CGUIGroupFrame::isSelectable()
} }
pGUI=pGUI->getNext(); pGUI=pGUI->getNext();
} }
}
return selectable; return selectable;
} }
@ -143,8 +146,6 @@ int CGUIGroupFrame::isUnselectable()
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:
@ -161,34 +162,50 @@ 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)
{
selectPreviousItem();
makeNoise=true;
}
if(makeNoise)
{
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGUIControlFrame::setFlags(GUI_FLAGS _flags)
{
GUI_FLAGS childFlags;
CGUIObject::setFlags(_flags);
childFlags=(GUI_FLAGS)(_flags&(-1^FLAG_SELECTED)); // Don't propogate the SELECTED flag
if(getChild())getChild()->setFlags(childFlags);
if(_flags&FLAG_SELECTED)
{
selectFrame();
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CGUIControlFrame::selectPreviousItem()
{ {
CGUIObject *pGUI,*prevGUI; CGUIObject *pGUI,*prevGUI;
@ -226,13 +243,6 @@ void CGUIControlFrame::think(int _frames)
prevGUI->select(); prevGUI->select();
} }
} }
makeNoise=true;
}
if(makeNoise)
{
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
}
} }
@ -242,17 +252,32 @@ void CGUIControlFrame::think(int _frames)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CGUIControlFrame::setFlags(GUI_FLAGS _flags) void CGUIControlFrame::selectNextItem()
{ {
GUI_FLAGS childFlags; CGUIObject *pGUI;
CGUIObject::setFlags(_flags); pGUI=getChild();
childFlags=(GUI_FLAGS)(_flags&(-1^FLAG_SELECTED)); // Don't propogate the SELECTED flag if(pGUI)
if(getChild())getChild()->setFlags(childFlags);
if(_flags&FLAG_SELECTED)
{ {
selectFrame(); // 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();
}
} }
} }

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;}