diff --git a/src/base_tab/BaseImportTab.cpp b/src/base_tab/BaseImportTab.cpp index 8396847..9b2f541 100644 --- a/src/base_tab/BaseImportTab.cpp +++ b/src/base_tab/BaseImportTab.cpp @@ -3,7 +3,10 @@ BaseImportTab::BaseImportTab(wxFrame *parent, TabInfos *main_tab): TabBase_TabImport(parent), main_tab(main_tab) { -RefreshImportLists(); + glm=new GameListManager(game_list); + RefreshImportLists(); + this->Bind(wxEVT_BUTTON, &BaseImportTab::OnLoad, this, ID_LOAD_BUTTON); + opened_db_list->SetHint("No other database open"); } void BaseImportTab::RefreshImportLists(){ @@ -22,3 +25,7 @@ void BaseImportTab::RefreshImportLists(){ } } } + +void BaseImportTab::OnLoad(wxCommandEvent &event){ +wxLogDebug("Load!"); +} diff --git a/src/base_tab/BaseImportTab.hpp b/src/base_tab/BaseImportTab.hpp index 7a0237e..a301f9b 100644 --- a/src/base_tab/BaseImportTab.hpp +++ b/src/base_tab/BaseImportTab.hpp @@ -1,9 +1,12 @@ #include "ochess.hpp" +#include "GameListManager.hpp" class BaseImportTab : public TabBase_TabImport { TabInfos *main_tab; + GameListManager *glm; public: BaseImportTab(wxFrame *parent, TabInfos *main_tab); void RefreshImportLists(); + void OnLoad(wxCommandEvent &event); }; \ No newline at end of file diff --git a/src/base_tab/GameListManager.hpp b/src/base_tab/GameListManager.hpp index 5c80a68..c1452cb 100644 --- a/src/base_tab/GameListManager.hpp +++ b/src/base_tab/GameListManager.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "ochess.hpp" #define TERMS_IN(COL) (row.COL.find(terms) != std::string::npos) diff --git a/src/gui.cpp b/src/gui.cpp index b122cb1..c4c3a29 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -594,7 +594,7 @@ TabBase_TabImport::TabBase_TabImport( wxWindow* parent, wxWindowID id, const wxP wxBoxSizer* top_sizer; top_sizer = new wxBoxSizer( wxHORIZONTAL ); - opened_game_list = new wxComboBox( this, wxID_ANY, wxT("No game opened"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + opened_game_list = new wxComboBox( this, wxID_ANY, wxT("No game opened"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); top_sizer->Add( opened_game_list, 100, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); import_from_game_button = new wxButton( this, wxID_ANY, wxT("Import Game"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -620,20 +620,23 @@ TabBase_TabImport::TabBase_TabImport( wxWindow* parent, wxWindowID id, const wxP m_staticText29->Wrap( -1 ); bSizer33->Add( m_staticText29, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - opened_db_list = new wxComboBox( this, wxID_ANY, wxT("No other databases opened"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + opened_db_list = new wxComboBox( this, wxID_ANY, wxT("No other databases opened"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); bSizer33->Add( opened_db_list, 100, wxALL|wxEXPAND, 5 ); - import_from_db_button = new wxButton( this, wxID_ANY, wxT("Import Selection"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer33->Add( import_from_db_button, 0, wxALL, 5 ); + load_button = new wxButton( this, ID_LOAD_BUTTON, wxT("Load"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer33->Add( load_button, 0, wxALL, 5 ); bottom_sizer->Add( bSizer33, 1, wxEXPAND, 5 ); - game_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); + game_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ICON|wxLC_REPORT ); game_list->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTIONTEXT ) ); bottom_sizer->Add( game_list, 20, wxALL|wxEXPAND, 5 ); + import_from_db_button = new wxButton( this, wxID_ANY, wxT("Import Selection"), wxDefaultPosition, wxDefaultSize, 0 ); + bottom_sizer->Add( import_from_db_button, 0, wxALL|wxEXPAND, 5 ); + main_sizer->Add( bottom_sizer, 100, wxEXPAND, 5 ); diff --git a/src/gui.h b/src/gui.h index ddf67e3..232b3e7 100644 --- a/src/gui.h +++ b/src/gui.h @@ -61,6 +61,7 @@ #define ID_APPLY_FILTER_BUTTON 1016 #define ID_IMPORT_BUTTON 1017 #define ID_DELETE_BUTTON 1018 +#define ID_LOAD_BUTTON 1019 /////////////////////////////////////////////////////////////////////////////// /// Class MainFrame @@ -344,8 +345,9 @@ class TabBase_TabImport : public wxPanel wxStaticText* from_db_label; wxStaticText* m_staticText29; wxComboBox* opened_db_list; - wxButton* import_from_db_button; + wxButton* load_button; wxListCtrl* game_list; + wxButton* import_from_db_button; public: diff --git a/tools/wxFrameBuilder.fbp b/tools/wxFrameBuilder.fbp index 2a654ce..b25560c 100644 --- a/tools/wxFrameBuilder.fbp +++ b/tools/wxFrameBuilder.fbp @@ -6018,7 +6018,7 @@ -1 1 - + wxCB_READONLY ; ; forward_declare 0 @@ -6356,7 +6356,7 @@ -1 1 - + wxCB_READONLY ; ; forward_declare 0 @@ -6407,8 +6407,8 @@ 0 0 - wxID_ANY - Import Selection + ID_LOAD_BUTTON + Load 0 @@ -6418,7 +6418,7 @@ 0 1 - import_from_db_button + load_button 1 @@ -6494,7 +6494,80 @@ Resizable 1 - wxLC_ICON + wxLC_ICON|wxLC_REPORT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Import Selection + + 0 + + 0 + + + 0 + + 1 + import_from_db_button + 1 + + + protected + 1 + + + + Resizable + 1 + + ; ; forward_declare 0