Nana C++ Library. Reference for users.
What we need to use nana
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
nana::widgets::skeletons::text_editor Class Reference

Classes

class  behavior_linewrapped
 
class  behavior_normal
 
class  editor_behavior_interface
 
class  helper_pencil
 
struct  implementation
 
class  keyword_parser
 
struct  renderers
 
struct  text_section
 
class  undo_backspace
 
class  undo_input_text
 
class  undo_move_text
 

Public Types

enum  accepts { accepts::no_restrict, accepts::integer, accepts::real }
 
using char_type = wchar_t
 
using size_type = textbase< char_type >::size_type
 
using string_type = textbase< char_type >::string_type
 
using path_type = std::filesystem::path
 
using event_interface = text_editor_event_interface
 
using graph_reference = ::nana::paint::graphics &
 

Public Member Functions

 text_editor (window, graph_reference, const text_editor_scheme *)
 
 ~text_editor ()
 
size caret_size () const
 
const pointcontent_origin () const
 
void set_highlight (const ::std::string &name, const ::nana::color &, const ::nana::color &)
 
void erase_highlight (const ::std::string &name)
 
void set_keyword (const ::std::wstring &kw, const std::string &name, bool case_sensitive, bool whole_word_matched)
 
void erase_keyword (const ::std::wstring &kw)
 
colored_area_access_interfacecolored_area ()
 
void set_accept (std::function< bool(char_type)>)
 
void set_accept (accepts)
 
bool respond_ime (const arg_ime &arg)
 
bool respond_char (const arg_keyboard &arg)
 
bool respond_key (const arg_keyboard &arg)
 
void typeface_changed ()
 
void indent (bool, std::function< std::string()> generator)
 
void set_event (event_interface *)
 
bool load (const path_type &file)
 
void text_align (::nana::align alignment)
 
bool text_area (const nana::rectangle &)
 
rectangle text_area (bool including_scroll) const
 Returns the text area. More...
 
bool tip_string (::std::string &&)
 
const attributes & attr () const noexcept
 Returns the reference of listbox attributes. More...
 
bool line_wrapped (bool)
 Set the text_editor whether it is line wrapped, it returns false if the state is not changed. More...
 
bool multi_lines (bool)
 
void editable (bool enable, bool enable_caret)
 Enables/disables the editability of text_editor. More...
 
void enable_background (bool)
 
void enable_background_counterpart (bool)
 
void undo_clear ()
 
void undo_max_steps (std::size_t)
 
std::size_t undo_max_steps () const
 
rendererscustomized_renderers ()
 
unsigned line_height () const
 
unsigned screen_lines (bool completed_line=false) const
 
bool getline (std::size_t pos,::std::wstring &) const
 
void text (std::wstring, bool end_caret)
 
std::wstring text () const
 
bool move_caret (upoint pos, bool stay_in_view=false)
 Moves the caret at specified position. More...
 
void move_caret_end (bool update)
 
void reset_caret_pixels () const
 
void reset_caret (bool stay_in_view=false)
 
void show_caret (bool isshow)
 
bool selected () const
 
bool get_selected_points (nana::upoint &, nana::upoint &) const
 
bool select (bool)
 
bool select_points (nana::upoint arg_a, nana::upoint arg_b)
 
void set_end_caret (bool stay_in_view)
 Sets the end position of a selected string. More...
 
bool hit_text_area (const point &) const
 
bool hit_select_area (nana::upoint pos, bool ignore_when_select_all) const
 
bool move_select ()
 
bool mask (wchar_t)
 
unsigned width_pixels () const
 Returns width of text area excluding the vscroll size. More...
 
window window_handle () const
 
const std::vector< upoint > & text_position () const
 Returns text position of each line that currently displays on screen. More...
 
void focus_behavior (text_focus_behavior)
 
void select_behavior (bool move_to_end)
 
std::size_t line_count (bool text_lines) const
 
void draw_corner ()
 
void render (bool focused)
 
void put (std::wstring, bool perform_event)
 
void put (wchar_t)
 
void copy () const
 
void cut ()
 
void paste ()
 
void enter (bool record_undo, bool perform_event)
 
void del ()
 
void backspace (bool record_undo, bool perform_event)
 
void undo (bool reverse)
 
void move_ns (bool to_north)
 
void move_left ()
 
void move_right ()
 
const upointmouse_caret (const point &screen_pos, bool stay_in_view)
 
const upointcaret () const noexcept
 
point caret_screen_pos () const
 
bool scroll (bool upwards, bool vertical)
 
bool focus_changed (const arg_focus &)
 
bool mouse_enter (bool entering)
 
bool mouse_move (bool left_button, const point &screen_pos)
 
void mouse_pressed (const arg_mouse &arg)
 
bool select_word (const arg_mouse &arg)
 
skeletons::textbase< char_type > & textbase () noexcept
 
const skeletons::textbase
< char_type > & 
textbase () const noexcept
 
bool try_refresh ()
 
std::shared_ptr
< scroll_operation_interface
scroll_operation () const
 

Member Typedef Documentation

using nana::widgets::skeletons::text_editor::path_type = std::filesystem::path

Member Enumeration Documentation

Enumerator
no_restrict 
integer 
real 

Constructor & Destructor Documentation

nana::widgets::skeletons::text_editor::text_editor ( window  wd,
graph_reference  graph,
const text_editor_scheme schm 
)
nana::widgets::skeletons::text_editor::~text_editor ( )

Member Function Documentation

const text_editor::attributes & nana::widgets::skeletons::text_editor::attr ( ) const
noexcept

Returns the reference of listbox attributes.

void nana::widgets::skeletons::text_editor::backspace ( bool  record_undo,
bool  perform_event 
)
const upoint & nana::widgets::skeletons::text_editor::caret ( ) const
noexcept
point nana::widgets::skeletons::text_editor::caret_screen_pos ( ) const
size nana::widgets::skeletons::text_editor::caret_size ( ) const
colored_area_access_interface & nana::widgets::skeletons::text_editor::colored_area ( )
const point & nana::widgets::skeletons::text_editor::content_origin ( ) const
void nana::widgets::skeletons::text_editor::copy ( ) const
auto nana::widgets::skeletons::text_editor::customized_renderers ( )
void nana::widgets::skeletons::text_editor::cut ( )
void nana::widgets::skeletons::text_editor::del ( )
void nana::widgets::skeletons::text_editor::draw_corner ( )
void nana::widgets::skeletons::text_editor::editable ( bool  enable,
bool  enable_caret 
)

Enables/disables the editability of text_editor.

Parameters
enableIndicates whether to enable or disable the editability
enable_cartIndicates whether to show or hide the caret when the text_editor is not editable. It is ignored if enable is false.
void nana::widgets::skeletons::text_editor::enable_background ( bool  enb)
void nana::widgets::skeletons::text_editor::enable_background_counterpart ( bool  enb)
void nana::widgets::skeletons::text_editor::enter ( bool  record_undo,
bool  perform_event 
)
void nana::widgets::skeletons::text_editor::erase_highlight ( const ::std::string name)
void nana::widgets::skeletons::text_editor::erase_keyword ( const ::std::wstring kw)
void nana::widgets::skeletons::text_editor::focus_behavior ( text_focus_behavior  behavior)
bool nana::widgets::skeletons::text_editor::focus_changed ( const arg_focus arg)
bool nana::widgets::skeletons::text_editor::get_selected_points ( nana::upoint a,
nana::upoint b 
) const
bool nana::widgets::skeletons::text_editor::getline ( std::size_t  pos,
::std::wstring  
) const
bool nana::widgets::skeletons::text_editor::hit_select_area ( nana::upoint  pos,
bool  ignore_when_select_all 
) const
bool nana::widgets::skeletons::text_editor::hit_text_area ( const point pos) const
void nana::widgets::skeletons::text_editor::indent ( bool  enb,
std::function< std::string()>  generator 
)
std::size_t nana::widgets::skeletons::text_editor::line_count ( bool  text_lines) const
unsigned nana::widgets::skeletons::text_editor::line_height ( ) const
bool nana::widgets::skeletons::text_editor::line_wrapped ( bool  autl)

Set the text_editor whether it is line wrapped, it returns false if the state is not changed.

bool nana::widgets::skeletons::text_editor::load ( const path_type file)
bool nana::widgets::skeletons::text_editor::mask ( wchar_t  ch)
const upoint & nana::widgets::skeletons::text_editor::mouse_caret ( const point screen_pos,
bool  stay_in_view 
)
bool nana::widgets::skeletons::text_editor::mouse_enter ( bool  entering)
bool nana::widgets::skeletons::text_editor::mouse_move ( bool  left_button,
const point screen_pos 
)
void nana::widgets::skeletons::text_editor::mouse_pressed ( const arg_mouse arg)
bool nana::widgets::skeletons::text_editor::move_caret ( upoint  pos,
bool  stay_in_view = false 
)

Moves the caret at specified position.

Parameters
posthe text position
stay_in_viewIndicates whether to adjust the view to make the caret in view. This parameter is ignored if the caret is already in view.
Returns
true indicates a refresh is required.
void nana::widgets::skeletons::text_editor::move_caret_end ( bool  update)
void nana::widgets::skeletons::text_editor::move_left ( )
void nana::widgets::skeletons::text_editor::move_ns ( bool  to_north)
void nana::widgets::skeletons::text_editor::move_right ( )
bool nana::widgets::skeletons::text_editor::move_select ( )
bool nana::widgets::skeletons::text_editor::multi_lines ( bool  ml)
void nana::widgets::skeletons::text_editor::paste ( )
void nana::widgets::skeletons::text_editor::put ( std::wstring  text,
bool  perform_event 
)
void nana::widgets::skeletons::text_editor::put ( wchar_t  ch)
void nana::widgets::skeletons::text_editor::render ( bool  focused)
void nana::widgets::skeletons::text_editor::reset_caret ( bool  stay_in_view = false)
void nana::widgets::skeletons::text_editor::reset_caret_pixels ( ) const
bool nana::widgets::skeletons::text_editor::respond_char ( const arg_keyboard arg)
bool nana::widgets::skeletons::text_editor::respond_ime ( const arg_ime arg)
bool nana::widgets::skeletons::text_editor::respond_key ( const arg_keyboard arg)
unsigned nana::widgets::skeletons::text_editor::screen_lines ( bool  completed_line = false) const
bool nana::widgets::skeletons::text_editor::scroll ( bool  upwards,
bool  vertical 
)
std::shared_ptr< scroll_operation_interface > nana::widgets::skeletons::text_editor::scroll_operation ( ) const
bool nana::widgets::skeletons::text_editor::select ( bool  yes)
void nana::widgets::skeletons::text_editor::select_behavior ( bool  move_to_end)
bool nana::widgets::skeletons::text_editor::select_points ( nana::upoint  arg_a,
nana::upoint  arg_b 
)
bool nana::widgets::skeletons::text_editor::select_word ( const arg_mouse arg)
bool nana::widgets::skeletons::text_editor::selected ( ) const
void nana::widgets::skeletons::text_editor::set_accept ( std::function< bool(char_type)>  pred)
void nana::widgets::skeletons::text_editor::set_accept ( accepts  acceptive)
void nana::widgets::skeletons::text_editor::set_end_caret ( bool  stay_in_view)

Sets the end position of a selected string.

void nana::widgets::skeletons::text_editor::set_event ( event_interface ptr)
void nana::widgets::skeletons::text_editor::set_highlight ( const ::std::string name,
const ::nana::color ,
const ::nana::color  
)
void nana::widgets::skeletons::text_editor::set_keyword ( const ::std::wstring kw,
const std::string name,
bool  case_sensitive,
bool  whole_word_matched 
)
void nana::widgets::skeletons::text_editor::show_caret ( bool  isshow)
void nana::widgets::skeletons::text_editor::text ( std::wstring  str,
bool  end_caret 
)
std::wstring nana::widgets::skeletons::text_editor::text ( ) const
void nana::widgets::skeletons::text_editor::text_align ( ::nana::align  alignment)
bool nana::widgets::skeletons::text_editor::text_area ( const nana::rectangle r)

Sets the text area.

Returns
true if the area is changed with the new value.
rectangle nana::widgets::skeletons::text_editor::text_area ( bool  including_scroll) const

Returns the text area.

const std::vector< upoint > & nana::widgets::skeletons::text_editor::text_position ( ) const

Returns text position of each line that currently displays on screen.

textbase< text_editor::char_type > & nana::widgets::skeletons::text_editor::textbase ( )
noexcept
const textbase< text_editor::char_type > & nana::widgets::skeletons::text_editor::textbase ( ) const
noexcept
bool nana::widgets::skeletons::text_editor::tip_string ( ::std::string &&  str)
bool nana::widgets::skeletons::text_editor::try_refresh ( )
void nana::widgets::skeletons::text_editor::typeface_changed ( )
void nana::widgets::skeletons::text_editor::undo ( bool  reverse)
void nana::widgets::skeletons::text_editor::undo_clear ( )
void nana::widgets::skeletons::text_editor::undo_max_steps ( std::size_t  maxs)
std::size_t nana::widgets::skeletons::text_editor::undo_max_steps ( ) const
unsigned nana::widgets::skeletons::text_editor::width_pixels ( ) const

Returns width of text area excluding the vscroll size.

window nana::widgets::skeletons::text_editor::window_handle ( ) const