1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
- /*
- * tab.h
- * Copyright (C) 2017 Fanch <francois@gautrais.eu>
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
- #ifndef _TAB_H_
- #define _TAB_H_
- #include "main.h"
- #include <iostream>
- #include <vector>
- #include <json/json.h>
- 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_
|