From bdfc577a3b8c360d48c4d094d532786de44c5aed Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 24 Feb 2022 10:18:02 +0100 Subject: [PATCH] Start BaseTab design --- src/MainWindow.cpp | 6 + src/MainWindow.hpp | 1 + src/base_tab/BasePanelBF.cpp | 55 ++++ src/base_tab/BasePanelBF.h | 52 +++ src/base_tab/BaseTab.cpp | 0 src/base_tab/BaseTab.hpp | 12 + src/ochess.hpp | 2 +- tools/wxframebuilder/BasePanel.fbp | 491 +++++++++++++++++++++++++++++ 8 files changed, 618 insertions(+), 1 deletion(-) create mode 100644 src/base_tab/BasePanelBF.cpp create mode 100644 src/base_tab/BasePanelBF.h create mode 100644 src/base_tab/BaseTab.cpp create mode 100644 src/base_tab/BaseTab.hpp create mode 100644 tools/wxframebuilder/BasePanel.fbp diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 83fd964..0a79bc2 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -43,6 +43,12 @@ MainWindow::MainWindow() notebook = new wxAuiNotebook(this, wxID_ANY); NewGame(new Game()); + // Test base tab + BaseTab *bt = new BaseTab((wxFrame *)notebook); + bt->SetLabel("New Base"); + notebook->AddPage(bt, bt->GetLabel()); + notebook->SetSelection(notebook->GetPageIndex(bt)); + Bind(wxEVT_AUINOTEBOOK_PAGE_CHANGED, &MainWindow::OnPageChange, this, wxID_ANY); Bind(REFRESH_TAB_TITLE, &MainWindow::OnRefreshTabTitle, this, wxID_ANY); diff --git a/src/MainWindow.hpp b/src/MainWindow.hpp index 31e63d8..87cf015 100644 --- a/src/MainWindow.hpp +++ b/src/MainWindow.hpp @@ -1,4 +1,5 @@ #include "game_tab/GameTab.hpp" +#include "base_tab/BaseTab.hpp" #include "ochess.hpp" #include #include diff --git a/src/base_tab/BasePanelBF.cpp b/src/base_tab/BasePanelBF.cpp new file mode 100644 index 0000000..4edf8b0 --- /dev/null +++ b/src/base_tab/BasePanelBF.cpp @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 3.10.1-40-g8042f487) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "BasePanelBF.h" + +/////////////////////////////////////////////////////////////////////////// + +BasePanelBF::BasePanelBF( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + wxBoxSizer* main_sizer; + main_sizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* top_sizer; + top_sizer = new wxBoxSizer( wxHORIZONTAL ); + + current_base_label = new wxStaticText( this, wxID_ANY, wxT("Current base:"), wxDefaultPosition, wxDefaultSize, 0 ); + current_base_label->Wrap( -1 ); + top_sizer->Add( current_base_label, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + current_base = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + top_sizer->Add( current_base, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + open_button = new wxButton( this, wxID_ANY, wxT("Open"), wxDefaultPosition, wxDefaultSize, 0 ); + top_sizer->Add( open_button, 0, wxALL, 5 ); + + save_as_button = new wxButton( this, wxID_ANY, wxT("Save as"), wxDefaultPosition, wxDefaultSize, 0 ); + top_sizer->Add( save_as_button, 0, wxALL, 5 ); + + + main_sizer->Add( top_sizer, 0, wxEXPAND, 5 ); + + game_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxLC_ICON ); + main_sizer->Add( game_list, 1, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bottom_sizer; + bottom_sizer = new wxBoxSizer( wxHORIZONTAL ); + + delete_button = new wxButton( this, wxID_ANY, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); + bottom_sizer->Add( delete_button, 0, wxALL, 5 ); + + + main_sizer->Add( bottom_sizer, 0, wxEXPAND, 5 ); + + + this->SetSizer( main_sizer ); + this->Layout(); +} + +BasePanelBF::~BasePanelBF() +{ +} diff --git a/src/base_tab/BasePanelBF.h b/src/base_tab/BasePanelBF.h new file mode 100644 index 0000000..4e0e107 --- /dev/null +++ b/src/base_tab/BasePanelBF.h @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 3.10.1-40-g8042f487) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class BasePanelBF +/////////////////////////////////////////////////////////////////////////////// +class BasePanelBF : public wxPanel +{ + private: + + protected: + wxStaticText* current_base_label; + wxTextCtrl* current_base; + wxButton* open_button; + wxButton* save_as_button; + wxListCtrl* game_list; + wxButton* delete_button; + + public: + + BasePanelBF( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 884,624 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + ~BasePanelBF(); + +}; + diff --git a/src/base_tab/BaseTab.cpp b/src/base_tab/BaseTab.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/base_tab/BaseTab.hpp b/src/base_tab/BaseTab.hpp new file mode 100644 index 0000000..56d254c --- /dev/null +++ b/src/base_tab/BaseTab.hpp @@ -0,0 +1,12 @@ + + +#include "BasePanelBF.h" + +class BaseTab : public BasePanelBF, public TabInfos { + +public: + BaseTab(wxFrame *parent) : BasePanelBF(parent),TabInfos(TabInfos::BASE) {} + void ApplyPreferences(){ + + } +}; \ No newline at end of file diff --git a/src/ochess.hpp b/src/ochess.hpp index 687d44f..3869d99 100644 --- a/src/ochess.hpp +++ b/src/ochess.hpp @@ -50,7 +50,7 @@ void Abort(std::string msg); */ class TabInfos { public: - typedef enum Type { GAME, NONE } Type; + typedef enum Type { GAME, BASE,NONE } Type; Type type; TabInfos(Type type_) : type(type_) {} virtual void ApplyPreferences() = 0; diff --git a/tools/wxframebuilder/BasePanel.fbp b/tools/wxframebuilder/BasePanel.fbp new file mode 100644 index 0000000..ca01e99 --- /dev/null +++ b/tools/wxframebuilder/BasePanel.fbp @@ -0,0 +1,491 @@ + + + + + ; + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + BasePanelBF + 1000 + none + + + 0 + BasePanelBF + + ../../src/base_tab/ + + 1 + 1 + 1 + 1 + UI + 0 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 1 + impl_virtual + + + 0 + wxID_ANY + + + BasePanelBF + + 884,624 + ; ; forward_declare + + 0 + + + wxTAB_TRAVERSAL + + + main_sizer + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + top_sizer + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Current base: + 0 + + 0 + + + 0 + + 1 + current_base_label + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + current_base + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Open + + 0 + + 0 + + + 0 + + 1 + open_button + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Save as + + 0 + + 0 + + + 0 + + 1 + save_as_button + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + game_list + 1 + + + protected + 1 + + Resizable + 1 + -1,-1 + wxLC_ICON + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 0 + + + bottom_sizer + wxHORIZONTAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Delete + + 0 + + 0 + + + 0 + + 1 + delete_button + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + +