This commit is contained in:
parent
57168f717a
commit
e550fe1868
@ -71,7 +71,7 @@
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CGUIFactory::createValueButtonFrame(class CGUIObject *_parent,
|
||||
CGUIObject *CGUIFactory::createValueButtonFrame(class CGUIObject *_parent,
|
||||
int _x,int _y,int _w,int _h,
|
||||
int _textId,
|
||||
int *_target,int _value)
|
||||
@ -91,6 +91,8 @@ void CGUIFactory::createValueButtonFrame(class CGUIObject *_parent,
|
||||
vb->init(fr);
|
||||
vb->setButtonTarget(_target);
|
||||
vb->setButtonValue(_value);
|
||||
|
||||
return fr;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
@ -99,7 +101,7 @@ void CGUIFactory::createValueButtonFrame(class CGUIObject *_parent,
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CGUIFactory::createCycleButtonFrame(class CGUIObject *_parent,
|
||||
CGUIObject *CGUIFactory::createCycleButtonFrame(class CGUIObject *_parent,
|
||||
int _x,int _y,int _w,int _h,
|
||||
int _textId,
|
||||
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->setReadoutTarget(_target);
|
||||
tr->setReadoutData(_readoutData);
|
||||
|
||||
return fr;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
@ -133,7 +137,7 @@ void CGUIFactory::createCycleButtonFrame(class CGUIObject *_parent,
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CGUIFactory::createSliderButtonFrame(class CGUIObject *_parent,
|
||||
CGUIObject *CGUIFactory::createSliderButtonFrame(class CGUIObject *_parent,
|
||||
int _x,int _y,int _w,int _h,
|
||||
int _textId,
|
||||
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->setReadoutTarget(_target);
|
||||
br->setReadoutRange(_min,_max);
|
||||
|
||||
return fr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,19 +40,19 @@ class CGUIFactory
|
||||
{
|
||||
public:
|
||||
// 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 _textId,
|
||||
int *_target,int _value);
|
||||
|
||||
// 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 _textId,
|
||||
int *_target,int *_data,CGUITextReadout::TextReadoutData *_readoutData);
|
||||
|
||||
// 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 _textId,
|
||||
int *_target,int _min,int _max);
|
||||
|
@ -100,6 +100,8 @@ int CGUIGroupFrame::isSelectable()
|
||||
CGUIObject *pGUI;
|
||||
int selectable=false;
|
||||
|
||||
if(!isHidden())
|
||||
{
|
||||
pGUI=getChild();
|
||||
while(pGUI)
|
||||
{
|
||||
@ -110,6 +112,7 @@ int CGUIGroupFrame::isSelectable()
|
||||
}
|
||||
pGUI=pGUI->getNext();
|
||||
}
|
||||
}
|
||||
|
||||
return selectable;
|
||||
}
|
||||
@ -143,8 +146,6 @@ int CGUIGroupFrame::isUnselectable()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
@ -161,35 +162,51 @@ void CGUIControlFrame::think(int _frames)
|
||||
pad=PadGetRepeat(0);
|
||||
if(pad&PAD_DOWN)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
selectNextItem();
|
||||
makeNoise=true;
|
||||
}
|
||||
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;
|
||||
|
||||
pGUI=getChild();
|
||||
@ -226,13 +243,6 @@ void CGUIControlFrame::think(int _frames)
|
||||
prevGUI->select();
|
||||
}
|
||||
}
|
||||
makeNoise=true;
|
||||
}
|
||||
|
||||
if(makeNoise)
|
||||
{
|
||||
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -242,17 +252,32 @@ void CGUIControlFrame::think(int _frames)
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CGUIControlFrame::setFlags(GUI_FLAGS _flags)
|
||||
void CGUIControlFrame::selectNextItem()
|
||||
{
|
||||
GUI_FLAGS childFlags;
|
||||
CGUIObject *pGUI;
|
||||
|
||||
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)
|
||||
pGUI=getChild();
|
||||
if(pGUI)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,9 @@ public:
|
||||
virtual void setFlags(GUI_FLAGS _flags);
|
||||
virtual void clearFlags(GUI_FLAGS _flags);
|
||||
|
||||
void selectPreviousItem();
|
||||
void selectNextItem();
|
||||
|
||||
|
||||
protected:
|
||||
GUI_FLAGS getInitialFlags() {return FLAG_DRAWBORDER;}
|
||||
|
Loading…
Reference in New Issue
Block a user