2012-11-26 18:58:24 +00:00
|
|
|
/*
|
|
|
|
===========================================================================
|
|
|
|
|
|
|
|
Doom 3 BFG Edition GPL Source Code
|
2012-11-28 15:47:07 +00:00
|
|
|
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
2012-11-26 18:58:24 +00:00
|
|
|
|
|
|
|
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
|
|
|
|
|
|
|
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
|
|
|
|
|
|
|
===========================================================================
|
|
|
|
*/
|
|
|
|
#ifndef __MENU_WIDGET_H__
|
|
|
|
#define __MENU_WIDGET_H__
|
|
|
|
|
|
|
|
class idMenuHandler;
|
|
|
|
class idMenuWidget;
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
enum menuOption_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
OPTION_INVALID = -1,
|
|
|
|
OPTION_BUTTON_TEXT,
|
|
|
|
OPTION_SLIDER_BAR,
|
|
|
|
OPTION_SLIDER_TEXT,
|
|
|
|
OPTION_SLIDER_TOGGLE,
|
|
|
|
OPTION_BUTTON_INFO,
|
|
|
|
OPTION_BUTTON_FULL_TEXT_SLIDER,
|
|
|
|
MAX_MENU_OPTION_TYPES
|
|
|
|
};
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
enum widgetEvent_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
WIDGET_EVENT_PRESS,
|
|
|
|
WIDGET_EVENT_RELEASE,
|
|
|
|
WIDGET_EVENT_ROLL_OVER,
|
|
|
|
WIDGET_EVENT_ROLL_OUT,
|
|
|
|
WIDGET_EVENT_FOCUS_ON,
|
|
|
|
WIDGET_EVENT_FOCUS_OFF,
|
|
|
|
|
|
|
|
WIDGET_EVENT_SCROLL_UP_LSTICK,
|
|
|
|
WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE,
|
|
|
|
WIDGET_EVENT_SCROLL_DOWN_LSTICK,
|
|
|
|
WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE,
|
|
|
|
WIDGET_EVENT_SCROLL_LEFT_LSTICK,
|
|
|
|
WIDGET_EVENT_SCROLL_LEFT_LSTICK_RELEASE,
|
|
|
|
WIDGET_EVENT_SCROLL_RIGHT_LSTICK,
|
|
|
|
WIDGET_EVENT_SCROLL_RIGHT_LSTICK_RELEASE,
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
WIDGET_EVENT_SCROLL_UP_RSTICK,
|
|
|
|
WIDGET_EVENT_SCROLL_UP_RSTICK_RELEASE,
|
|
|
|
WIDGET_EVENT_SCROLL_DOWN_RSTICK,
|
|
|
|
WIDGET_EVENT_SCROLL_DOWN_RSTICK_RELEASE,
|
|
|
|
WIDGET_EVENT_SCROLL_LEFT_RSTICK,
|
|
|
|
WIDGET_EVENT_SCROLL_LEFT_RSTICK_RELEASE,
|
|
|
|
WIDGET_EVENT_SCROLL_RIGHT_RSTICK,
|
|
|
|
WIDGET_EVENT_SCROLL_RIGHT_RSTICK_RELEASE,
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
WIDGET_EVENT_SCROLL_UP,
|
|
|
|
WIDGET_EVENT_SCROLL_UP_RELEASE,
|
|
|
|
WIDGET_EVENT_SCROLL_DOWN,
|
|
|
|
WIDGET_EVENT_SCROLL_DOWN_RELEASE,
|
|
|
|
WIDGET_EVENT_SCROLL_LEFT,
|
|
|
|
WIDGET_EVENT_SCROLL_LEFT_RELEASE,
|
|
|
|
WIDGET_EVENT_SCROLL_RIGHT,
|
|
|
|
WIDGET_EVENT_SCROLL_RIGHT_RELEASE,
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
WIDGET_EVENT_DRAG_START,
|
|
|
|
WIDGET_EVENT_DRAG_STOP,
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
WIDGET_EVENT_SCROLL_PAGEDWN,
|
|
|
|
WIDGET_EVENT_SCROLL_PAGEDWN_RELEASE,
|
|
|
|
WIDGET_EVENT_SCROLL_PAGEUP,
|
|
|
|
WIDGET_EVENT_SCROLL_PAGEUP_RELEASE,
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
WIDGET_EVENT_SCROLL,
|
|
|
|
WIDGET_EVENT_SCROLL_RELEASE,
|
|
|
|
WIDGET_EVENT_BACK,
|
|
|
|
WIDGET_EVENT_COMMAND,
|
|
|
|
WIDGET_EVENT_TAB_NEXT,
|
|
|
|
WIDGET_EVENT_TAB_PREV,
|
|
|
|
MAX_WIDGET_EVENT
|
|
|
|
};
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
enum scrollType_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
SCROLL_SINGLE, // scroll a single unit
|
|
|
|
SCROLL_PAGE, // scroll a page
|
|
|
|
SCROLL_FULL, // scroll all the way to the end
|
|
|
|
SCROLL_TOP, // scroll to the first selection
|
|
|
|
SCROLL_END, // scroll to the last selection
|
|
|
|
};
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
enum widgetAction_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
WIDGET_ACTION_NONE,
|
|
|
|
WIDGET_ACTION_COMMAND,
|
|
|
|
WIDGET_ACTION_FUNCTION, // call the SWF function
|
|
|
|
WIDGET_ACTION_SCROLL_VERTICAL, // scroll something. takes one param = amount to scroll (can be negative)
|
|
|
|
WIDGET_ACTION_SCROLL_VERTICAL_VARIABLE,
|
|
|
|
WIDGET_ACTION_SCROLL_PAGE,
|
|
|
|
WIDGET_ACTION_SCROLL_HORIZONTAL, // scroll something. takes one param = amount to scroll (can be negative)
|
|
|
|
WIDGET_ACTION_SCROLL_TAB,
|
|
|
|
WIDGET_ACTION_START_REPEATER,
|
|
|
|
WIDGET_ACTION_STOP_REPEATER,
|
|
|
|
WIDGET_ACTION_ADJUST_FIELD,
|
|
|
|
WIDGET_ACTION_PRESS_FOCUSED,
|
|
|
|
WIDGET_ACTION_JOY3_ON_PRESS,
|
|
|
|
WIDGET_ACTION_JOY4_ON_PRESS,
|
|
|
|
//
|
|
|
|
WIDGET_ACTION_GOTO_MENU,
|
|
|
|
WIDGET_ACTION_GO_BACK,
|
|
|
|
WIDGET_ACTION_EXIT_GAME,
|
|
|
|
WIDGET_ACTION_LAUNCH_MULTIPLAYER,
|
|
|
|
WIDGET_ACTION_MENU_BAR_SELECT,
|
|
|
|
WIDGET_ACTION_EMAIL_HOVER,
|
|
|
|
// PDA USER DATA ACTIONS
|
|
|
|
WIDGET_ACTION_PDA_SELECT_USER,
|
|
|
|
WIDGET_ACTION_SELECT_GAMERTAG,
|
|
|
|
WIDGET_ACTION_PDA_SELECT_NAV,
|
|
|
|
WIDGET_ACTION_SELECT_PDA_AUDIO,
|
|
|
|
WIDGET_ACTION_SELECT_PDA_VIDEO,
|
|
|
|
WIDGET_ACTION_SELECT_PDA_ITEM,
|
|
|
|
WIDGET_ACTION_SCROLL_DRAG,
|
|
|
|
// PDA EMAIL ACTIONS
|
|
|
|
WIDGET_ACTION_PDA_SELECT_EMAIL,
|
|
|
|
WIDGET_ACTION_PDA_CLOSE,
|
|
|
|
WIDGET_ACTION_REFRESH,
|
|
|
|
WIDGET_ACTION_MUTE_PLAYER,
|
|
|
|
MAX_WIDGET_ACTION
|
|
|
|
};
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
enum actionHandler_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER,
|
|
|
|
WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE,
|
|
|
|
WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER,
|
|
|
|
WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE,
|
|
|
|
WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER,
|
|
|
|
WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER,
|
|
|
|
WIDGET_ACTION_EVENT_SCROLL_PAGE_DOWN_START_REPEATER,
|
|
|
|
WIDGET_ACTION_EVENT_SCROLL_PAGE_UP_START_REPEATER,
|
|
|
|
WIDGET_ACTION_EVENT_STOP_REPEATER,
|
|
|
|
WIDGET_ACTION_EVENT_TAB_NEXT,
|
|
|
|
WIDGET_ACTION_EVENT_TAB_PREV,
|
|
|
|
WIDGET_ACTION_EVENT_DRAG_START,
|
|
|
|
WIDGET_ACTION_EVENT_DRAG_STOP,
|
|
|
|
WIDGET_ACTION_EVENT_JOY3_ON_PRESS,
|
|
|
|
};
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
struct widgetTransition_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
widgetTransition_t() :
|
2012-11-28 15:47:07 +00:00
|
|
|
animationName( NULL )
|
|
|
|
{
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
const char* animationName; // name of the animation to run
|
|
|
|
idStaticList< const char*, 4 > prefixes; // prefixes to try to use for animation
|
2012-11-26 18:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
scoreboardInfo_t
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
struct scoreboardInfo_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scoreboardInfo_t() :
|
|
|
|
index( -1 ),
|
2012-11-28 15:47:07 +00:00
|
|
|
voiceState( VOICECHAT_DISPLAY_NONE )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idList< idStr, TAG_IDLIB_LIST_MENU> values;
|
|
|
|
int index;
|
|
|
|
voiceStateDisplay_t voiceState;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idSort_SavesByDate
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idSort_SavesByDate : public idSort_Quick< idSaveGameDetails, idSort_SavesByDate >
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
2012-11-28 15:47:07 +00:00
|
|
|
int Compare( const idSaveGameDetails& a, const idSaveGameDetails& b ) const
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return b.date - a.date;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuDataSource
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuDataSource
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
virtual ~idMenuDataSource() { }
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void LoadData() = 0;
|
|
|
|
virtual void CommitData() = 0;
|
|
|
|
virtual bool IsDataChanged() const = 0;
|
|
|
|
virtual idSWFScriptVar GetField( const int fieldIndex ) const = 0;
|
|
|
|
virtual void AdjustField( const int fieldIndex, const int adjustAmount ) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idWidgetEvent
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idWidgetEvent
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
idWidgetEvent() :
|
|
|
|
type( WIDGET_EVENT_PRESS ),
|
|
|
|
arg( 0 ),
|
2012-11-28 15:47:07 +00:00
|
|
|
thisObject( NULL )
|
|
|
|
{
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idWidgetEvent( const widgetEvent_t type_, const int arg_, idSWFScriptObject* thisObject_, const idSWFParmList& parms_ ) :
|
|
|
|
type( type_ ),
|
2012-11-26 18:58:24 +00:00
|
|
|
arg( arg_ ),
|
|
|
|
thisObject( thisObject_ ),
|
2012-11-28 15:47:07 +00:00
|
|
|
parms( parms_ )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
widgetEvent_t type;
|
|
|
|
int arg;
|
2012-11-28 15:47:07 +00:00
|
|
|
idSWFScriptObject* thisObject;
|
2012-11-26 18:58:24 +00:00
|
|
|
idSWFParmList parms;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idWidgetAction
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idWidgetAction
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
idWidgetAction() :
|
|
|
|
action( WIDGET_ACTION_NONE ),
|
2012-11-28 15:47:07 +00:00
|
|
|
scriptFunction( NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idWidgetAction( const idWidgetAction& src )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
action = src.action;
|
|
|
|
parms = src.parms;
|
|
|
|
scriptFunction = src.scriptFunction;
|
2012-11-28 15:47:07 +00:00
|
|
|
if( scriptFunction != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scriptFunction->AddRef();
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
~idWidgetAction()
|
|
|
|
{
|
|
|
|
if( scriptFunction != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scriptFunction->Release();
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
void operator=( const idWidgetAction& src )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
action = src.action;
|
|
|
|
parms = src.parms;
|
|
|
|
scriptFunction = src.scriptFunction;
|
2012-11-28 15:47:07 +00:00
|
|
|
if( scriptFunction != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scriptFunction->AddRef();
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
bool operator==( const idWidgetAction& otherAction ) const
|
|
|
|
{
|
|
|
|
if( GetType() != otherAction.GetType()
|
|
|
|
|| GetParms().Num() != otherAction.GetParms().Num() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
// everything else is equal, so check all parms. NOTE: this assumes we are only sending
|
|
|
|
// integral types.
|
2012-11-28 15:47:07 +00:00
|
|
|
for( int i = 0; i < GetParms().Num(); ++i )
|
|
|
|
{
|
|
|
|
if( GetParms()[ i ].GetType() != otherAction.GetParms()[ i ].GetType()
|
|
|
|
|| GetParms()[ i ].ToInteger() != otherAction.GetParms()[ i ].ToInteger() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
void Set( idSWFScriptFunction* function )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
action = WIDGET_ACTION_FUNCTION;
|
2012-11-28 15:47:07 +00:00
|
|
|
if( scriptFunction != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scriptFunction->Release();
|
|
|
|
}
|
|
|
|
scriptFunction = function;
|
|
|
|
scriptFunction->AddRef();
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
void Set( widgetAction_t action_ )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
action = action_;
|
|
|
|
parms.Clear();
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
void Set( widgetAction_t action_, const idSWFScriptVar& var1 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
action = action_;
|
|
|
|
parms.Clear();
|
|
|
|
parms.Append( var1 );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
void Set( widgetAction_t action_, const idSWFScriptVar& var1, const idSWFScriptVar& var2 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
action = action_;
|
|
|
|
parms.Clear();
|
|
|
|
parms.Append( var1 );
|
|
|
|
parms.Append( var2 );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
void Set( widgetAction_t action_, const idSWFScriptVar& var1, const idSWFScriptVar& var2, const idSWFScriptVar& var3 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
action = action_;
|
|
|
|
parms.Clear();
|
|
|
|
parms.Append( var1 );
|
|
|
|
parms.Append( var2 );
|
|
|
|
parms.Append( var3 );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
void Set( widgetAction_t action_, const idSWFScriptVar& var1, const idSWFScriptVar& var2, const idSWFScriptVar& var3, const idSWFScriptVar& var4 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
action = action_;
|
|
|
|
parms.Clear();
|
|
|
|
parms.Append( var1 );
|
|
|
|
parms.Append( var2 );
|
|
|
|
parms.Append( var3 );
|
|
|
|
parms.Append( var4 );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idSWFScriptFunction* GetScriptFunction()
|
|
|
|
{
|
|
|
|
return scriptFunction;
|
|
|
|
}
|
|
|
|
const widgetAction_t GetType() const
|
|
|
|
{
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
const idSWFParmList& GetParms() const
|
|
|
|
{
|
|
|
|
return parms;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
widgetAction_t action;
|
|
|
|
idSWFParmList parms;
|
2012-11-28 15:47:07 +00:00
|
|
|
idSWFScriptFunction* scriptFunction;
|
2012-11-26 18:58:24 +00:00
|
|
|
};
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
typedef idList< idMenuWidget*, TAG_IDLIB_LIST_MENU > idMenuWidgetList;
|
2012-11-26 18:58:24 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget
|
|
|
|
|
|
|
|
We're using a model/view architecture, so this is the combination of both model and view. The
|
|
|
|
other part of the view is the SWF itself.
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
WrapWidgetSWFEvent
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class WrapWidgetSWFEvent : public idSWFScriptFunction_RefCounted
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
2012-11-28 15:47:07 +00:00
|
|
|
WrapWidgetSWFEvent( idMenuWidget* widget, const widgetEvent_t event, const int eventArg ) :
|
2012-11-26 18:58:24 +00:00
|
|
|
targetWidget( widget ),
|
|
|
|
targetEvent( event ),
|
2012-11-28 15:47:07 +00:00
|
|
|
targetEventArg( eventArg )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idSWFScriptVar Call( idSWFScriptObject* thisObject, const idSWFParmList& parms )
|
|
|
|
{
|
|
|
|
targetWidget->ReceiveEvent( idWidgetEvent( targetEvent, targetEventArg, thisObject, parms ) );
|
2012-11-26 18:58:24 +00:00
|
|
|
return idSWFScriptVar();
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget* targetWidget;
|
2012-11-26 18:58:24 +00:00
|
|
|
widgetEvent_t targetEvent;
|
|
|
|
int targetEventArg;
|
|
|
|
};
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
enum widgetState_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
WIDGET_STATE_HIDDEN, // hidden
|
|
|
|
WIDGET_STATE_NORMAL, // normal
|
|
|
|
WIDGET_STATE_SELECTING, // going into the selected state
|
|
|
|
WIDGET_STATE_SELECTED, // fully selected
|
|
|
|
WIDGET_STATE_DISABLED, // disabled
|
|
|
|
WIDGET_STATE_MAX
|
|
|
|
};
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idMenuWidget();
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual ~idMenuWidget();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
void Cleanup();
|
|
|
|
// typically this is where the allocations for a widget will occur: sub widgets, etc.
|
|
|
|
// Note that SWF sprite objects may not be accessible at this point.
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void Initialize( idMenuHandler* data )
|
|
|
|
{
|
|
|
|
menuData = data;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
// takes the information described in this widget and applies it to a given script object.
|
|
|
|
// the script object should point to the root that you want to run from. Running this will
|
|
|
|
// also create the sprite binding, if any.
|
|
|
|
virtual void Update() {}
|
|
|
|
virtual void Show();
|
|
|
|
virtual void Hide();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
widgetState_t GetState() const
|
|
|
|
{
|
|
|
|
return widgetState;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
void SetState( const widgetState_t state );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
// actually binds the sprite. this must be called after setting sprite path!
|
2012-11-28 15:47:07 +00:00
|
|
|
idSWFSpriteInstance* GetSprite()
|
|
|
|
{
|
|
|
|
return boundSprite;
|
|
|
|
}
|
|
|
|
idSWF* GetSWFObject();
|
|
|
|
idMenuHandler* GetMenuData();
|
|
|
|
bool BindSprite( idSWFScriptObject& root );
|
2012-11-26 18:58:24 +00:00
|
|
|
void ClearSprite();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
void SetSpritePath( const char* arg1, const char* arg2 = NULL, const char* arg3 = NULL, const char* arg4 = NULL, const char* arg5 = NULL );
|
|
|
|
void SetSpritePath( const idList< idStr >& spritePath_, const char* arg1 = NULL, const char* arg2 = NULL, const char* arg3 = NULL, const char* arg4 = NULL, const char* arg5 = NULL );
|
|
|
|
idList< idStr, TAG_IDLIB_LIST_MENU >& GetSpritePath()
|
|
|
|
{
|
|
|
|
return spritePath;
|
|
|
|
}
|
|
|
|
int GetRefCount() const
|
|
|
|
{
|
|
|
|
return refCount;
|
|
|
|
}
|
|
|
|
void AddRef()
|
|
|
|
{
|
|
|
|
refCount++;
|
|
|
|
}
|
|
|
|
void Release()
|
|
|
|
{
|
|
|
|
assert( refCount > 0 );
|
|
|
|
if( --refCount == 0 && !noAutoFree )
|
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
//------------------------
|
|
|
|
// Event Handling
|
|
|
|
//------------------------
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual bool HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled = false );
|
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event ) { }
|
|
|
|
void SendEventToObservers( const idWidgetEvent& event );
|
|
|
|
void RegisterEventObserver( idMenuWidget* observer );
|
|
|
|
void ReceiveEvent( const idWidgetEvent& event );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
// Executes an event in the context of this widget. Only rarely should this be called
|
|
|
|
// directly. Instead calls should go through ReceiveEvent which will propagate the event
|
|
|
|
// through the standard focus order.
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual bool ExecuteEvent( const idWidgetEvent& event );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
// returns the list of actions for a given event, or NULL if no actions are registered for
|
|
|
|
// that event. Events should not be directly added to the returned list. Instead use
|
|
|
|
// AddEventAction for adding new events.
|
2012-11-28 15:47:07 +00:00
|
|
|
idList< idWidgetAction, TAG_IDLIB_LIST_MENU >* GetEventActions( const widgetEvent_t eventType );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
// allocates an action for the given event
|
2012-11-28 15:47:07 +00:00
|
|
|
idWidgetAction& AddEventAction( const widgetEvent_t eventType );
|
2012-11-26 18:58:24 +00:00
|
|
|
void ClearEventActions();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
//------------------------
|
|
|
|
// Data modeling
|
|
|
|
//------------------------
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetDataSource( idMenuDataSource* dataSource, const int fieldIndex );
|
|
|
|
idMenuDataSource* GetDataSource()
|
|
|
|
{
|
|
|
|
return dataSource;
|
|
|
|
}
|
|
|
|
void SetDataSourceFieldIndex( const int dataSourceFieldIndex_ )
|
|
|
|
{
|
|
|
|
dataSourceFieldIndex = dataSourceFieldIndex_;
|
|
|
|
}
|
|
|
|
int GetDataSourceFieldIndex() const
|
|
|
|
{
|
|
|
|
return dataSourceFieldIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
idMenuWidget* GetFocus()
|
|
|
|
{
|
|
|
|
return ( focusIndex >= 0 && focusIndex < children.Num() ) ? children[ focusIndex ] : NULL;
|
|
|
|
}
|
|
|
|
int GetFocusIndex() const
|
|
|
|
{
|
|
|
|
return focusIndex;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
void SetFocusIndex( const int index, bool skipSound = false );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
//------------------------
|
|
|
|
// Hierarchy
|
|
|
|
//------------------------
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidgetList& GetChildren()
|
|
|
|
{
|
|
|
|
return children;
|
|
|
|
}
|
|
|
|
const idMenuWidgetList& GetChildren() const
|
|
|
|
{
|
|
|
|
return children;
|
|
|
|
}
|
|
|
|
idMenuWidget& GetChildByIndex( const int index ) const
|
|
|
|
{
|
|
|
|
return *children[ index ];
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddChild( idMenuWidget* widget );
|
|
|
|
void RemoveChild( idMenuWidget* widget );
|
|
|
|
bool HasChild( idMenuWidget* widget );
|
2012-11-26 18:58:24 +00:00
|
|
|
void RemoveAllChildren();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idMenuWidget* GetParent()
|
|
|
|
{
|
|
|
|
return parent;
|
|
|
|
}
|
|
|
|
const idMenuWidget* GetParent() const
|
|
|
|
{
|
|
|
|
return parent;
|
|
|
|
}
|
|
|
|
void SetParent( idMenuWidget* parent_ )
|
|
|
|
{
|
|
|
|
parent = parent_;
|
|
|
|
}
|
|
|
|
void SetSWFObj( idSWF* obj )
|
|
|
|
{
|
|
|
|
swfObj = obj;
|
|
|
|
}
|
|
|
|
bool GetHandlerIsParent()
|
|
|
|
{
|
|
|
|
return handlerIsParent;
|
|
|
|
}
|
|
|
|
void SetHandlerIsParent( bool val )
|
|
|
|
{
|
|
|
|
handlerIsParent = val;
|
|
|
|
}
|
|
|
|
void SetNoAutoFree( bool b )
|
|
|
|
{
|
|
|
|
noAutoFree = b;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
protected:
|
2012-11-28 15:47:07 +00:00
|
|
|
void ForceFocusIndex( const int index )
|
|
|
|
{
|
|
|
|
focusIndex = index;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
protected:
|
|
|
|
bool handlerIsParent;
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuHandler* menuData;
|
|
|
|
idSWF* swfObj;
|
|
|
|
idSWFSpriteInstance* boundSprite;
|
|
|
|
idMenuWidget* parent;
|
2012-11-26 18:58:24 +00:00
|
|
|
idList< idStr, TAG_IDLIB_LIST_MENU > spritePath;
|
|
|
|
idMenuWidgetList children;
|
|
|
|
idMenuWidgetList observers;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
static const int INVALID_ACTION_INDEX = -1;
|
|
|
|
idList< idList< idWidgetAction, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > eventActions;
|
|
|
|
idStaticList< int, MAX_WIDGET_EVENT > eventActionLookup;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idMenuDataSource* dataSource;
|
2012-11-26 18:58:24 +00:00
|
|
|
int dataSourceFieldIndex;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
int focusIndex;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
widgetState_t widgetState;
|
|
|
|
int refCount;
|
|
|
|
bool noAutoFree;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_Button
|
|
|
|
|
|
|
|
This might be better named "ComboButton", as it contains behavior for several controls along
|
|
|
|
with standard button behavior.
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_Button : public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
enum animState_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
ANIM_STATE_UP, // standard
|
|
|
|
ANIM_STATE_DOWN, // pressed down
|
|
|
|
ANIM_STATE_OVER, // hovered over this
|
|
|
|
ANIM_STATE_MAX
|
|
|
|
};
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuWidget_Button() :
|
|
|
|
animState( ANIM_STATE_UP ),
|
|
|
|
img( NULL ),
|
2012-11-28 15:47:07 +00:00
|
|
|
ignoreColor( false )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual ~idMenuWidget_Button() {}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
virtual bool ExecuteEvent( const idWidgetEvent& event );
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
//---------------
|
|
|
|
// Model
|
|
|
|
//---------------
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetLabel( const idStr& label )
|
|
|
|
{
|
|
|
|
btnLabel = label;
|
|
|
|
}
|
|
|
|
const idStr& GetLabel() const
|
|
|
|
{
|
|
|
|
return btnLabel;
|
|
|
|
}
|
|
|
|
void SetValues( idList< idStr >& list );
|
|
|
|
const idStr& GetValue( int index ) const;
|
|
|
|
void SetImg( const idMaterial* val )
|
|
|
|
{
|
|
|
|
img = val;
|
|
|
|
}
|
|
|
|
const idMaterial* GetImg()
|
|
|
|
{
|
|
|
|
return img;
|
|
|
|
}
|
|
|
|
void SetDescription( const char* desc_ )
|
|
|
|
{
|
|
|
|
description = desc_;
|
|
|
|
}
|
|
|
|
const idStr& GetDescription() const
|
|
|
|
{
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetIgnoreColor( const bool b )
|
|
|
|
{
|
|
|
|
ignoreColor = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
animState_t GetAnimState() const
|
|
|
|
{
|
|
|
|
return animState;
|
|
|
|
}
|
|
|
|
void SetAnimState( const animState_t state )
|
|
|
|
{
|
|
|
|
animState = state;
|
|
|
|
}
|
|
|
|
void SetOnPressFunction( idSWFScriptFunction* func )
|
|
|
|
{
|
|
|
|
scriptFunction = func;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
protected:
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetupTransitionInfo( widgetTransition_t& trans, const widgetState_t buttonState, const animState_t sourceAnimState, const animState_t destAnimState ) const;
|
2012-11-26 18:58:24 +00:00
|
|
|
void AnimateToState( const animState_t targetState, const bool force = false );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idList< idStr, TAG_IDLIB_LIST_MENU > values;
|
|
|
|
idStr btnLabel;
|
|
|
|
idStr description;
|
|
|
|
animState_t animState;
|
2012-11-28 15:47:07 +00:00
|
|
|
const idMaterial* img;
|
|
|
|
idSWFScriptFunction* scriptFunction;
|
2012-11-26 18:58:24 +00:00
|
|
|
bool ignoreColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_LobbyButton
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_LobbyButton : public idMenuWidget_Button
|
|
|
|
{
|
|
|
|
public:
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuWidget_LobbyButton() :
|
2012-11-28 15:47:07 +00:00
|
|
|
voiceState( VOICECHAT_DISPLAY_NONE )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
|
|
|
void SetButtonInfo( idStr name_, voiceStateDisplay_t voiceState_ );
|
2012-11-28 15:47:07 +00:00
|
|
|
bool IsValid()
|
|
|
|
{
|
|
|
|
return !name.IsEmpty();
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
protected:
|
|
|
|
idStr name;
|
|
|
|
voiceStateDisplay_t voiceState;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_ScoreboardButton
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_ScoreboardButton : public idMenuWidget_Button
|
|
|
|
{
|
|
|
|
public:
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuWidget_ScoreboardButton() :
|
|
|
|
voiceState( VOICECHAT_DISPLAY_NONE ),
|
2012-11-28 15:47:07 +00:00
|
|
|
index( -1 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetButtonInfo( int index_, idList< idStr >& list, voiceStateDisplay_t voiceState_ );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
protected:
|
|
|
|
voiceStateDisplay_t voiceState;
|
|
|
|
int index;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_ControlButton
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_ControlButton : public idMenuWidget_Button
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_ControlButton() :
|
2012-11-26 18:58:24 +00:00
|
|
|
optionType( OPTION_BUTTON_TEXT ),
|
2012-11-28 15:47:07 +00:00
|
|
|
disabled( false )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetOptionType( const menuOption_t type )
|
|
|
|
{
|
|
|
|
optionType = type;
|
|
|
|
}
|
|
|
|
menuOption_t GetOptionType() const
|
|
|
|
{
|
|
|
|
return optionType;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
void SetupEvents( int delay, int index );
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetDisabled( bool disable )
|
|
|
|
{
|
|
|
|
disabled = disable;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
protected:
|
|
|
|
menuOption_t optionType;
|
|
|
|
bool disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_ServerButton
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_ServerButton : public idMenuWidget_Button
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
idMenuWidget_ServerButton() :
|
|
|
|
players( 0 ),
|
|
|
|
index( 0 ),
|
|
|
|
maxPlayers( 0 ),
|
|
|
|
joinable( false ),
|
2012-11-28 15:47:07 +00:00
|
|
|
validMap( false )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
|
|
|
void SetButtonInfo( idStr name_, idStrId mapName_, idStr modeName_, int index_ = 0, int players_ = 0, int maxPlayers_ = 0, bool joinable_ = false, bool validMap_ = false );
|
2012-11-28 15:47:07 +00:00
|
|
|
bool IsValid()
|
|
|
|
{
|
|
|
|
return !serverName.IsEmpty();
|
|
|
|
}
|
|
|
|
bool CanJoin()
|
|
|
|
{
|
|
|
|
return ( joinable && validMap );
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
protected:
|
|
|
|
idStr serverName;
|
|
|
|
int index;
|
|
|
|
int players;
|
|
|
|
int maxPlayers;
|
|
|
|
bool joinable;
|
|
|
|
bool validMap;
|
|
|
|
idStrId mapName;
|
2012-11-28 15:47:07 +00:00
|
|
|
idStr modeName;
|
2012-11-26 18:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_NavButton
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_NavButton : public idMenuWidget_Button
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
enum navWidgetState_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
NAV_WIDGET_LEFT, // option on left side
|
|
|
|
NAV_WIDGET_RIGHT, // option on right side
|
|
|
|
NAV_WIDGET_SELECTED // option is selected
|
|
|
|
};
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idMenuWidget_NavButton() :
|
2012-11-26 18:58:24 +00:00
|
|
|
navIndex( 0 ),
|
2012-11-28 15:47:07 +00:00
|
|
|
xPos( 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
virtual bool ExecuteEvent( const idWidgetEvent& event );
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
void SetNavIndex( int i, const navWidgetState_t type )
|
|
|
|
{
|
|
|
|
navIndex = i;
|
|
|
|
navState = type;
|
|
|
|
}
|
|
|
|
void SetPosition( float pos )
|
|
|
|
{
|
|
|
|
xPos = pos;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
int navIndex;
|
|
|
|
float xPos;
|
|
|
|
navWidgetState_t navState;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_NavButton
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_MenuButton : public idMenuWidget_Button
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_MenuButton() :
|
|
|
|
xPos( 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetPosition( float pos )
|
|
|
|
{
|
|
|
|
xPos = pos;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
float xPos;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_List
|
|
|
|
|
|
|
|
Stores a list of widgets but displays only a segment of them at a time.
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_List : public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
idMenuWidget_List() :
|
|
|
|
numVisibleOptions( 0 ),
|
|
|
|
viewOffset( 0 ),
|
|
|
|
viewIndex( 0 ),
|
2012-11-28 15:47:07 +00:00
|
|
|
allowWrapping( false )
|
|
|
|
{
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual bool HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled = false );
|
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event );
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Scroll( const int scrollIndexAmount, const bool wrapAround = false );
|
|
|
|
virtual void ScrollOffset( const int scrollIndexAmount );
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual int GetTotalNumberOfOptions() const
|
|
|
|
{
|
|
|
|
return GetChildren().Num();
|
|
|
|
}
|
|
|
|
virtual bool PrepareListElement( idMenuWidget& widget, const int childIndex )
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsWrappingAllowed() const
|
|
|
|
{
|
|
|
|
return allowWrapping;
|
|
|
|
}
|
|
|
|
void SetWrappingAllowed( const bool allow )
|
|
|
|
{
|
|
|
|
allowWrapping = allow;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetNumVisibleOptions( const int numVisibleOptions_ )
|
|
|
|
{
|
|
|
|
numVisibleOptions = numVisibleOptions_;
|
|
|
|
}
|
|
|
|
int GetNumVisibleOptions() const
|
|
|
|
{
|
|
|
|
return numVisibleOptions;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetViewOffset() const
|
|
|
|
{
|
|
|
|
return viewOffset;
|
|
|
|
}
|
|
|
|
void SetViewOffset( const int offset )
|
|
|
|
{
|
|
|
|
viewOffset = offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetViewIndex() const
|
|
|
|
{
|
|
|
|
return viewIndex;
|
|
|
|
}
|
|
|
|
void SetViewIndex( const int index )
|
|
|
|
{
|
|
|
|
viewIndex = index;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CalculatePositionFromIndexDelta( int& outIndex, int& outOffset, const int currentIndex, const int currentOffset, const int windowSize, const int maxSize, const int indexDelta, const bool allowWrapping, const bool wrapAround = false ) const;
|
|
|
|
void CalculatePositionFromOffsetDelta( int& outIndex, int& outOffset, const int currentIndex, const int currentOffset, const int windowSize, const int maxSize, const int offsetDelta ) const;
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
int numVisibleOptions;
|
|
|
|
int viewOffset;
|
|
|
|
int viewIndex;
|
|
|
|
bool allowWrapping;
|
|
|
|
};
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
class idBrowserEntry_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
idStr serverName;
|
|
|
|
int index;
|
|
|
|
int players;
|
|
|
|
int maxPlayers;
|
|
|
|
bool joinable;
|
|
|
|
bool validMap;
|
|
|
|
idStrId mapName;
|
|
|
|
idStr modeName;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_GameBrowserList
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_GameBrowserList : public idMenuWidget_List
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual bool PrepareListElement( idMenuWidget& widget, const int childIndex );
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual int GetTotalNumberOfOptions() const;
|
|
|
|
void ClearGames();
|
|
|
|
void AddGame( idStr name_, idStrId mapName_, idStr modeName_, int index_ = 0, int players_ = 0, int maxPlayers_ = 0, bool joinable_ = false, bool validMap_ = false );
|
|
|
|
int GetServerIndex();
|
|
|
|
private:
|
|
|
|
idList< idBrowserEntry_t > games;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_Carousel
|
2012-11-28 15:47:07 +00:00
|
|
|
Displays a list of items in a looping carousel pattern
|
2012-11-26 18:58:24 +00:00
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_Carousel : public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
idMenuWidget_Carousel() :
|
|
|
|
numVisibleOptions( 0 ),
|
|
|
|
viewIndex( 0 ),
|
|
|
|
moveToIndex( 0 ),
|
|
|
|
scrollLeft( false ),
|
|
|
|
fastScroll( false ),
|
2012-11-28 15:47:07 +00:00
|
|
|
moveDiff( 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
virtual void Initialize( idMenuHandler* data );
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual bool HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled = false );
|
|
|
|
virtual int GetTotalNumberOfOptions() const
|
|
|
|
{
|
|
|
|
return imgList.Num();
|
|
|
|
}
|
|
|
|
virtual bool PrepareListElement( idMenuWidget& widget, const int childIndex )
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetNumVisibleOptions( const int numVisibleOptions_ )
|
|
|
|
{
|
|
|
|
numVisibleOptions = numVisibleOptions_;
|
|
|
|
}
|
|
|
|
int GetNumVisibleOptions() const
|
|
|
|
{
|
|
|
|
return numVisibleOptions;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
void MoveToIndex( int index, bool instant = false );
|
|
|
|
void MoveToFirstItem( bool instant = true );
|
|
|
|
void MoveToLastItem( bool instant = true );
|
2012-11-28 15:47:07 +00:00
|
|
|
int GetMoveToIndex()
|
|
|
|
{
|
|
|
|
return moveToIndex;
|
|
|
|
}
|
|
|
|
void SetMoveToIndex( int index )
|
|
|
|
{
|
|
|
|
moveToIndex = index;
|
|
|
|
}
|
|
|
|
void SetViewIndex( int index )
|
|
|
|
{
|
|
|
|
viewIndex = index;
|
|
|
|
}
|
|
|
|
int GetViewIndex() const
|
|
|
|
{
|
|
|
|
return viewIndex;
|
|
|
|
}
|
|
|
|
void SetListImages( idList<const idMaterial*>& list );
|
|
|
|
void SetMoveDiff( int val )
|
|
|
|
{
|
|
|
|
moveDiff = val;
|
|
|
|
}
|
|
|
|
int GetMoveDiff()
|
|
|
|
{
|
|
|
|
return moveDiff;
|
|
|
|
}
|
|
|
|
bool GetScrollLeft()
|
|
|
|
{
|
|
|
|
return scrollLeft;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
int numVisibleOptions;
|
|
|
|
int viewIndex;
|
|
|
|
int moveToIndex;
|
|
|
|
int moveDiff;
|
|
|
|
bool fastScroll;
|
|
|
|
bool scrollLeft;
|
2012-11-28 15:47:07 +00:00
|
|
|
idList<const idMaterial*> imgList;
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_Help
|
|
|
|
|
|
|
|
Knows how to display help tooltips by observing events from other widgets
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_Help : public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
idStr lastFocusedMessage; // message from last widget that had focus
|
|
|
|
idStr lastHoveredMessage; // message from last widget that was hovered over
|
|
|
|
bool hideMessage;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_CommandBar
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_CommandBar : public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
2012-11-28 15:47:07 +00:00
|
|
|
enum button_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
BUTTON_JOY1,
|
|
|
|
BUTTON_JOY2,
|
|
|
|
BUTTON_JOY3,
|
|
|
|
BUTTON_JOY4,
|
|
|
|
BUTTON_JOY10,
|
|
|
|
BUTTON_TAB,
|
|
|
|
MAX_BUTTONS
|
|
|
|
};
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
enum alignment_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
LEFT,
|
|
|
|
RIGHT
|
|
|
|
};
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
struct buttonInfo_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idStr label; // empty labels are treated as hidden buttons
|
|
|
|
idWidgetAction action;
|
|
|
|
};
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuWidget_CommandBar() :
|
2012-11-28 15:47:07 +00:00
|
|
|
alignment( LEFT )
|
|
|
|
{
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
buttons.SetNum( MAX_BUTTONS );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual bool ExecuteEvent( const idWidgetEvent& event );
|
|
|
|
|
|
|
|
buttonInfo_t* GetButton( const button_t button )
|
|
|
|
{
|
|
|
|
return &buttons[ button ];
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
void ClearAllButtons();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
alignment_t GetAlignment() const
|
|
|
|
{
|
|
|
|
return alignment;
|
|
|
|
}
|
|
|
|
void SetAlignment( const alignment_t alignment_ )
|
|
|
|
{
|
|
|
|
alignment = alignment_;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
idStaticList< buttonInfo_t, MAX_BUTTONS > buttons;
|
|
|
|
alignment_t alignment;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_DynamicList
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_LobbyList : public idMenuWidget_List
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
idMenuWidget_LobbyList() :
|
2012-11-28 15:47:07 +00:00
|
|
|
numEntries( 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual bool PrepareListElement( idMenuWidget& widget, const int childIndex );
|
|
|
|
virtual int GetTotalNumberOfOptions() const
|
|
|
|
{
|
|
|
|
return numEntries;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
void SetEntryData( int index, idStr name, voiceStateDisplay_t voiceState );
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetHeadingInfo( idList< idStr >& list );
|
|
|
|
void SetNumEntries( int num )
|
|
|
|
{
|
|
|
|
numEntries = num;
|
|
|
|
}
|
|
|
|
int GetNumEntries()
|
|
|
|
{
|
|
|
|
return numEntries;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
void SetRefreshFunction( const char* func );
|
|
|
|
private:
|
|
|
|
idList< idStr, TAG_IDLIB_LIST_MENU > headings;
|
|
|
|
int numEntries;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_DynamicList
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_DynamicList : public idMenuWidget_List
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_DynamicList() :
|
2012-11-26 18:58:24 +00:00
|
|
|
controlList( false ),
|
2012-11-28 15:47:07 +00:00
|
|
|
ignoreColor( false )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void Initialize( idMenuHandler* data );
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual int GetTotalNumberOfOptions() const;
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual bool PrepareListElement( idMenuWidget& widget, const int childIndex );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Recalculate();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void SetListData( idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU >& list );
|
|
|
|
|
|
|
|
void SetControlList( bool val )
|
|
|
|
{
|
|
|
|
controlList = val;
|
|
|
|
}
|
|
|
|
void SetIgnoreColor( bool val )
|
|
|
|
{
|
|
|
|
ignoreColor = val;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > listItemInfo;
|
|
|
|
bool controlList;
|
|
|
|
bool ignoreColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_ScoreboardList
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_ScoreboardList : public idMenuWidget_DynamicList
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void Update();
|
|
|
|
virtual int GetTotalNumberOfOptions() const;
|
2012-11-26 18:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_NavBar
|
|
|
|
|
|
|
|
The nav bar is set up with the main option being at the safe frame line.
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_NavBar : public idMenuWidget_DynamicList
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_NavBar() :
|
|
|
|
initialPos( 0.0f ),
|
|
|
|
buttonPos( 0.0f ),
|
|
|
|
leftSpacer( 0.0f ),
|
|
|
|
rightSpacer( 0.0f ),
|
|
|
|
selectedSpacer( 0.0f )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void Initialize( idMenuHandler* data );
|
|
|
|
virtual void SetInitialXPos( float pos )
|
|
|
|
{
|
|
|
|
initialPos = pos;
|
|
|
|
}
|
|
|
|
virtual void SetButtonSpacing( float lSpace, float rSpace, float sSpace )
|
|
|
|
{
|
|
|
|
leftSpacer = lSpace;
|
|
|
|
rightSpacer = rSpace;
|
|
|
|
selectedSpacer = sSpace;
|
|
|
|
}
|
|
|
|
virtual bool PrepareListElement( idMenuWidget& widget, const int navIndex );
|
|
|
|
virtual void SetListHeadings( idList< idStr >& list );
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual int GetTotalNumberOfOptions() const;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
idList< idStr, TAG_IDLIB_LIST_MENU > headings;
|
|
|
|
float initialPos;
|
|
|
|
float buttonPos;
|
|
|
|
float leftSpacer;
|
|
|
|
float rightSpacer;
|
|
|
|
float selectedSpacer;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_NavBar
|
|
|
|
|
|
|
|
The nav bar is set up with the main option being at the safe frame line.
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_MenuBar : public idMenuWidget_DynamicList
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
idMenuWidget_MenuBar() :
|
|
|
|
totalWidth( 0.0f ),
|
|
|
|
buttonPos( 0.0f ),
|
2012-11-28 15:47:07 +00:00
|
|
|
rightSpacer( 0.0f )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void Initialize( idMenuHandler* data );
|
|
|
|
virtual void SetButtonSpacing( float rSpace )
|
|
|
|
{
|
|
|
|
rightSpacer = rSpace;
|
|
|
|
}
|
|
|
|
virtual bool PrepareListElement( idMenuWidget& widget, const int navIndex );
|
|
|
|
virtual void SetListHeadings( idList< idStr >& list );
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual int GetTotalNumberOfOptions() const;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
private:
|
2012-11-26 18:58:24 +00:00
|
|
|
|
|
|
|
idList< idStr, TAG_IDLIB_LIST_MENU > headings;
|
|
|
|
float totalWidth;
|
|
|
|
float buttonPos;
|
|
|
|
float rightSpacer;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_PDA_UserData
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_PDA_UserData : public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_PDA_UserData() :
|
|
|
|
pdaIndex( 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
virtual ~idMenuWidget_PDA_UserData() {}
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
int pdaIndex;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_DynamicList
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_ScrollBar : public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_ScrollBar() :
|
2012-11-26 18:58:24 +00:00
|
|
|
yTop( 0.0f ),
|
|
|
|
yBot( 0.0f ),
|
2012-11-28 15:47:07 +00:00
|
|
|
dragging( false )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
virtual void Initialize( idMenuHandler* data );
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual bool HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled = false );
|
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
void CalcTopAndBottom();
|
|
|
|
void CalculatePosition( float x, float y );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
float yTop;
|
|
|
|
float yBot;
|
|
|
|
bool dragging;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_InfoBox
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_InfoBox: public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
idMenuWidget_InfoBox() :
|
2012-11-28 15:47:07 +00:00
|
|
|
scrollbar( NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
virtual void Initialize( idMenuHandler* data );
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual bool HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled = false );
|
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event );
|
|
|
|
void SetHeading( idStr val )
|
|
|
|
{
|
|
|
|
heading = val;
|
|
|
|
}
|
|
|
|
void SetBody( idStr val )
|
|
|
|
{
|
|
|
|
info = val;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
void ResetInfoScroll();
|
|
|
|
void Scroll( int d );
|
|
|
|
int GetScroll();
|
|
|
|
int GetMaxScroll();
|
|
|
|
void SetScroll( int scroll );
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetScrollbar( idMenuWidget_ScrollBar* bar );
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_ScrollBar* scrollbar;
|
2012-11-26 18:58:24 +00:00
|
|
|
idStr heading;
|
|
|
|
idStr info;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_PDA_Objective
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_PDA_Objective: public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
idMenuWidget_PDA_Objective() :
|
2012-11-28 15:47:07 +00:00
|
|
|
pdaIndex( 0 )
|
|
|
|
{
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event );
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
int pdaIndex;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_Shell_SaveInfo
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_Shell_SaveInfo: public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
idMenuWidget_Shell_SaveInfo() :
|
|
|
|
loadIndex( 0 ),
|
2012-11-28 15:47:07 +00:00
|
|
|
forSaveScreen( false )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event );
|
|
|
|
|
|
|
|
void SetForSaveScreen( bool val )
|
|
|
|
{
|
|
|
|
forSaveScreen = val;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
int loadIndex;
|
|
|
|
bool forSaveScreen;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_PDA_AudioFiles
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_PDA_AudioFiles: public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
idMenuWidget_PDA_AudioFiles() :
|
2012-11-28 15:47:07 +00:00
|
|
|
pdaIndex( 0 )
|
|
|
|
{
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual ~idMenuWidget_PDA_AudioFiles();
|
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void Initialize( idMenuHandler* data );
|
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event );
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
int pdaIndex;
|
|
|
|
idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > audioFileNames;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_PDA_AudioFiles
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_PDA_EmailInbox: public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
idMenuWidget_PDA_EmailInbox() :
|
|
|
|
pdaIndex( 0 ),
|
|
|
|
emailList( NULL ),
|
2012-11-28 15:47:07 +00:00
|
|
|
scrollbar( NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void Initialize( idMenuHandler* data );
|
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event );
|
|
|
|
|
|
|
|
idMenuWidget_DynamicList* GetEmailList()
|
|
|
|
{
|
|
|
|
return emailList;
|
|
|
|
}
|
|
|
|
idMenuWidget_ScrollBar* GetScrollbar()
|
|
|
|
{
|
|
|
|
return scrollbar;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_DynamicList* emailList;
|
|
|
|
idMenuWidget_ScrollBar* scrollbar;
|
2012-11-26 18:58:24 +00:00
|
|
|
int pdaIndex;
|
|
|
|
idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > emailInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_PDA_AudioFiles
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_ItemAssignment: public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_ItemAssignment() :
|
|
|
|
slotIndex( 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetIcon( int index, const idMaterial* icon );
|
2012-11-26 18:58:24 +00:00
|
|
|
void FindFreeSpot();
|
2012-11-28 15:47:07 +00:00
|
|
|
int GetSlotIndex()
|
|
|
|
{
|
|
|
|
return slotIndex;
|
|
|
|
}
|
|
|
|
void SetSlotIndex( int num )
|
|
|
|
{
|
|
|
|
slotIndex = num;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
2012-11-28 15:47:07 +00:00
|
|
|
const idMaterial* images[ NUM_QUICK_SLOTS ];
|
2012-11-26 18:58:24 +00:00
|
|
|
int slotIndex;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idMenuWidget_PDA_AudioFiles
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idMenuWidget_PDA_VideoInfo: public idMenuWidget
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
virtual void Update();
|
2012-11-28 15:47:07 +00:00
|
|
|
virtual void ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event );
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
int videoIndex;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idWidgetActionHandler
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idWidgetActionHandler : public idSWFScriptFunction_RefCounted
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
2012-11-28 15:47:07 +00:00
|
|
|
idWidgetActionHandler( idMenuWidget* widget, actionHandler_t actionEventType, widgetEvent_t _event ) :
|
2012-11-26 18:58:24 +00:00
|
|
|
targetWidget( widget ),
|
|
|
|
type( actionEventType ),
|
2012-11-28 15:47:07 +00:00
|
|
|
targetEvent( _event )
|
|
|
|
{
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idSWFScriptVar Call( idSWFScriptObject* thisObject, const idSWFParmList& parms )
|
|
|
|
{
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idWidgetAction action;
|
|
|
|
bool handled = false;
|
2012-11-28 15:47:07 +00:00
|
|
|
switch( type )
|
|
|
|
{
|
|
|
|
case WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_VERTICAL, 1 );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_VERTICAL, -1 );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_VERTICAL_VARIABLE, 1 );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_VERTICAL_VARIABLE, -1 );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_SCROLL_PAGE_DOWN_START_REPEATER:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_PAGE, 1 );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_SCROLL_PAGE_UP_START_REPEATER:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_PAGE, -1 );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_STOP_REPEATER:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_STOP_REPEATER );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_TAB_NEXT:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_SCROLL_TAB, 1 );
|
|
|
|
handled = true;
|
2012-11-26 18:58:24 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_TAB_PREV:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_SCROLL_TAB, -1 );
|
|
|
|
handled = true;
|
2012-11-26 18:58:24 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_JOY3_ON_PRESS:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_JOY3_ON_PRESS );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_HORIZONTAL, -1 );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_HORIZONTAL, 1 );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_DRAG_START:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_SCROLL_DRAG );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_EVENT_DRAG_STOP:
|
|
|
|
{
|
|
|
|
action.Set( ( widgetAction_t )WIDGET_ACTION_EVENT_DRAG_STOP );
|
2012-11-26 18:58:24 +00:00
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( handled )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
targetWidget->HandleAction( action, idWidgetEvent( targetEvent, 0, thisObject, parms ), targetWidget );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
return idSWFScriptVar();
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget* targetWidget;
|
2012-11-26 18:58:24 +00:00
|
|
|
actionHandler_t type;
|
|
|
|
widgetEvent_t targetEvent;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|