speciesgen/include/gui/stages_panel.h

144 lines
4.2 KiB
C++

/*
speciesgen
Copyright (C) 2022-2023 prisixia
This file is part of speciesgen.
speciesgen is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
speciesgen is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with speciesgen. If not, see <https://www.gnu.org/licenses/>.
*/
/////////////////////////////////////////////////////////////////////////////
// Name: stages_panel.cpp
// Purpose: Stages panel, part of the GUI
// Author: prisixia
// Created: 2023-04-27
// Copyright: (C) 2022-2023 prisixia
// Licence: GNU General Public License version 3
/////////////////////////////////////////////////////////////////////////////
#ifndef SPECIESGEN_PANEL_STAGES_H
#define SPECIESGEN_PANEL_STAGES_H
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif // WX_PRECOMP
#if wxUSE_CLIPBOARD
#include <wx/clipbrd.h>
#include <wx/dataobj.h>
#endif // wxUSE_CLIPBOARD
#include "error.h"
#include "starpounds/types.h"
#include "starpounds/weightstage.h"
namespace SpeciesGen {
enum {
STAGES_ADD,
STAGES_REMOVE,
STAGES_SUB_ADD,
STAGES_SUB_REMOVE,
STAGES_SET_DEFAULT,
STAGES_ID,
STAGES_LIST,
STAGES_SUB_LIST,
STAGES_FRAMES,
STAGES_TYPE_CHEST,
STAGES_TYPE_LEG,
STAGES_TEXT_NAME,
STAGES_TEXT_FRIENDLYNAME,
STAGES_TEXT_DESCRIPTION_CHEST,
STAGES_TEXT_DESCRIPTION_LEG
};
class StagesPanel : public wxPanel, public ErrorHandler {
public:
StagesPanel(wxWindow *, int, int, int, int, const std::string &);
void DoAddWeightStage(Starpounds::WeightStage = Starpounds::WeightStage(
"new", "New", "Chest description.",
Starpounds::Types::Chests::Belly,
"Leg description.", Starpounds::Types::Legs::Legs,
false, true, {}));
void DoRemoveWeightStage();
void DoAddWeightStageSub(
Starpounds::WeightStageSub =
Starpounds::WeightStageSub("new", "New", "Chest description.",
Starpounds::Types::Chests::Belly));
void DoRemoveWeightStageSub();
void DoClickCheckboxID(const bool);
[[nodiscard]] std::vector<Starpounds::WeightStage> GetWeightStages() const;
void ClearWeightStages();
virtual size_t CheckForErrors();
void ClearForm();
wxButton *m_add;
wxButton *m_remove;
wxButton *m_subAdd;
wxButton *m_subRemove;
wxCheckBox *m_id;
private:
void EnableForm(const bool, const bool = true, const bool = false);
void PopulateForm(const Starpounds::WeightStage &);
void PopulateForm(const Starpounds::WeightStageSub &);
void DoResetWeightStages();
std::string GetInternalNameReplacement(const Starpounds::WeightStage &);
std::string GetInternalNameReplacement(const Starpounds::WeightStageSub &);
bool HasDuplicateInternalName(const std::string &, const bool);
bool HasDuplicateNoID();
void OnClickWeightStage(wxCommandEvent &);
void OnClickWeightStageSub(wxCommandEvent &);
void OnClickCheckboxFrames(wxCommandEvent &);
void OnSelectComboBoxChest(wxCommandEvent &);
void OnSelectComboBoxLeg(wxCommandEvent &);
void OnInternalNameEdit(wxCommandEvent &WXUNUSED(event));
void OnFriendlyNameEdit(wxCommandEvent &WXUNUSED(event));
void OnDescriptionChestEdit(wxCommandEvent &WXUNUSED(event));
void OnDescriptionLegEdit(wxCommandEvent &WXUNUSED(event));
void OnResetWeightStages(wxCommandEvent &WXUNUSED(event));
wxTextCtrl *m_name;
wxTextCtrl *m_friendlyName;
wxTextCtrl *m_descriptionChest;
wxTextCtrl *m_descriptionLeg;
wxChoice *m_typeChest;
wxChoice *m_typeLeg;
wxCheckBox *m_frames;
wxListBox *m_stagesList;
wxListBox *m_subStagesList;
wxButton *m_default;
wxStaticText *m_nameText;
wxStaticText *m_friendlyNameText;
wxStaticText *m_descriptionChestText;
wxStaticText *m_descriptionLegText;
wxStaticText *m_typeChestText;
wxStaticText *m_typeLegText;
wxStaticText *m_stagesListText;
wxStaticText *m_subStagesListText;
std::vector<Starpounds::WeightStage> m_stages;
wxDECLARE_EVENT_TABLE();
};
} // namespace SpeciesGen
#endif // SPECIESGEN_PANEL_STAGES_H