aboutsummaryrefslogtreecommitdiff
path: root/src/clients/gtkpaludis/vtemm/terminal_widget.hg
blob: 26b4d718269b7c939d2618de20c1ee2764bf1e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/* vim: set sw=4 sts=4 et foldmethod=syntax : */

/*
 * Copyright (c) 2006 Piotr Rak
 *
 * This file is part of the Paludis package manager. Paludis is free software;
 * you can redistribute it and/or modify it under the terms of the GNU General
 * Public License version 2, as published by the Free Software Foundation.
 *
 * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <gtkmm/widget.h>
#include <gtkmm/menushell.h>
#include <gtkmm/adjustment.h>
#include <gdkmm/cursor.h>
#include <pangomm/fontdescription.h>

#include <vector>

_DEFS(vtemm,vte)
_PINCLUDE(gtkmm/private/widget_p.h)

/* we don't want whole vte.h in this file */
typedef struct _VteCharAttributes VteCharAttributes;

namespace Vte
{


class CharAttributes 
{
private:
    VteCharAttributes * _gobject;

public:
    CharAttributes(VteCharAttributes *obj);
    CharAttributes(const CharAttributes&);

    ~CharAttributes();

    CharAttributes& operator= (const CharAttributes&);

    int row() const;
    int column() const;
    Gdk::Color foreground() const;
    Gdk::Color background() const;
    bool underline() const;
    bool strikethrough() const;
};

_WRAP_ENUM(TerminalEraseBinding, VteTerminalEraseBinding)
_WRAP_ENUM(TerminalAntiAlias, VteTerminalAntiAlias)

class Terminal :
    public Gtk::Widget
{

_CLASS_GTKOBJECT(Terminal,VteTerminal,VTE_TERMINAL,Gtk::Widget,GtkWidget)
public:

typedef sigc::slot<bool, long, long> SlotIsSelected;

_CTOR_DEFAULT

_WRAP_METHOD(void im_append_menuitems(const Gtk::MenuShell& menushell), vte_terminal_im_append_menuitems)
_WRAP_METHOD(pid_t fork_command(const char* command, char** argv, char** envv, const char* directory, bool lastlog, bool utmp, bool wtmp), vte_terminal_fork_command)
_WRAP_METHOD(pid_t forkpty(char** env, const char* directory, bool lastlog, bool utmp, bool wtmp), vte_terminal_forkpty)
_WRAP_METHOD(void set_pty(int pty_master), vte_terminal_set_pty)
_WRAP_METHOD(void feed(const char* data, glong length), vte_terminal_feed)
_WRAP_METHOD(void feed_child(const char* text, glong length), vte_terminal_feed_child)
_WRAP_METHOD(void feed_child_binary(const char* data, glong length), vte_terminal_feed_child_binary)
_WRAP_METHOD(void copy_clipboard(), vte_terminal_copy_clipboard)
_WRAP_METHOD(void paste_clipboard(), vte_terminal_paste_clipboard)
_WRAP_METHOD(void copy_primary(), vte_terminal_copy_primary)
_WRAP_METHOD(void paste_primary(), vte_terminal_paste_primary)
_WRAP_METHOD(void set_size(glong columns, glong rows), vte_terminal_set_size)
_WRAP_METHOD(void set_audible_bell(bool is_audible), vte_terminal_set_audible_bell)
_WRAP_METHOD(bool get_audible_bell(), vte_terminal_get_audible_bell)
_WRAP_METHOD(void set_visible_bell(bool is_visible), vte_terminal_set_visible_bell)
_WRAP_METHOD(bool get_visible_bell(), vte_terminal_get_visible_bell)
_WRAP_METHOD(void set_allow_bold(bool allow_bold), vte_terminal_set_allow_bold)
_WRAP_METHOD(bool get_allow_bold(), vte_terminal_get_allow_bold)
_WRAP_METHOD(void set_scroll_on_output(bool scroll), vte_terminal_set_scroll_on_output)
_WRAP_METHOD(void set_scroll_on_keystroke(bool scroll), vte_terminal_set_scroll_on_keystroke)
_WRAP_METHOD(void set_color_bold(const Gdk::Color& bold), vte_terminal_set_color_bold )
_WRAP_METHOD(void set_color_foreground(const Gdk::Color& foreground), vte_terminal_set_color_foreground)
_WRAP_METHOD(void set_color_background(const Gdk::Color& background), vte_terminal_set_color_background)
_WRAP_METHOD(void set_color_dim(const Gdk::Color& dim), vte_terminal_set_color_dim)
_WRAP_METHOD(void set_color_cursor(const Gdk::Color& cursor), vte_terminal_set_color_cursor) 
_WRAP_METHOD(void set_color_highlight(const Gdk::Color& highlight), vte_terminal_set_color_highlight)
_WRAP_METHOD(void set_colors(const Gdk::Color& foreground, const Gdk::Color& background, const Gdk::Color& palete_size, glong palette_size), vte_terminal_set_colors)
_WRAP_METHOD(void set_default_colors(), vte_terminal_set_default_colors)
_WRAP_METHOD(void set_background_image(Glib::RefPtr<Gdk::Pixbuf> pixbuf), vte_terminal_set_background_image)
_WRAP_METHOD(void set_background_image_file(const char* path), vte_terminal_set_background_image_file)
_WRAP_METHOD(void set_background_saturation(double saturation), vte_terminal_set_background_saturation)
_WRAP_METHOD(void set_background_transparent(bool transparent), vte_terminal_set_background_transparent)
_WRAP_METHOD(void set_background_tint_color(const Gdk::Color& color), vte_terminal_set_background_tint_color)
_WRAP_METHOD(void set_scroll_background(bool scroll), vte_terminal_set_scroll_background)
_WRAP_METHOD(void set_cursor_blinks(bool blink), vte_terminal_set_cursor_blinks)
_WRAP_METHOD(void set_scrollback_lines(long lines), vte_terminal_set_scrollback_lines)
_WRAP_METHOD(void set_font(const Pango::FontDescription& font_desc), vte_terminal_set_font)
_WRAP_METHOD(void set_font_from_string(const char* name), vte_terminal_set_font_from_string)
_WRAP_METHOD(void set_font_from_string_full(const char* name, TerminalAntiAlias antialas), vte_terminal_set_font_from_string_full)
_WRAP_METHOD(void set_font_full(const Pango::FontDescription& font_desc, TerminalAntiAlias antialas), vte_terminal_set_font_full)
_WRAP_METHOD(const Pango::FontDescription get_font(), vte_terminal_get_font)
_WRAP_METHOD(bool get_using_xft(), vte_terminal_get_using_xft)
_WRAP_METHOD(bool get_has_selection(), vte_terminal_get_has_selection)
_WRAP_METHOD(void set_word_chars(const char* spec), vte_terminal_set_word_chars)
_WRAP_METHOD(bool is_word_char(gunichar), vte_terminal_is_word_char)
_WRAP_METHOD(void set_backspace_binding(TerminalEraseBinding binding), vte_terminal_set_backspace_binding)
_WRAP_METHOD(void set_delete_binding(TerminalEraseBinding binding), vte_terminal_set_delete_binding)
_WRAP_METHOD(void set_mouse_autohide(bool setting), vte_terminal_set_mouse_autohide)
_WRAP_METHOD(bool get_mouse_autohide(), vte_terminal_get_mouse_autohide)
_WRAP_METHOD(void reset(bool full, bool clear_history), vte_terminal_reset)
//_WRAP_METHOD(char* get_text(bool (*is_selected) (glong column,glong row,gpointer data), gpointer data, GArray *attributes), vte_terminal_get_text) //Manualy wrapped below
//_WRAP_METHOD(char* get_text_range(glong start_row, glong start_col, glong end_row, glong end_col, gboolean (*is_selected) (glong column,glong row,gpointer data), gpointer data, GArray *attributes), vte_terminal_get_text_range) //Manualy wrapped bellow
_WRAP_METHOD(void get_cursor_position(long& column, long& row), vte_terminal_get_cursor_position)
_WRAP_METHOD(void match_clear_all(), vte_terminal_match_clear_all)
_WRAP_METHOD(int match_add(const char* match), vte_terminal_match_add)
_WRAP_METHOD(void match_remove(int tag), vte_terminal_match_remove)
_WRAP_METHOD(char* match_check(glong column, glong row, int& tag), vte_terminal_match_check)
_WRAP_METHOD(void match_set_cursor(int tag, Gdk::Cursor& ), vte_terminal_match_set_cursor)
_WRAP_METHOD(void match_set_cursor_type(int tag, Gdk::CursorType), vte_terminal_match_set_cursor_type)
_WRAP_METHOD(void set_emulation(const char* emulation), vte_terminal_set_emulation)
_WRAP_METHOD(const char* get_emulation(), vte_terminal_get_emulation)
_WRAP_METHOD(const char* get_default_emulation(), vte_terminal_get_default_emulation)
_WRAP_METHOD(void set_encoding(const char* codeset), vte_terminal_set_encoding)
_WRAP_METHOD(const char* get_encoding(), vte_terminal_get_encoding)
_WRAP_METHOD(const char* get_status_line(), vte_terminal_get_status_line)
_WRAP_METHOD(void get_padding(int& xpad, int& ypad), vte_terminal_get_padding)
_WRAP_METHOD(Gtk::Adjustment* get_adjustment(), vte_terminal_get_adjustment)
_WRAP_METHOD(glong get_char_ascent(), vte_terminal_get_char_ascent)
_WRAP_METHOD(glong get_char_descent(), vte_terminal_get_char_descent)
_WRAP_METHOD(glong get_char_height(), vte_terminal_get_char_height)
_WRAP_METHOD(glong get_char_width(), vte_terminal_get_char_width)
_WRAP_METHOD(glong get_column_count(), vte_terminal_get_column_count)
_WRAP_METHOD(const char* get_icon_title(), vte_terminal_get_icon_title)
_WRAP_METHOD(glong get_row_count(), vte_terminal_get_row_count)
_WRAP_METHOD(const char* get_window_title(), vte_terminal_get_window_title)

_WRAP_SIGNAL(void char_size_changed(unsigned w, unsigned h), "char-size-changed")
_WRAP_SIGNAL(void child_exited(), "child-exited")
_WRAP_SIGNAL(void commit(gchar* text, unsigned length), "commit")
_WRAP_SIGNAL(void contents_changed(), "contents-changed")
_WRAP_SIGNAL(void cursor_moved(), "cursor-moved")
_WRAP_SIGNAL(void decrease_font_size(), "decrease-font-size")
_WRAP_SIGNAL(void deiconify_window(), "deiconify-window")
_WRAP_SIGNAL(void emulation_changed(), "emulation-changed")
_WRAP_SIGNAL(void encoding_changed(), "encoding-changed")
_WRAP_SIGNAL(void eof(), "eof")
_WRAP_SIGNAL(void icon_title_changed(), "icon-title-changed")
_WRAP_SIGNAL(void iconify_window(), "iconify-window")
_WRAP_SIGNAL(void increase_font_size(), "increase-font-size")
_WRAP_SIGNAL(void lower_window(), "lower-window")
_WRAP_SIGNAL(void maximize_window(), "maximize-window")
_WRAP_SIGNAL(void move_window(unsigned x, unsigned y), "move-window")
_WRAP_SIGNAL(void raise_window(), "raise-window")
_WRAP_SIGNAL(void refresh_window(), "refresh-window")
_WRAP_SIGNAL(void resize_window(unsigned w, unsigned h), "resize-window")
_WRAP_SIGNAL(void restore_window(), "restore-window")
_WRAP_SIGNAL(void selection_changed(), "selection-changed")
_WRAP_SIGNAL(void status_line_changed(), "status-line-changed")
_WRAP_SIGNAL(void text_deleted(), "text-deleted")
_WRAP_SIGNAL(void text_inserted(), "text-inserted")
_WRAP_SIGNAL(void text_modified(), "text-modified")
_WRAP_SIGNAL(void text_scrolled(int arg), "text-scrolled")
_WRAP_SIGNAL(void window_title_changed(), "window-title-changed")
  char* get_text(const SlotIsSelected& slot, std::vector<CharAttributes>& attributes);
  char* get_text_include_trailing_spaces(const SlotIsSelected& slot, std::vector<CharAttributes>& attributes);
  char* get_text_range(long start_row, long start_col, long end_row, long end_col, const SlotIsSelected& slot, std::vector<CharAttributes>& attributes);
};

} /* namespace Vte */