libt3widget
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
 
class  view_parameters_t
 

Public Member Functions

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

Protected Member Functions

void activate_autocomplete (bool autocomplete_single)
 Activate the autocomplete panel. More...
 
virtual void draw_info_window (void)
 Draw the information in the info_window. More...
 
void ensure_cursor_on_screen (void)
 Ensure that the cursor is visible. More...
 
void update_repaint_lines (int start, int end)
 Change the lines to start and end repainting. More...
 
text_coordinate_t xy_to_text_coordinate (int x, int y)
 Convert coordinates relative to the edit window to a text_coordinate_t. More...
 
- 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. More...
 
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. More...
 
 widget_t (int height, int width, bool register_as_mouse_target=true)
 Constructor which creates a default t3_window_t with height and width. More...
 
 widget_t (void)
 Constructor which does not create a default t3_window_t. More...
 
- 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. More...
 
virtual void unset_widget_parent (window_component_t *widget)
 Unset the parent window for a widget. More...
 

Protected Attributes

cleanup_t3_window_ptr info_window
 Window for other information, such as buffer name. More...
 
text_buffer_ttext
 Buffer holding the text currently displayed. More...
 
- Protected Attributes inherited from t3_widget::widget_t
bool enabled
 Widget is enabled. More...
 
bool redraw
 Widget requires redrawing on next update_contents call. More...
 
bool shown
 Widget is shown. More...
 
- 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). More...
 
- Protected Attributes inherited from t3_widget::center_component_t
window_component_tcenter_window
 The window_component_t to center over. More...
 

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::bad_draw_recheck ( void  )
virtual

Function called on reception of the terminal_settings_changed signal.

Implements t3_widget::bad_draw_recheck_t.

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.

void t3_widget::edit_window_t::force_redraw ( void  )
virtual

Request that this window_component_t be completely redrawn.

Reimplemented from t3_widget::widget_t.

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.

bool t3_widget::edit_window_t::is_child ( window_component_t component)
virtual

Determine whether a window_compnent_t is a child of the container_t.

Implements t3_widget::container_t.

void t3_widget::edit_window_t::paste ( void  )

Apply the paste action.

The text to paste is taken from copy_buffer.

bool t3_widget::edit_window_t::process_key ( key_t  key)
virtual

Handle a key press by the user.

Returns
A boolean indicating whether this window_component_t handled the key press.

Implements t3_widget::window_component_t.

bool t3_widget::edit_window_t::process_mouse_event ( mouse_event_t  event)
virtual

Process a mouse event.

Returns
A boolean indicating whether this mouse_target_t handled the mouse event.

Reimplemented from t3_widget::widget_t.

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_child_focus ( window_component_t target)
virtual

Set the focus to a specific window component.

Implements t3_widget::container_t.

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_focus ( focus_t  focus)
virtual

Set whether this window_component_t has the input focus.

Note that this merely notifies the window_component_t that it should change it's appearance to indicate the user that this window_component_t has the input focus. Which window_component_t actually receives the input events is handled outside of the window_component_t.

Reimplemented from t3_widget::widget_t.

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.

bool t3_widget::edit_window_t::set_size ( optint  height,
optint  width 
)
virtual

Set the size of this window_component_t.

Parameters
heightThe new height of the window_component_t in cells, or None if it should remain unchanged.
widthThe new width of the window_component_t in cells, or None if it should remain unchanged.
Returns
A boolean indicating whether all allocations required for the resize operation succeeded.

Implements t3_widget::window_component_t.

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_contents ( void  )
virtual

Update the contents of the window.

Implements t3_widget::window_component_t.

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.