/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ /* * tab.h * Copyright (C) 2017 Fanch * * 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 _TAB_H_ #define _TAB_H_ #include "main.h" #include #include #include class Data; #define TAB_TYPE_NONE 0 #define TAB_TYPE_GENERAL 1 #define TAB_TYPE_RESOURCE 2 #define TAB_TYPE_STAGE 3 #define TAB_TYPE_ZONE 4 #define CONNECT(a, s, c, d) \ g_signal_connect (G_OBJECT (a), s, \ G_CALLBACK (c), d); typedef int tab_type_t; std::string gtk_tree_view_get_str_selected(GtkTreeView* gt, bool* valid=NULL); bool gtk_tree_view_set_str_selected(GtkTreeView* gt, const std::string& str); char* gtk_text_view_get_text(GtkTextView* tv); void gtk_text_view_set_text(GtkTextView* tv, const char*); void gtk_tree_model_get_iter_last(GtkTreeModel* tm, GtkTreeIter* iter); class Tab { public: Tab(GtkWidget *window, GtkBuilder *builder); virtual ~Tab(); virtual const Tab& operator=(const Tab&); virtual void write(const std::string& file)=0; virtual Json::Value getJson(bool genFinal=false)=0; virtual void open(Json::Value& val)=0; virtual void on_save_clicked()=0; virtual void setupTab(Data& a)=0; virtual Data& getTab(bool& genFinal)=0; void clearModified(); void setModified(); bool getModified(); protected: tab_type_t m_tab_type; GtkWidget *m_window; GtkBuilder *m_builder; Data *m_data; bool m_isModified; protected: void dialog_error(const char* str); private: }; class CallbackArg { public: CallbackArg(void* t, void* d=NULL) { tab=t; data=d; } virtual ~CallbackArg(){} void* tab; void* data; }; #endif // _TAB_H_