mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
GUI List Box items => plString
This commit is contained in:
@ -1152,23 +1152,12 @@ void pfGUIListBoxMod::ClearAllElements( void )
|
||||
HandleExtendedEvent( pfGUIListBoxMod::kListCleared );
|
||||
}
|
||||
|
||||
uint16_t pfGUIListBoxMod::AddString( const char *string )
|
||||
uint16_t pfGUIListBoxMod::AddString( const plString &string )
|
||||
{
|
||||
return AddElement( new pfGUIListText( string ) );
|
||||
}
|
||||
|
||||
uint16_t pfGUIListBoxMod::AddString( const wchar_t *string )
|
||||
{
|
||||
return AddElement( new pfGUIListText( string ) );
|
||||
}
|
||||
|
||||
int16_t pfGUIListBoxMod::FindString( const char *toCompareTo )
|
||||
{
|
||||
pfGUIListText text( toCompareTo );
|
||||
return FindElement( &text );
|
||||
}
|
||||
|
||||
int16_t pfGUIListBoxMod::FindString( const wchar_t *toCompareTo )
|
||||
int16_t pfGUIListBoxMod::FindString( const plString &toCompareTo )
|
||||
{
|
||||
pfGUIListText text( toCompareTo );
|
||||
return FindElement( &text );
|
||||
|
@ -186,10 +186,8 @@ class pfGUIListBoxMod : public pfGUIControlMod
|
||||
uint16_t GetNumElements( void );
|
||||
pfGUIListElement *GetElement( uint16_t idx );
|
||||
|
||||
uint16_t AddString( const char *string );
|
||||
uint16_t AddString( const wchar_t *string );
|
||||
int16_t FindString( const char *toCompareTo );
|
||||
int16_t FindString( const wchar_t *toCompareTo );
|
||||
uint16_t AddString( const plString &string );
|
||||
int16_t FindString( const plString &toCompareTo );
|
||||
|
||||
// Export only
|
||||
void SetScrollCtrl( pfGUIValueCtrl *ctrl ) { fScrollControl = ctrl; }
|
||||
|
@ -77,28 +77,14 @@ void pfGUIListElement::Write( hsStream *s, hsResMgr *mgr )
|
||||
|
||||
//// Constructor/Destructor //////////////////////////////////////////////////
|
||||
|
||||
pfGUIListText::pfGUIListText() : pfGUIListElement( kText )
|
||||
pfGUIListText::pfGUIListText()
|
||||
: pfGUIListElement(kText), fJustify(kLeftJustify)
|
||||
{
|
||||
fText = nil;
|
||||
fJustify = kLeftJustify;
|
||||
}
|
||||
|
||||
pfGUIListText::pfGUIListText( const char *text ) : pfGUIListElement( kText )
|
||||
pfGUIListText::pfGUIListText( const plString &text )
|
||||
: pfGUIListElement(kText), fText(text), fJustify(kLeftJustify)
|
||||
{
|
||||
fText = hsStringToWString(text);
|
||||
fJustify = kLeftJustify;
|
||||
}
|
||||
|
||||
pfGUIListText::pfGUIListText( const wchar_t *text ) : pfGUIListElement( kText )
|
||||
{
|
||||
fText = new wchar_t[ wcslen( text ) + 1 ];
|
||||
wcscpy( fText, text );
|
||||
fJustify = kLeftJustify;
|
||||
}
|
||||
|
||||
pfGUIListText::~pfGUIListText()
|
||||
{
|
||||
delete [] fText;
|
||||
}
|
||||
|
||||
//// Virtuals ////////////////////////////////////////////////////////////////
|
||||
@ -107,18 +93,14 @@ void pfGUIListText::Read( hsStream *s, hsResMgr *mgr )
|
||||
{
|
||||
pfGUIListElement::Read( s, mgr );
|
||||
|
||||
char *text = s->ReadSafeString();
|
||||
fText = hsStringToWString(text);
|
||||
delete [] text;
|
||||
fText = s->ReadSafeString_TEMP();
|
||||
}
|
||||
|
||||
void pfGUIListText::Write( hsStream *s, hsResMgr *mgr )
|
||||
{
|
||||
pfGUIListElement::Write( s, mgr );
|
||||
|
||||
char *text = hsWStringToString(fText);
|
||||
s->WriteSafeString(text);
|
||||
delete [] text;
|
||||
s->WriteSafeString(fText);
|
||||
}
|
||||
|
||||
bool pfGUIListText::Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight )
|
||||
@ -158,26 +140,7 @@ int pfGUIListText::CompareTo( pfGUIListElement *rightSide )
|
||||
if( text->fType != kText )
|
||||
return -2;
|
||||
|
||||
return wcscmp( GetText(), text->GetText() );
|
||||
}
|
||||
|
||||
void pfGUIListText::SetText( const char *text )
|
||||
{
|
||||
wchar_t *wText = hsStringToWString(text);
|
||||
SetText(wText);
|
||||
delete [] wText;
|
||||
}
|
||||
|
||||
void pfGUIListText::SetText( const wchar_t *text )
|
||||
{
|
||||
delete [] fText;
|
||||
if( text != nil )
|
||||
{
|
||||
fText = new wchar_t[ wcslen( text ) + 1 ];
|
||||
wcscpy( fText, text );
|
||||
}
|
||||
else
|
||||
fText = nil;
|
||||
return GetText().Compare(text->GetText());
|
||||
}
|
||||
|
||||
void pfGUIListText::SetJustify( JustifyTypes justify )
|
||||
@ -295,26 +258,14 @@ int pfGUIListPicture::CompareTo( pfGUIListElement *rightSide )
|
||||
|
||||
//// Constructor/Destructor //////////////////////////////////////////////////
|
||||
|
||||
pfGUIListTreeRoot::pfGUIListTreeRoot() : pfGUIListElement( kTreeRoot )
|
||||
pfGUIListTreeRoot::pfGUIListTreeRoot()
|
||||
: pfGUIListElement(kTreeRoot), fShowChildren(true)
|
||||
{
|
||||
fText = nil;
|
||||
fShowChildren = true;
|
||||
}
|
||||
|
||||
pfGUIListTreeRoot::pfGUIListTreeRoot( const char *text ) : pfGUIListElement( kTreeRoot )
|
||||
pfGUIListTreeRoot::pfGUIListTreeRoot( const plString &text )
|
||||
: pfGUIListElement(kTreeRoot), fText(text)
|
||||
{
|
||||
fText = hsStringToWString(text);
|
||||
}
|
||||
|
||||
pfGUIListTreeRoot::pfGUIListTreeRoot( const wchar_t *text ) : pfGUIListElement( kTreeRoot )
|
||||
{
|
||||
fText = new wchar_t[ wcslen( text ) + 1 ];
|
||||
wcscpy( fText, text );
|
||||
}
|
||||
|
||||
pfGUIListTreeRoot::~pfGUIListTreeRoot()
|
||||
{
|
||||
delete [] fText;
|
||||
}
|
||||
|
||||
//// Virtuals ////////////////////////////////////////////////////////////////
|
||||
@ -323,18 +274,14 @@ void pfGUIListTreeRoot::Read( hsStream *s, hsResMgr *mgr )
|
||||
{
|
||||
pfGUIListElement::Read( s, mgr );
|
||||
|
||||
char *temp = s->ReadSafeString();
|
||||
fText = hsStringToWString(temp);
|
||||
delete [] temp;
|
||||
fText = s->ReadSafeString_TEMP();
|
||||
}
|
||||
|
||||
void pfGUIListTreeRoot::Write( hsStream *s, hsResMgr *mgr )
|
||||
{
|
||||
pfGUIListElement::Write( s, mgr );
|
||||
|
||||
char *temp = hsWStringToString(fText);
|
||||
s->WriteSafeString( temp );
|
||||
delete [] temp;
|
||||
s->WriteSafeString(fText);
|
||||
}
|
||||
|
||||
bool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight )
|
||||
@ -416,26 +363,7 @@ int pfGUIListTreeRoot::CompareTo( pfGUIListElement *rightSide )
|
||||
if( text->fType != kTreeRoot )
|
||||
return -2;
|
||||
|
||||
return wcscmp( GetTitle(), text->GetTitle() );
|
||||
}
|
||||
|
||||
void pfGUIListTreeRoot::SetTitle( const char *text )
|
||||
{
|
||||
wchar_t *wText = hsStringToWString(text);
|
||||
SetTitle(wText);
|
||||
delete [] wText;
|
||||
}
|
||||
|
||||
void pfGUIListTreeRoot::SetTitle( const wchar_t *text )
|
||||
{
|
||||
delete [] fText;
|
||||
if( text != nil )
|
||||
{
|
||||
fText = new wchar_t[ wcslen( text ) + 1 ];
|
||||
wcscpy( fText, text );
|
||||
}
|
||||
else
|
||||
fText = nil;
|
||||
return GetTitle().Compare(text->GetTitle());
|
||||
}
|
||||
|
||||
void pfGUIListTreeRoot::AddChild( pfGUIListElement *el )
|
||||
|
@ -118,15 +118,13 @@ class pfGUIListText : public pfGUIListElement
|
||||
|
||||
protected:
|
||||
|
||||
wchar_t *fText;
|
||||
uint8_t fJustify; // This is not our JustifyTypes, but from plDynamicTextMap
|
||||
plString fText;
|
||||
uint8_t fJustify; // This is not our JustifyTypes, but from plDynamicTextMap
|
||||
|
||||
public:
|
||||
|
||||
pfGUIListText();
|
||||
pfGUIListText( const char *text );
|
||||
pfGUIListText( const wchar_t *text );
|
||||
virtual ~pfGUIListText();
|
||||
pfGUIListText( const plString &text );
|
||||
|
||||
virtual void Read( hsStream *s, hsResMgr *mgr );
|
||||
virtual void Write( hsStream *s, hsResMgr *mgr );
|
||||
@ -139,9 +137,8 @@ class pfGUIListText : public pfGUIListElement
|
||||
virtual void SetJustify( JustifyTypes justify );
|
||||
|
||||
// These two are virtual so we can derive and override them
|
||||
virtual const wchar_t *GetText( void ) { return fText; }
|
||||
virtual void SetText( const char *text );
|
||||
virtual void SetText( const wchar_t *text );
|
||||
virtual plString GetText() const { return fText; }
|
||||
virtual void SetText(const plString &text) { fText = text; }
|
||||
};
|
||||
|
||||
class pfGUIListPicture : public pfGUIListElement
|
||||
@ -176,7 +173,7 @@ class pfGUIListTreeRoot : public pfGUIListElement
|
||||
{
|
||||
protected:
|
||||
|
||||
wchar_t *fText;
|
||||
plString fText;
|
||||
bool fShowChildren;
|
||||
|
||||
hsTArray<pfGUIListElement *> fChildren;
|
||||
@ -184,9 +181,7 @@ class pfGUIListTreeRoot : public pfGUIListElement
|
||||
public:
|
||||
|
||||
pfGUIListTreeRoot();
|
||||
pfGUIListTreeRoot( const char *text );
|
||||
pfGUIListTreeRoot( const wchar_t *text );
|
||||
virtual ~pfGUIListTreeRoot();
|
||||
pfGUIListTreeRoot( const plString &text );
|
||||
|
||||
virtual void Read( hsStream *s, hsResMgr *mgr );
|
||||
virtual void Write( hsStream *s, hsResMgr *mgr );
|
||||
@ -197,11 +192,10 @@ class pfGUIListTreeRoot : public pfGUIListElement
|
||||
|
||||
virtual bool MouseClicked( uint16_t localX, uint16_t localY );
|
||||
|
||||
const wchar_t *GetTitle( void ) { return fText; }
|
||||
void SetTitle( const char *text );
|
||||
void SetTitle( const wchar_t *text );
|
||||
const plString GetTitle() const { return fText; }
|
||||
void SetTitle(const plString &text) { fText = text; }
|
||||
|
||||
uint32_t GetNumChildren( void ) const { return fChildren.GetCount(); }
|
||||
uint32_t GetNumChildren() const { return fChildren.GetCount(); }
|
||||
pfGUIListElement *GetChild( uint32_t i ) const { return fChildren[ i ]; }
|
||||
|
||||
void AddChild( pfGUIListElement *el );
|
||||
|
Reference in New Issue
Block a user