Room selection wheel

This commit is contained in:
Josh Allen
2005-05-03 01:32:19 +00:00
parent f6f6302893
commit 451cb29b68
2 changed files with 171 additions and 0 deletions
+102
View File
@@ -0,0 +1,102 @@
#include "global.h"
#include "RoomWheel.h"
#include "RageLog.h"
void RoomWheel::Load( CString sType )
{
LOG->Trace( "RoomWheel::Load('%s')", sType.c_str() );
LoadFromMetrics( sType );
LoadVariables();
FOREACH( WheelItemBase*, m_WheelBaseItems, i )
SAFE_DELETE( *i );
m_WheelBaseItems.clear();
for( int i=0; i<NUM_WHEEL_ITEMS; i++ )
{
m_WheelBaseItems.push_back( new RoomWheelItem );
}
m_WheelState = STATE_SELECTING_GENERIC;
BuildWheelItemsData(m_WheelBaseItemsData);
RebuildWheelItems();
}
RoomWheelData::RoomWheelData(WheelItemType wit, CString sTitle, CString sDesc, RageColor color )
:WheelItemBaseData(wit, sTitle, color)
{
m_sDesc = sDesc;
}
RoomWheelItem::RoomWheelItem(CString sType)
:WheelItemBase(sType)
{
SetName(sType);
Load(sType);
}
void RoomWheelItem::Load(CString sType)
{
DESC_X .Load(sType,"DescX");
DESC_Y .Load(sType,"DescY");
DESC_WIDTH .Load(sType,"DescWidth");
DESC_ON_COMMAND .Load(sType,"DescOnCommand");
m_text.SetHorizAlignString("left");
TEXT_WIDTH .Load(sType,"TextWidth");
m_text.SetMaxWidth(TEXT_WIDTH);
m_Desc.LoadFromFont( THEME->GetPathF("RoomWheel","text") );
m_Desc.SetHorizAlignString("left");
m_Desc.SetShadowLength( 0 );
m_Desc.SetMaxWidth(DESC_WIDTH);
m_Desc.SetXY( DESC_X, DESC_Y);
m_Desc.RunCommands( DESC_ON_COMMAND );
this->AddChild( &m_Desc );
}
void RoomWheel::BuildWheelItemsData( vector<WheelItemBaseData*> &arrayWheelItemDatas )
{
if( arrayWheelItemDatas.empty() )
{
arrayWheelItemDatas.push_back( new RoomWheelData(TYPE_GENERIC, "- EMPTY -", "", RageColor(1,0,0,1)) );
}
}
void RoomWheelItem::LoadFromWheelItemBaseData(WheelItemBaseData* pWID)
{
RoomWheelData* tmpdata = (RoomWheelData*)pWID;
WheelItemBase::LoadFromWheelItemBaseData(pWID);
m_Desc.SetText(tmpdata->m_sDesc);
m_Desc.SetDiffuseColor(tmpdata->m_color);
m_text.SetDiffuseColor(tmpdata->m_color);
}
/*
* (c) 2004 Josh Allen
* 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.
*/
+69
View File
@@ -0,0 +1,69 @@
/* RoomWheel - A wheel containing data about rooms. */
#ifndef ROOMWHEEL_H
#define ROOMWHEEL_H
#include "WheelBase.h"
#include "WheelItemBase.h"
#include "ThemeMetric.h"
struct RoomWheelData : public WheelItemBaseData
{
RoomWheelData() { WheelItemBaseData::WheelItemBaseData(); }
RoomWheelData( WheelItemType wit, CString title, CString SubTitle, RageColor color );
CString m_sDesc;
RageColor m_color; // either text color or section background color
WheelNotifyIcon::Flags m_Flags;
};
class RoomWheelItem : public WheelItemBase
{
public:
RoomWheelItem(CString sType = "RoomWheelItem");
RoomWheelData* data;
void Load( CString sType );
virtual void LoadFromWheelItemBaseData(WheelItemBaseData* pWID);
BitmapText m_Desc;
ThemeMetric<float> DESC_X;
ThemeMetric<float> DESC_Y;
ThemeMetric<float> DESC_WIDTH;
ThemeMetric<apActorCommands> DESC_ON_COMMAND;
};
class RoomWheel : public WheelBase {
public:
virtual void Load( CString sType );
inline virtual RoomWheelData* GetItem(unsigned int i) { return (RoomWheelData*)WheelBase::GetItem(i); }
virtual void BuildWheelItemsData( vector<WheelItemBaseData*> &arrayWheelItemDatas );
protected:
};
#endif
/*
* (c) 2004 Josh Allen
* 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.
*/