Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a number of protected methods to Terminal widget. #230

Merged
merged 4 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 104 additions & 38 deletions include/cfl_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ GROUP_DECLARE(Fl_Grid)

WIDGET_DECLARE(Fl_Terminal)

int Fl_Terminal_ansi(Fl_Terminal *self);
int Fl_Terminal_ansi(Fl_Terminal const *self);

void Fl_Terminal_set_ansi(Fl_Terminal *self, int boolean);

Expand All @@ -175,61 +175,55 @@ void Fl_Terminal_clear_screen(Fl_Terminal *self, int boolean);

void Fl_Terminal_clear_screen_home(Fl_Terminal *self, int boolean);

int Fl_Terminal_cursor_col(Fl_Terminal *self);

// void Fl_Terminal_set_cursor_col(Fl_Terminal *self, int set);
// Can't use: not public
int Fl_Terminal_cursor_col(Fl_Terminal const *self);

void Fl_Terminal_cursor_home(Fl_Terminal *self);

int Fl_Terminal_cursor_row(Fl_Terminal *self);

// void Fl_Terminal_set_cursor_row(Fl_Terminal *self, int set);
// Can't use: not public
int Fl_Terminal_cursor_row(Fl_Terminal const *self);

unsigned Fl_Terminal_cursor_bg_color(Fl_Terminal *self); // Actually Fl_Color
unsigned Fl_Terminal_cursor_bg_color(Fl_Terminal const *self); // Actually Fl_Color

void Fl_Terminal_set_cursor_bg_color(Fl_Terminal *self, unsigned set);

unsigned Fl_Terminal_cursor_fg_color(Fl_Terminal *self); // Actually Fl_Color
unsigned Fl_Terminal_cursor_fg_color(Fl_Terminal const *self); // Actually Fl_Color

void Fl_Terminal_set_cursor_fg_color(Fl_Terminal *self, unsigned set);

int Fl_Terminal_display_columns(Fl_Terminal *self);
int Fl_Terminal_display_columns(Fl_Terminal const *self);

void Fl_Terminal_set_display_columns(Fl_Terminal *self, int set);

int Fl_Terminal_display_rows(Fl_Terminal *self);
int Fl_Terminal_display_rows(Fl_Terminal const *self);

void Fl_Terminal_set_display_rows(Fl_Terminal *self, int set);

int Fl_Terminal_history_lines(Fl_Terminal *self);
int Fl_Terminal_history_lines(Fl_Terminal const *self);

void Fl_Terminal_set_history_lines(Fl_Terminal *self, int set);

int Fl_Terminal_history_rows(Fl_Terminal *self);
int Fl_Terminal_history_rows(Fl_Terminal const *self);

void Fl_Terminal_set_history_rows(Fl_Terminal *self, int set);

int Fl_Terminal_history_use(Fl_Terminal *self);
int Fl_Terminal_history_use(Fl_Terminal const *self);

int Fl_Terminal_margin_bottom(Fl_Terminal *self);
int Fl_Terminal_margin_bottom(Fl_Terminal const *self);

void Fl_Terminal_set_margin_bottom(Fl_Terminal *self, int set);

int Fl_Terminal_margin_left(Fl_Terminal *self);
int Fl_Terminal_margin_left(Fl_Terminal const *self);

void Fl_Terminal_set_margin_left(Fl_Terminal *self, int set);

int Fl_Terminal_margin_right(Fl_Terminal *self);
int Fl_Terminal_margin_right(Fl_Terminal const *self);

void Fl_Terminal_set_margin_right(Fl_Terminal *self, int set);

int Fl_Terminal_margin_top(Fl_Terminal *self);
int Fl_Terminal_margin_top(Fl_Terminal const *self);

void Fl_Terminal_set_margin_top(Fl_Terminal *self, int set);

unsigned Fl_Terminal_output_translate(Fl_Terminal *self); // Returns OutFlags
unsigned Fl_Terminal_output_translate(Fl_Terminal const *self); // Returns OutFlags

void Fl_Terminal_set_output_translate(Fl_Terminal *self, unsigned set);

Expand All @@ -245,73 +239,145 @@ void Fl_Terminal_put_char(Fl_Terminal *self, char c, int row, int col);
void Fl_Terminal_put_char_utf8(Fl_Terminal *self, const char *txt, int len, int row,
int col);

float Fl_Terminal_redraw_rate(Fl_Terminal *self);
float Fl_Terminal_redraw_rate(Fl_Terminal const *self);

void Fl_Terminal_set_redraw_rate(Fl_Terminal *self, float set);

int Fl_Terminal_redraw_style(Fl_Terminal *self); // Actually enum RedrawStyle
int Fl_Terminal_redraw_style(Fl_Terminal const *self); // Actually enum RedrawStyle

void Fl_Terminal_set_redraw_style(Fl_Terminal *self, int set);

void Fl_Terminal_reset_terminal(Fl_Terminal *self);

// todo? int Fl_Terminal_resize(Fl_Terminal *self, int X, int Y, int W, int H);

int Fl_Terminal_scrollbar_actual_size(Fl_Terminal *self);
int Fl_Terminal_scrollbar_actual_size(Fl_Terminal const *self);

int Fl_Terminal_scrollbar_size(Fl_Terminal *self);
int Fl_Terminal_scrollbar_size(Fl_Terminal const *self);

void Fl_Terminal_set_scrollbar_size(Fl_Terminal *self, int set);

unsigned Fl_Terminal_selection_bg_color(Fl_Terminal *self); // Actually Fl_Color
unsigned Fl_Terminal_selection_bg_color(Fl_Terminal const *self); // Actually Fl_Color

void Fl_Terminal_set_selection_bg_color(Fl_Terminal *self, unsigned set);

unsigned Fl_Terminal_selection_fg_color(Fl_Terminal *self); // Actually Fl_Color
unsigned Fl_Terminal_selection_fg_color(Fl_Terminal const *self); // Actually Fl_Color

void Fl_Terminal_set_selection_fg_color(Fl_Terminal *self, unsigned set);

int Fl_Terminal_show_unknown(Fl_Terminal *self);
int Fl_Terminal_show_unknown(Fl_Terminal const *self);

void Fl_Terminal_set_show_unknown(Fl_Terminal *self, int boolean);

void Fl_Terminal_text_attrib(Fl_Terminal *self,
unsigned set); // Actually Fl_Color

unsigned Fl_Terminal_text_bg_color(Fl_Terminal *self); // Actually Fl_Color
unsigned Fl_Terminal_text_bg_color(Fl_Terminal const *self); // Actually Fl_Color

void Fl_Terminal_set_text_bg_color(Fl_Terminal *self, unsigned set);

unsigned
Fl_Terminal_text_bg_color_default(Fl_Terminal *self); // Actually Fl_Color
Fl_Terminal_text_bg_color_default(Fl_Terminal const *self); // Actually Fl_Color

void Fl_Terminal_set_text_bg_color_default(Fl_Terminal *self, unsigned set);

void Fl_Terminal_set_text_bg_color_xterm(Fl_Terminal *self, unsigned char set);

//? todo: unsigned text_color(*self) ? Documented but not implemented in Fl_Terminal.cxx
void Fl_Terminal_set_text_color(Fl_Terminal *self, unsigned set);

unsigned Fl_Terminal_text_fg_color(Fl_Terminal *self); // Actually Fl_Color
unsigned Fl_Terminal_text_fg_color(Fl_Terminal const *self); // Actually Fl_Color

void Fl_Terminal_set_text_fg_color(Fl_Terminal *self, unsigned set);

unsigned
Fl_Terminal_text_fg_color_default(Fl_Terminal *self); // Actually Fl_Color
Fl_Terminal_text_fg_color_default(Fl_Terminal const *self); // Actually Fl_Color

void Fl_Terminal_set_text_fg_color_default(Fl_Terminal *self, unsigned set);

void Fl_Terminal_set_text_fg_color_xterm(Fl_Terminal *self, unsigned char set);

int Fl_Terminal_text_font(Fl_Terminal *self); // Actually Fl_Font
int Fl_Terminal_text_font(Fl_Terminal const *self); // Actually Fl_Font

void Fl_Terminal_set_text_font(Fl_Terminal *self, int set);

int Fl_Terminal_text_size(Fl_Terminal *self);
int Fl_Terminal_text_size(Fl_Terminal const *self);

void Fl_Terminal_set_text_size(Fl_Terminal *self, int set);

const char *Fl_Terminal_selection_text(const Fl_Terminal *self);
//----------------------------------------------------------------------
/// Utf8Char class, used to describe characters in the terminal ring buffer
typedef void Fl_Terminal_Utf8Char;

unsigned char Fl_Terminal_Utf8Char_attrib(Fl_Terminal_Utf8Char const *self);

unsigned Fl_Terminal_Utf8Char_bgcolor(
Fl_Terminal_Utf8Char const *self); // Actually returns Fl_Color

unsigned Fl_Terminal_Utf8Char_fgcolor(
Fl_Terminal_Utf8Char const *self); // Actually returns Fl_Color

const unsigned char *Fl_Terminal_Utf8Char_text_utf8(Fl_Terminal_Utf8Char const *self);

unsigned char Fl_Terminal_Utf8Char_charflags(Fl_Terminal_Utf8Char const *self);

int Fl_Terminal_Utf8Char_length(Fl_Terminal_Utf8Char const *self);

// Construct a new Utf8Char, useful for testing
Fl_Terminal_Utf8Char *Fl_Terminal_Utf8Char_new_obj(unsigned char c);

//----------------------------------------------------------------------
// The following are protected functions used to access ring buffer text:

const char *Fl_Terminal_selection_text(Fl_Terminal const *self);

int Fl_Terminal_disp_erow(Fl_Terminal const *self);

int Fl_Terminal_disp_rows(Fl_Terminal const *self);

int Fl_Terminal_disp_cols(Fl_Terminal const *self);

int Fl_Terminal_disp_srow(Fl_Terminal const *self);

int Fl_Terminal_hist_cols(Fl_Terminal const *self);

int Fl_Terminal_hist_erow(Fl_Terminal const *self);

int Fl_Terminal_hist_rows(Fl_Terminal const *self);

int Fl_Terminal_hist_srow(Fl_Terminal const *self);

int Fl_Terminal_hist_use(Fl_Terminal const *self);

int Fl_Terminal_hist_use_srow(Fl_Terminal const *self);

int Fl_Terminal_is_inside_selection(Fl_Terminal const *self, int row, int col); // Actual return type is bool

int Fl_Terminal_is_selection(Fl_Terminal const *self); // Actual return type is bool

int Fl_Terminal_offset(Fl_Terminal const *self);

int Fl_Terminal_ring_cols(Fl_Terminal const *self);

int Fl_Terminal_ring_erow(Fl_Terminal const *self);

int Fl_Terminal_ring_srow(Fl_Terminal const *self);

int Fl_Terminal_ring_rows(Fl_Terminal const *self);

const Fl_Terminal_Utf8Char *Fl_Terminal_u8c_disp_row(Fl_Terminal const *self, int drow);

const Fl_Terminal_Utf8Char *Fl_Terminal_u8c_hist_row(Fl_Terminal const *self, int hrow);

const Fl_Terminal_Utf8Char *Fl_Terminal_u8c_hist_use_row(Fl_Terminal const *self,
int hurow);

const Fl_Terminal_Utf8Char *Fl_Terminal_u8c_ring_row(Fl_Terminal const *self, int grow);

const unsigned Fl_Terminal_Utf8Char_size(void);


// todo: Protected methods still unimplemented here:
// clear_*, current_style, cursor_*, delete_*, draw_*, get_selection, h_to_row, insert_*,
// scroll, selection_extend, u8c_cursor, w_to_col, walk_selection, vscroll_width


GROUP_DECLARE(Fl_Terminal)

Expand Down
Loading