/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ /* * resource-tab.h * Copyright (C) 2017 Unknown * * histodexc 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. * * histodexc 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 this program. If not, see . */ #ifndef _RESOURCE_TAB_H_ #define _RESOURCE_TAB_H_ #include "tab.h" #include "resource.h" const char* typetostring(int i); int stringtotype(const std::string & a); class ResourceTab : public Tab { public: ResourceTab(GtkWidget *window, GtkBuilder *builder); virtual ~ResourceTab(); virtual void write(const std::string& file); virtual Json::Value getJson(bool genFinal=false); virtual Json::Value getJsonOrphelin(); virtual void open(Json::Value& val); void insert(std::string name, Resource* ra=NULL); void remove(std::string name); virtual void on_save_clicked(); static int on_stage_changed(void *x); void on_type_changed(int i); void on_select(); void on_remove(); void on_add(); GtkListStore* getModel(); std::vector& getResources() {return m_resources;} protected: GtkEntry* m_name; GtkSpinButton* m_stage; GtkSpinButton* m_scale[3]; GtkSpinButton* m_position[3]; GtkSpinButton* m_rotation[3]; GtkTextView* m_comments; GtkEntry* m_title; GtkGrid* m_layout[4]; GtkRadioButton* m_type[4]; GtkTreeView* m_list; GtkListStore* m_listStore; GtkTreeModel* m_model; GtkTreeSelection* m_selection; GtkFileChooserButton* m_files[4]; GtkButton* m_add; GtkButton* m_delete; GtkBox* m_root; int m_activeTab; bool m_isLoading; std::vector m_resources; protected: Data& getTab(bool& genFinal); void setupTab(Data& a); void setCurrentResource(Resource& r); Resource* findResource(const std::string& name); void set_layout(int i=-1); void test(); }; #endif // _RESOURCE_TAB_H_