A couple of quick fixes for the Map Editor.

This commit is contained in:
spartanj
2011-06-05 04:09:25 -03:00
parent 3f0850c577
commit 05ef7cc0b8
7 changed files with 24 additions and 2 deletions

View File

@@ -269,8 +269,12 @@ void cMapEditor::FillSGCombo() {
std::vector<String> items;
Uint32 Restricted1 = MakeHash( std::string( "global" ) );
Uint32 Restricted2 = MakeHash( mTheme->ShapeGroup()->Name() );
for ( std::list<cShapeGroup*>::iterator it = Res.begin(); it != Res.end(); it++ ) {
items.push_back( reinterpret_cast<cShapeGroup*>( *it )->Name() );
if ( (*it)->Id() != Restricted1 && (*it)->Id() != Restricted2 )
items.push_back( (*it)->Name() );
}
if ( items.size() ) {
@@ -293,7 +297,7 @@ void cMapEditor::FillShapeList() {
std::vector<String> items;
for ( std::list<cShape*>::iterator it = Res.begin(); it != Res.end(); it++ ) {
items.push_back( (*it)->Name() );
items.push_back( (*it)->Name() );
}
if ( items.size() ) {
@@ -322,6 +326,9 @@ void cMapEditor::CreateNewMap() {
}
void cMapEditor::MapCreated() {
mLayerList->ListBox()->Clear();
FillSGCombo();
mMapHScroll->Value( 0 );
mMapVScroll->Value( 0 );
OnMapSizeChange( NULL );

View File

@@ -74,4 +74,7 @@ Uint32 cUIComboBox::OnMouseClick( const eeVector2i& Pos, const Uint32 Flags ) {
return 1;
}
void cUIComboBox::OnControlClear( const cUIEvent *Event ) {
}
}}

View File

@@ -20,6 +20,8 @@ class EE_API cUIComboBox : public cUIDropDownList {
Uint32 OnMouseClick( const eeVector2i& Pos, const Uint32 Flags );
void CreateButton();
virtual void OnControlClear( const cUIEvent *Event );
};
}}

View File

@@ -31,6 +31,7 @@ cUIDropDownList::cUIDropDownList( cUIDropDownList::CreateParams& Params ) :
mListBox->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &cUIDropDownList::OnItemClicked ) );
mListBox->AddEventListener( cUIEvent::EventOnItemKeyDown, cb::Make1( this, &cUIDropDownList::OnItemKeyDown ) );
mListBox->AddEventListener( cUIEvent::EventKeyDown , cb::Make1( this, &cUIDropDownList::OnItemKeyDown ) );
mListBox->AddEventListener( cUIEvent::EventOnControlClear, cb::Make1( this, &cUIDropDownList::OnControlClear ) );
}
cUIDropDownList::~cUIDropDownList() {
@@ -100,6 +101,10 @@ void cUIDropDownList::ShowListBox() {
}
}
void cUIDropDownList::OnControlClear( const cUIEvent * Event ) {
Text( "" );
}
void cUIDropDownList::OnItemKeyDown( const cUIEvent * Event ) {
const cUIEventKey * KEvent = reinterpret_cast<const cUIEventKey*> ( Event );

View File

@@ -55,6 +55,8 @@ class EE_API cUIDropDownList : public cUITextInput {
virtual void OnItemKeyDown( const cUIEvent * Event );
virtual void OnControlClear( const cUIEvent * Event );
Uint32 OnKeyDown( const cUIEventKey &Event );
virtual void OnSizeChange();

View File

@@ -45,6 +45,7 @@ class EE_API cUIEvent {
EventOnWindowMaximizeClick,
EventOnWindowMinimizeClick,
EventOpenFile,
EventOnControlClear,
EventUser,
EventForceDWord = 0xFFFFFFFF
};

View File

@@ -227,6 +227,8 @@ void cUIListBox::Clear() {
UpdateScroll();
FindMaxWidth();
UpdateListBoxItemsSize();
SendCommonEvent( cUIEvent::EventOnControlClear );
}
Uint32 cUIListBox::RemoveListBoxItem( Uint32 ItemIndex ) {