src/relpipe-out-gui.cpp
author František Kučera <franta-hg@frantovo.cz>
Tue, 20 Oct 2020 23:48:51 +0200
branchv_0
changeset 7 90db918f2d4b
parent 4 b2c40d783699
permissions -rw-r--r--
Added tag v0.17 for changeset d769845a49b3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
2
bca03092cdb6 fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
0
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#include <cstdlib>
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
#include <unistd.h>
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <memory>
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
#include <gtkmm.h>
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
#include <relpipe/cli/CLI.h>
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
#include <relpipe/cli/RelpipeCLIException.h>
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
#include <relpipe/reader/Factory.h>
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
#include <relpipe/reader/RelationalReader.h>
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
#include <relpipe/reader/RelpipeReaderException.h>
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
using namespace relpipe::cli;
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
using namespace relpipe::reader;
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
int main(int argc, char** argv) {
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	setlocale(LC_ALL, "");
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	CLI::untieStdIO();
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
	CLI cli(argc, argv);
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	auto app = Gtk::Application::create(argc, argv, "org.gtkmm.examples.base");
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	Gtk::Window window;
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
	window.set_default_size(640, 480);
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	window.set_title("relpipe-out-gui.gtk");
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
4
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    42
	Gtk::Notebook notebook;
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    43
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    44
	Gtk::TreeModelColumnRecord columns;
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    45
	Gtk::TreeModelColumn<Glib::ustring> m_col_text;
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    46
	Gtk::TreeModelColumn<int> m_col_number;
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    47
	columns.add(m_col_text);
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    48
	columns.add(m_col_number);
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    49
	
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    50
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    51
	auto model = Gtk::ListStore::create(columns);
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    52
	
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    53
	Gtk::TreeView table(model);
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    54
	table.set_headers_visible(true);
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    55
	notebook.append_page(table, "TreeView");
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    56
	
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    57
	
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    58
	Gtk::CheckButton b1;
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    59
	b1.set_label("hello");
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    60
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    61
	notebook.append_page(b1, "CheckButton");
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    62
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    63
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    64
	notebook.show_all();
b2c40d783699 demo GTK controls
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    65
	window.add(notebook);
0
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    66
	return app->run(window);
f28025ce355d empty GTK/cmake/netbeans project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    67
}