MainFrame: update command state on staging selection.
This commit is contained in:
parent
6d0c988487
commit
8bf2866a17
5 changed files with 11 additions and 1 deletions
|
@ -199,6 +199,10 @@ void EvtMainFrame::openSaveDirEvent(wxCommandEvent&) {
|
|||
wxExecute("explorer.exe " + Utility::Directory::toNativeSeparators(_manager.saveDirectory()));
|
||||
}
|
||||
|
||||
void EvtMainFrame::stagingSelectionEvent(wxCommandEvent&) {
|
||||
updateCommandsState();
|
||||
}
|
||||
|
||||
void EvtMainFrame::stagingButtonEvent(wxCommandEvent&) {
|
||||
wxExecute("explorer.exe " + Utility::Directory::toNativeSeparators(_manager.stagingAreaDirectory()));
|
||||
}
|
||||
|
@ -379,10 +383,11 @@ void EvtMainFrame::getActiveSlot() {
|
|||
|
||||
void EvtMainFrame::updateCommandsState() {
|
||||
long selection = _installedListView->GetFirstSelected();
|
||||
int staged_selection = _stagingList->GetSelection();
|
||||
GameState game_state = _manager.gameState();
|
||||
HangarState hangar_state = _manager.hangarState(selection);
|
||||
|
||||
_importButton->Enable(selection != -1 && game_state != GameState::Running);
|
||||
_importButton->Enable(selection != -1 && staged_selection != -1 && game_state != GameState::Running);
|
||||
_exportButton->Enable(selection != -1);
|
||||
_moveButton->Enable(selection != -1 && game_state != GameState::Running && hangar_state != HangarState::Empty && hangar_state != HangarState::Invalid);
|
||||
_deleteButton->Enable(selection != -1 && game_state != GameState::Running && hangar_state != HangarState::Empty);
|
||||
|
|
|
@ -39,6 +39,7 @@ class EvtMainFrame: public MainFrame {
|
|||
void deleteEvent(wxCommandEvent&);
|
||||
void backupEvent(wxCommandEvent&);
|
||||
void openSaveDirEvent(wxCommandEvent&);
|
||||
void stagingSelectionEvent(wxCommandEvent&);
|
||||
void stagingButtonEvent(wxCommandEvent&);
|
||||
void installedSelectionEvent(wxListEvent&);
|
||||
void listColumnDragEvent(wxListEvent&);
|
||||
|
|
|
@ -130,6 +130,7 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co
|
|||
_openSaveDirButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::openSaveDirEvent ), NULL, this );
|
||||
_importButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::importEvent ), NULL, this );
|
||||
_exportButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::exportEvent ), NULL, this );
|
||||
_stagingList->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainFrame::stagingSelectionEvent ), NULL, this );
|
||||
_stagingAreaButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::stagingButtonEvent ), NULL, this );
|
||||
this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( MainFrame::gameCheckTimerEvent ) );
|
||||
}
|
||||
|
@ -143,6 +144,7 @@ MainFrame::~MainFrame()
|
|||
_openSaveDirButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::openSaveDirEvent ), NULL, this );
|
||||
_importButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::importEvent ), NULL, this );
|
||||
_exportButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::exportEvent ), NULL, this );
|
||||
_stagingList->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainFrame::stagingSelectionEvent ), NULL, this );
|
||||
_stagingAreaButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::stagingButtonEvent ), NULL, this );
|
||||
this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( MainFrame::gameCheckTimerEvent ) );
|
||||
|
||||
|
|
|
@ -691,6 +691,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnListBox">stagingSelectionEvent</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
|
|
@ -59,6 +59,7 @@ class MainFrame : public wxFrame
|
|||
virtual void openSaveDirEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void importEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void exportEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void stagingSelectionEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void stagingButtonEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void gameCheckTimerEvent( wxTimerEvent& event ) { event.Skip(); }
|
||||
|
||||
|
|
Loading…
Reference in a new issue