libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
List of all members | Classes | Public Member Functions | Protected Member Functions | Protected Attributes
t3_widget::edit_window_t Class Reference

Class implementing an edit widget. More...

Inheritance diagram for t3_widget::edit_window_t:
t3_widget::widget_t t3_widget::center_component_t t3_widget::container_t t3_widget::bad_draw_recheck_t t3_widget::window_component_t t3_widget::mouse_target_t t3_widget::window_component_t t3_widget::window_component_t t3_widget::window_component_t

Classes

class  autocomplete_panel_t
struct  implementation_t
class  view_parameters_t

Public Member Functions

void autocomplete (void)
 Perform autocompletion, or pop-up autocompletion choice menu.
virtual void bad_draw_recheck (void)
void cut_copy (bool cut)
 Apply the cut or copy action.
 edit_window_t (text_buffer_t *_text=NULL, const view_parameters_t *params=NULL)
 Create a new edit_window_t.
void find_next (bool backward)
 Apply the find-next action.
void find_replace (bool replace)
 Show the find or replace dialog.
virtual void force_redraw (void)
bool get_auto_indent (void)
 Get automatic indent.
bool get_indent_aware_home (void)
 Get indent aware home.
bool get_show_tabs (void)
 Get show tabs.
bool get_tab_spaces (void)
 Get tab indents with spaces.
int get_tabsize (void)
 Get the size of a tab.
text_buffer_tget_text (void) const
 Get the text currently displayed.
wrap_type_t get_wrap (void)
 Get the wrap type.
void goto_line (int line)
 Move the cursor to the specified line.
void goto_line (void)
 Show the Goto Line dialog.
void indent_selection (void)
 Indent the current selection.
void insert_special (void)
 Show the Insert Special Character dialog.
virtual bool is_child (window_component_t *widget)
void paste (void)
 Apply the paste action.
virtual bool process_key (key_t key)
virtual bool process_mouse_event (mouse_event_t event)
void redo (void)
 Apply the redo action.
view_parameters_tsave_view_parameters (void)
 Save the current view parameters, to allow them to be restored later.
void save_view_parameters (view_parameters_t *params)
 Save the current view parameters, to allow them to be restored later.
void select_all (void)
 Select the whole text.
void set_auto_indent (bool _auto_indent)
 Set automatic indent.
void set_autocompleter (autocompleter_t *_autocompleter)
 Set the autocompleter to use.
virtual void set_child_focus (window_component_t *target)
void set_find_dialog (find_dialog_t *_find_dialog)
 Set the find_dialog_t to use.
void set_finder (finder_t *_finder)
 Set the finder_t to use.
virtual void set_focus (focus_t focus)
void set_indent_aware_home (bool _indent_aware_home)
 Set indent aware home.
void set_show_tabs (bool _show_tabs)
 Set show_tabs.
virtual bool set_size (optint height, optint width)
void set_tab_spaces (bool _tab_spaces)
 Set tab indents with spaces.
void set_tabsize (int _tabsize)
 Set the size of a tab.
void set_text (text_buffer_t *_text, const view_parameters_t *params=NULL)
 Set the text to display.
void set_wrap (wrap_type_t wrap)
 Set the wrap type.
void undo (void)
 Apply the undo action.
void unindent_selection (void)
 Unindent the current selection.
virtual void update_contents (void)
- Public Member Functions inherited from t3_widget::widget_t
virtual bool accepts_focus (void)
 Query whether this widget accepts focus.
virtual void force_redraw (void)
virtual void hide (void)
virtual bool is_enabled (void)
 Query the enabled status of this widget.
virtual bool is_hotkey (key_t key)
 Query whether key is a hotkey for this widget.
virtual bool is_shown (void)
 Query the visibility status of this widget.
virtual bool process_mouse_event (mouse_event_t event)
 Process a mouse event.
virtual void set_anchor (window_component_t *anchor, int relation)
 Set this widget's anchor.
virtual void set_enabled (bool enable)
 Set the enabled status of this widget.
virtual void set_focus (focus_t focus)
virtual void set_position (optint top, optint left)
virtual void show (void)
- Public Member Functions inherited from t3_widget::window_component_t
virtual void force_redraw (void)=0
 Request that this window_component_t be completely redrawn.
virtual t3_window_t * get_base_window (void)
 Retrieve the t3_window_t for this window_component_t.
virtual void hide (void)=0
 Hide the window_component_t.
virtual bool process_key (key_t key)=0
 Handle a key press by the user.
virtual void set_focus (focus_t focus)=0
 Set whether this window_component_t has the input focus.
virtual void set_position (optint top, optint left)=0
 Move the window_component_t to a specified position.
virtual bool set_size (optint height, optint width)=0
 Set the size of this window_component_t.
virtual void show (void)=0
 Display the window_component_t.
virtual void update_contents (void)=0
 Update the contents of the window.
 window_component_t (void)
 Base constructor.
virtual ~window_component_t (void)
 Base destructor.
- Public Member Functions inherited from t3_widget::mouse_target_t
void grab_mouse (void)
 Grab all future mouse events.
void register_mouse_target (t3_window_t *target)
 Register a window to receive mouse events.
void release_mouse_grab (void)
 Release a previous mouse grab.
void unregister_mouse_target (t3_window_t *target)
 Unregister a window to receive mouse events.
- Public Member Functions inherited from t3_widget::center_component_t
 center_component_t (void)
 Create a new center_component_t.
virtual void set_center_window (window_component_t *_center_window)
 Set the window_component_t to center over.
- Public Member Functions inherited from t3_widget::container_t
virtual bool is_child (window_component_t *component)=0
 Determine whether a window_compnent_t is a child of the container_t.
virtual void set_child_focus (window_component_t *target)=0
 Set the focus to a specific window component.
- Public Member Functions inherited from t3_widget::bad_draw_recheck_t
virtual void bad_draw_recheck (void)=0
 Function called on reception of the terminal_settings_changed signal.
 bad_draw_recheck_t (void)
 Base constructor.
virtual ~bad_draw_recheck_t (void)
 Base destructor.

Protected Member Functions

void activate_autocomplete (bool autocomplete_single)
 Activate the autocomplete panel.
virtual void draw_info_window (void)
 Draw the information in the info_window.
void ensure_cursor_on_screen (void)
 Ensure that the cursor is visible.
void update_repaint_lines (int start, int end)
 Change the lines to start and end repainting.
text_coordinate_t xy_to_text_coordinate (int x, int y)
 Convert coordinates relative to the edit window to a text_coordinate_t.
- Protected Member Functions inherited from t3_widget::widget_t
void init_unbacked_window (int height, int width, bool register_as_mouse_target=false)
 Initialize the window with an unbacked t3_window_t with height and width.
void init_window (int height, int width, bool register_as_mouse_target=true)
 Initialize the window with a t3_window_t with height and width.
 widget_t (int height, int width, bool register_as_mouse_target=true)
 Constructor which creates a default t3_window_t with height and width.
 widget_t (void)
 Constructor which does not create a default t3_window_t.
- Protected Member Functions inherited from t3_widget::mouse_target_t
 mouse_target_t (bool use_window=true)
- Protected Member Functions inherited from t3_widget::container_t
virtual bool set_widget_parent (window_component_t *widget)
 Make widget a child window of this container_t, by setting its parent window.
virtual void unset_widget_parent (window_component_t *widget)
 Unset the parent window for a widget.

Protected Attributes

cleanup_t3_window_ptr info_window
 Window for other information, such as buffer name.
text_buffer_ttext
 Buffer holding the text currently displayed.
- Protected Attributes inherited from t3_widget::widget_t
bool enabled
 Widget is enabled.
bool redraw
 Widget requires redrawing on next update_contents call.
bool shown
 Widget is shown.
- Protected Attributes inherited from t3_widget::window_component_t
cleanup_t3_window_ptr window
 The t3_window_t used for presenting this item on screen (see libt3window).
- Protected Attributes inherited from t3_widget::center_component_t
window_component_tcenter_window
 The window_component_t to center over.

Additional Inherited Members

- Public Types inherited from t3_widget::window_component_t
enum  focus_t {
  FOCUS_OUT, FOCUS_SET, FOCUS_IN_FWD, FOCUS_IN_BCK,
  FOCUS_REVERT
}
- Static Public Member Functions inherited from t3_widget::mouse_target_t
static bool handle_mouse_event (mouse_event_t event)

Detailed Description

Class implementing an edit widget.

Constructor & Destructor Documentation

t3_widget::edit_window_t::edit_window_t ( text_buffer_t _text = NULL,
const view_parameters_t params = NULL 
)

Create a new edit_window_t.

Parameters
_textThe text to display in the edit_window_t.
paramsThe view parameters to set.

Member Function Documentation

void t3_widget::edit_window_t::activate_autocomplete ( bool  autocomplete_single)
protected

Activate the autocomplete panel.

Parameters
autocomplete_singleShould the autocomplete be automatic if there is only one option.

The autocomplete panel activate, only if there is a possible autocompletion.

void t3_widget::edit_window_t::autocomplete ( void  )

Perform autocompletion, or pop-up autocompletion choice menu.

void t3_widget::edit_window_t::cut_copy ( bool  cut)

Apply the cut or copy action.

Parameters
cutA boolean indicating whether a cut (true) should be performed, or a copy (false). The selected text is stored in copy_buffer.
void t3_widget::edit_window_t::draw_info_window ( void  )
protectedvirtual

Draw the information in the info_window.

This function is called whenever the info_window changes size and therefore needs to be redrawn.

void t3_widget::edit_window_t::ensure_cursor_on_screen ( void  )
protected

Ensure that the cursor is visible.

void t3_widget::edit_window_t::find_next ( bool  backward)

Apply the find-next action.

Parameters
backwardBoolean indicating whether to reverse the direction of the search relative to the original search direction.
void t3_widget::edit_window_t::find_replace ( bool  replace)

Show the find or replace dialog.

bool t3_widget::edit_window_t::get_auto_indent ( void  )

Get automatic indent.

bool t3_widget::edit_window_t::get_indent_aware_home ( void  )

Get indent aware home.

bool t3_widget::edit_window_t::get_show_tabs ( void  )

Get show tabs.

bool t3_widget::edit_window_t::get_tab_spaces ( void  )

Get tab indents with spaces.

int t3_widget::edit_window_t::get_tabsize ( void  )

Get the size of a tab.

text_buffer_t * t3_widget::edit_window_t::get_text ( void  ) const

Get the text currently displayed.

wrap_type_t t3_widget::edit_window_t::get_wrap ( void  )

Get the wrap type.

void t3_widget::edit_window_t::goto_line ( int  line)

Move the cursor to the specified line.

void t3_widget::edit_window_t::goto_line ( void  )

Show the Goto Line dialog.

void t3_widget::edit_window_t::indent_selection ( void  )

Indent the current selection.

void t3_widget::edit_window_t::insert_special ( void  )

Show the Insert Special Character dialog.

void t3_widget::edit_window_t::paste ( void  )

Apply the paste action.

The text to paste is taken from copy_buffer.

void t3_widget::edit_window_t::redo ( void  )

Apply the redo action.

edit_window_t::view_parameters_t * t3_widget::edit_window_t::save_view_parameters ( void  )

Save the current view parameters, to allow them to be restored later.

void t3_widget::edit_window_t::save_view_parameters ( view_parameters_t params)

Save the current view parameters, to allow them to be restored later.

void t3_widget::edit_window_t::select_all ( void  )

Select the whole text.

void t3_widget::edit_window_t::set_auto_indent ( bool  _auto_indent)

Set automatic indent.

void t3_widget::edit_window_t::set_autocompleter ( autocompleter_t _autocompleter)

Set the autocompleter to use.

void t3_widget::edit_window_t::set_find_dialog ( find_dialog_t _find_dialog)

Set the find_dialog_t to use.

In some cases it can be useful not to use the global find_dialog_t. This function allows one to set the find_dialog_t used.

void t3_widget::edit_window_t::set_finder ( finder_t _finder)

Set the finder_t to use.

Because the finder_t stores the search information, such as the text searched for, it is sometimes useful to use different finder_t instances for different windows. The finder_t is used for example for the find-next action.

void t3_widget::edit_window_t::set_indent_aware_home ( bool  _indent_aware_home)

Set indent aware home.

void t3_widget::edit_window_t::set_show_tabs ( bool  _show_tabs)

Set show_tabs.

void t3_widget::edit_window_t::set_tab_spaces ( bool  _tab_spaces)

Set tab indents with spaces.

void t3_widget::edit_window_t::set_tabsize ( int  _tabsize)

Set the size of a tab.

void t3_widget::edit_window_t::set_text ( text_buffer_t _text,
const view_parameters_t params = NULL 
)

Set the text to display.

The previously displayed text will be replaced, without deleting. Use get_text to retrieve the current text_buffer_t before calling this function to make sure you have a reference to the current buffer that you can use to delete the old text_buffer_t.

void t3_widget::edit_window_t::set_wrap ( wrap_type_t  wrap)

Set the wrap type.

void t3_widget::edit_window_t::undo ( void  )

Apply the undo action.

void t3_widget::edit_window_t::unindent_selection ( void  )

Unindent the current selection.

void t3_widget::edit_window_t::update_repaint_lines ( int  start,
int  end 
)
protected

Change the lines to start and end repainting.

It is acceptable to pass start and end in reverse order.

text_coordinate_t t3_widget::edit_window_t::xy_to_text_coordinate ( int  x,
int  y 
)
protected

Convert coordinates relative to the edit window to a text_coordinate_t.

Member Data Documentation

cleanup_t3_window_ptr t3_widget::edit_window_t::info_window
protected

Window for other information, such as buffer name.

text_buffer_t* t3_widget::edit_window_t::text
protected

Buffer holding the text currently displayed.