2005-02-11 07:50:26 +00:00
|
|
|
/* OptionRow - One line in ScreenOptions. */
|
|
|
|
|
|
|
|
|
|
#ifndef OptionRow_H
|
|
|
|
|
#define OptionRow_H
|
|
|
|
|
|
|
|
|
|
#include "ActorFrame.h"
|
|
|
|
|
#include "BitmapText.h"
|
|
|
|
|
#include "OptionsCursor.h"
|
2008-04-27 21:31:56 +00:00
|
|
|
#include "ModIcon.h"
|
2005-02-19 19:17:28 +00:00
|
|
|
#include "ThemeMetric.h"
|
2005-07-16 07:01:48 +00:00
|
|
|
#include "AutoActor.h"
|
2005-02-11 07:50:26 +00:00
|
|
|
|
2005-02-24 13:48:14 +00:00
|
|
|
class OptionRowHandler;
|
2005-07-16 07:01:48 +00:00
|
|
|
class GameCommand;
|
2006-09-01 04:37:39 +00:00
|
|
|
struct OptionRowDefinition;
|
2005-02-11 07:50:26 +00:00
|
|
|
|
2005-07-16 02:51:17 +00:00
|
|
|
class OptionRowType
|
|
|
|
|
{
|
|
|
|
|
public:
|
2008-05-05 22:37:57 +00:00
|
|
|
void Load( const RString &sMetricsGroup, Actor *pParent );
|
2005-07-16 02:51:17 +00:00
|
|
|
|
2005-07-16 03:23:53 +00:00
|
|
|
private:
|
2008-05-10 21:52:08 +00:00
|
|
|
RString m_sMetricsGroup;
|
2005-07-16 07:01:48 +00:00
|
|
|
|
2008-05-10 21:52:08 +00:00
|
|
|
BitmapText m_textItem;
|
|
|
|
|
OptionsCursor m_Underline[NUM_PLAYERS];
|
|
|
|
|
AutoActor m_sprFrame;
|
|
|
|
|
BitmapText m_textTitle;
|
2008-04-27 21:31:56 +00:00
|
|
|
ModIcon m_ModIcon;
|
2005-07-16 03:23:53 +00:00
|
|
|
|
2006-01-16 04:02:19 +00:00
|
|
|
ThemeMetric<float> ITEMS_START_X;
|
|
|
|
|
ThemeMetric<float> ITEMS_END_X;
|
|
|
|
|
ThemeMetric<float> ITEMS_GAP_X;
|
2006-03-06 04:29:33 +00:00
|
|
|
ThemeMetric<float> ITEMS_MIN_BASE_ZOOM;
|
2006-01-16 04:02:19 +00:00
|
|
|
ThemeMetric1D<float> ITEMS_LONG_ROW_X;
|
|
|
|
|
ThemeMetric<float> ITEMS_LONG_ROW_SHARED_X;
|
2008-04-27 21:31:56 +00:00
|
|
|
ThemeMetric1D<float> MOD_ICON_X;
|
2006-01-16 04:02:19 +00:00
|
|
|
ThemeMetric<RageColor> COLOR_SELECTED;
|
|
|
|
|
ThemeMetric<RageColor> COLOR_NOT_SELECTED;
|
|
|
|
|
ThemeMetric<RageColor> COLOR_DISABLED;
|
|
|
|
|
ThemeMetric<float> TWEEN_SECONDS;
|
|
|
|
|
ThemeMetric<bool> SHOW_BPM_IN_SPEED_TITLE;
|
2008-04-27 21:31:56 +00:00
|
|
|
ThemeMetric<bool> SHOW_MOD_ICONS;
|
2006-01-16 04:02:19 +00:00
|
|
|
ThemeMetric<bool> SHOW_UNDERLINES;
|
2008-04-27 21:31:56 +00:00
|
|
|
ThemeMetric<RString> MOD_ICON_METRICS_GROUP;
|
2005-07-16 03:23:53 +00:00
|
|
|
|
|
|
|
|
friend class OptionRow;
|
2005-07-16 02:51:17 +00:00
|
|
|
};
|
|
|
|
|
|
2005-02-11 07:50:26 +00:00
|
|
|
class OptionRow : public ActorFrame
|
|
|
|
|
{
|
|
|
|
|
public:
|
2005-07-16 02:51:17 +00:00
|
|
|
OptionRow( const OptionRowType *pType );
|
2005-02-11 07:50:26 +00:00
|
|
|
~OptionRow();
|
2006-02-27 03:04:56 +00:00
|
|
|
void Update( float fDeltaTime );
|
2005-02-14 01:29:25 +00:00
|
|
|
|
2005-02-24 01:17:39 +00:00
|
|
|
void Clear();
|
2006-01-17 21:40:39 +00:00
|
|
|
void LoadNormal( OptionRowHandler *pHand, bool bFirstItemGoesDown );
|
2005-02-25 16:48:54 +00:00
|
|
|
void LoadExit();
|
2005-07-16 07:01:48 +00:00
|
|
|
|
2008-04-27 21:31:56 +00:00
|
|
|
void SetModIcon( PlayerNumber pn, const RString &sText, GameCommand &gc );
|
2005-02-19 19:17:28 +00:00
|
|
|
|
2005-04-03 06:21:02 +00:00
|
|
|
void ImportOptions( const vector<PlayerNumber> &vpns );
|
|
|
|
|
int ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocus[NUM_PLAYERS] );
|
2005-02-25 05:45:16 +00:00
|
|
|
|
2008-04-27 04:36:59 +00:00
|
|
|
enum RowType
|
|
|
|
|
{
|
|
|
|
|
RowType_Normal,
|
|
|
|
|
RowType_Exit
|
|
|
|
|
};
|
|
|
|
|
void InitText( RowType type );
|
2006-01-19 01:52:18 +00:00
|
|
|
void AfterImportOptions( PlayerNumber pn );
|
2005-02-19 19:17:28 +00:00
|
|
|
|
2008-04-27 04:36:59 +00:00
|
|
|
void ChoicesChanged( RowType type );
|
2005-03-13 02:15:38 +00:00
|
|
|
void PositionUnderlines( PlayerNumber pn );
|
2006-02-03 09:31:51 +00:00
|
|
|
void PositionIcons( PlayerNumber pn );
|
2006-01-19 01:01:13 +00:00
|
|
|
void UpdateText( PlayerNumber pn );
|
2006-01-15 23:33:29 +00:00
|
|
|
void SetRowHasFocus( PlayerNumber pn, bool bRowHasFocus );
|
2005-02-26 09:42:36 +00:00
|
|
|
void UpdateEnabledDisabled();
|
2005-02-19 19:17:28 +00:00
|
|
|
|
|
|
|
|
int GetOneSelection( PlayerNumber pn, bool bAllowFail=false ) const;
|
2005-03-20 06:41:56 +00:00
|
|
|
int GetOneSharedSelection( bool bAllowFail=false ) const;
|
2005-02-19 19:17:28 +00:00
|
|
|
void SetOneSelection( PlayerNumber pn, int iChoice );
|
|
|
|
|
void SetOneSharedSelection( int iChoice );
|
2006-01-22 01:00:06 +00:00
|
|
|
void SetOneSharedSelectionIfPresent( const RString &sChoice );
|
2005-02-19 19:17:28 +00:00
|
|
|
|
2005-06-28 08:11:30 +00:00
|
|
|
int GetChoiceInRowWithFocus( PlayerNumber pn ) const;
|
|
|
|
|
int GetChoiceInRowWithFocusShared() const;
|
|
|
|
|
void SetChoiceInRowWithFocus( PlayerNumber pn, int iChoice );
|
2006-01-19 00:29:22 +00:00
|
|
|
void ResetFocusFromSelection( PlayerNumber pn );
|
2005-06-28 08:11:30 +00:00
|
|
|
|
2006-01-17 22:16:58 +00:00
|
|
|
bool GetSelected( PlayerNumber pn, int iChoice ) const;
|
|
|
|
|
void SetSelected( PlayerNumber pn, int iChoice, bool b );
|
2005-02-19 19:17:28 +00:00
|
|
|
|
2006-01-17 22:16:58 +00:00
|
|
|
const OptionRowDefinition &GetRowDef() const;
|
|
|
|
|
OptionRowDefinition &GetRowDef();
|
2005-02-24 13:48:14 +00:00
|
|
|
RowType GetRowType() const { return m_RowType; }
|
2006-01-16 19:58:22 +00:00
|
|
|
const OptionRowHandler *GetHandler() const { return m_pHand; }
|
2005-02-19 19:17:28 +00:00
|
|
|
|
2006-01-15 07:12:05 +00:00
|
|
|
const BitmapText &GetTextItemForRow( PlayerNumber pn, int iChoiceOnRow ) const;
|
|
|
|
|
void GetWidthXY( PlayerNumber pn, int iChoiceOnRow, int &iWidthOut, int &iXOut, int &iYOut ) const;
|
2005-02-19 19:17:28 +00:00
|
|
|
|
2005-08-15 07:51:16 +00:00
|
|
|
// ScreenOptions calls positions m_FrameDestination, then m_Frame tween to that same TweenState.
|
2006-01-15 07:10:05 +00:00
|
|
|
unsigned GetTextItemsSize() const { return m_textItems.size(); }
|
|
|
|
|
bool GetFirstItemGoesDown() const { return m_bFirstItemGoesDown; }
|
2005-02-19 19:17:28 +00:00
|
|
|
|
2006-09-01 04:44:30 +00:00
|
|
|
RString GetThemedItemText( int iChoice ) const;
|
2005-03-21 00:19:34 +00:00
|
|
|
|
2006-01-22 01:00:06 +00:00
|
|
|
void SetExitText( RString sExitText );
|
2005-02-19 19:17:28 +00:00
|
|
|
|
2006-01-18 01:34:45 +00:00
|
|
|
void Reload();
|
2005-02-24 15:40:05 +00:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Messages
|
|
|
|
|
//
|
2006-11-13 23:11:25 +00:00
|
|
|
virtual void HandleMessage( const Message &msg );
|
2005-02-24 15:40:05 +00:00
|
|
|
|
2005-02-19 19:17:28 +00:00
|
|
|
protected:
|
2006-01-22 01:00:06 +00:00
|
|
|
RString GetRowTitle() const;
|
2005-07-15 23:31:58 +00:00
|
|
|
|
2008-04-27 21:31:56 +00:00
|
|
|
const OptionRowType *m_pParentType;
|
|
|
|
|
RowType m_RowType;
|
|
|
|
|
OptionRowHandler* m_pHand;
|
2005-07-16 02:51:17 +00:00
|
|
|
|
2008-04-27 21:31:56 +00:00
|
|
|
ActorFrame m_Frame;
|
2005-07-16 02:51:17 +00:00
|
|
|
|
2008-04-27 21:31:56 +00:00
|
|
|
vector<BitmapText *> m_textItems; // size depends on m_bRowIsLong and which players are joined
|
|
|
|
|
vector<OptionsCursor *> m_Underline[NUM_PLAYERS]; // size depends on m_bRowIsLong and which players are joined
|
2005-07-16 07:01:48 +00:00
|
|
|
|
2008-04-27 21:31:56 +00:00
|
|
|
Actor *m_sprFrame;
|
|
|
|
|
BitmapText *m_textTitle;
|
|
|
|
|
ModIcon *m_ModIcons[NUM_PLAYERS];
|
2005-07-16 02:51:17 +00:00
|
|
|
|
2008-04-27 21:31:56 +00:00
|
|
|
bool m_bFirstItemGoesDown;
|
|
|
|
|
bool m_bRowHasFocus[NUM_PLAYERS];
|
2005-02-11 07:50:26 +00:00
|
|
|
|
2008-04-27 21:31:56 +00:00
|
|
|
int m_iChoiceInRowWithFocus[NUM_PLAYERS]; // this choice has input focus
|
2006-01-17 22:16:58 +00:00
|
|
|
// Only one will true at a time if m_pHand->m_Def.bMultiSelect
|
2008-04-27 21:31:56 +00:00
|
|
|
vector<bool> m_vbSelected[NUM_PLAYERS]; // size = m_pHand->m_Def.choices.size()
|
|
|
|
|
Actor::TweenState m_tsDestination; // this should approach m_tsDestination.
|
2005-02-26 11:19:19 +00:00
|
|
|
|
2005-09-03 17:37:42 +00:00
|
|
|
public:
|
2006-02-10 04:33:54 +00:00
|
|
|
void SetDestination( Actor::TweenState &ts, bool bTween );
|
2005-02-11 07:50:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 Chris Danford
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|