wex v24.10.0
Public Types | Public Member Functions | List of all members
wex::factory::stc Class Referenceabstract

Offers a basic styled text ctrl. More...

#include <wex/factory/stc.h>

Inheritance diagram for wex::factory::stc:
Inheritance graph
[legend]

Public Types

enum  { MARGIN_DIVIDER = 0 , MARGIN_FOLDING = 1 , MARGIN_LINENUMBER = 2 , MARGIN_TEXT = 3 }
 Margin flags. More...
 
typedef std::bitset< 4 > margin_t
 A typedef containing margin flags.
 

Public Member Functions

 stc (const data::window &data=data::window())
 Default constructor.
 
virtual void add_text (const std::string &text)
 Adds text.
 
virtual void add_text_block (const std::string &text)
 Adds text block mode.
 
virtual void append_text (const std::string &text)
 Appends text (to end).
 
virtual bool auto_indentation (int c)
 After pressing enter, starts new line at same place as previous line.
 
virtual wex::data::stcget_data ()
 Returns stc data.
 
virtual const ex_commandget_ex_command () const
 Returns the ex command.
 
virtual const std::string get_find_string () const
 Returns find string, from selected text or from config.
 
virtual bool get_hexmode_erase (int begin, int end)
 Hex erase.
 
virtual bool get_hexmode_insert (const std::string &command, int pos)
 Hex insert.
 
virtual std::string get_hexmode_lines (const std::string &text) const
 Hex lines.
 
virtual bool get_hexmode_replace (char)
 Hex replace.
 
virtual bool get_hexmode_replace_target (const std::string &replacement, bool set_text)
 Hex replace target.
 
virtual bool get_hexmode_sync ()
 Hex sync.
 
virtual bool inject (const data::control &data)
 Injects data.
 
virtual bool is_hexmode () const
 Returns true if we are in hex mode (default false).
 
virtual bool is_visual () const
 Returns true if we are in visual mode (not ex mode) (default true).
 
virtual std::string lexer_name () const
 Returns the name of the lexer.
 
virtual bool lexer_is_previewable () const
 Returns whether lexer is previewable.
 
virtual bool link_open ()
 If selected text is a link, opens the link.
 
virtual bool open (const wex::path &path, const data::stc &data)
 Opens the file, reads the content into the window, then closes the file and sets the lexer.
 
virtual const wex::pathpath () const =0
 Returns the path, as used by the file.
 
virtual void print (bool prompt=true)
 Prints the document.
 
virtual void print_preview (wxPreviewFrameModalityKind kind=wxPreviewFrame_AppModal)
 Shows a print preview.
 
virtual void properties_message (path::log_t flags=path::log_t().set(path::LOG_MOD))
 Shows properties on the statusbar using specified flags.
 
virtual bool set_hexmode (bool on)
 Sets hex mode (default false).
 
virtual void set_search_flags (int flags)
 Sets search flags, default invokes SetSearchFlags.
 
virtual void set_text (const std::string &value)
 Sets the text.
 
virtual void show_ascii_value ()
 Shows decimal or hex info of word under cursor.
 
virtual void show_line_numbers (bool show)
 Shows or hides line numbers.
 
virtual void show_whitespace (bool show)
 Shows or hides whitespace.
 
virtual void sync (bool start=true)
 Starts or stops syncing.
 
virtual void use_modification_markers (bool use)
 Use and show modification markers in the margin.
 
virtual bool vi_command (const line_data &data)
 Runs a vi command on this stc (default false).
 
virtual bool vi_command_finish (bool user_input)
 Finish last vi command (default false).
 
virtual bool vi_is_recording () const
 Returns true if we are recording.
 
virtual bool vi_is_visual () const
 Returns true if we are in vi visual mode (default false).
 
virtual const std::string vi_mode () const
 Returns vi mode as a string.
 
virtual void vi_record (const std::string &command)
 Records a macro.
 
virtual std::string vi_register (char c) const
 Returns vi register.
 
virtual int vi_search_flags () const
 Returns vi search flags.
 
virtual void visual (bool on)
 Sets using visual vi (on) or ex mode (!on).
 
void bind_wx ()
 Binds wx methods.
 
void clear (bool set_savepoint=true)
 Clears the component: all text is cleared and all styles are reset.
 
const std::string eol () const
 Returns EOL string.
 
size_t get_fold_level () const
 Returns current line fold level.
 
int get_margin_text_click () const
 Returns line on which text margin was clicked, or -1 if not.
 
const std::string get_selected_text () const
 Returns selected text as a string.
 
const std::string get_text () const
 Returns the text.
 
const std::string get_word_at_pos (int pos) const
 Returns word at position.
 
std::string margin_get_revision_id () const
 When clicked on a line with a text margin, returns revision id on the text margin, otherwise returns empty string.
 
bool margin_text_is_shown () const
 Returns true if margin text is shown.
 
void margin_text_show ()
 Shows text margin.
 
bool position_restore ()
 Restores saved position.
 
void position_save ()
 Saves position.
 
void reset_margins (margin_t type=margin_t().set())
 Resets (all) margins.
 
void set_margin_text_click (int line)
 Sets the margin line that is clicked (for testing).
 
auto & vcs_renamed () const
 Returns renamed.
 
bool find (const std::string &text, int find_flags=-1, bool find_next=true) override
 Override methods from text_window.
 
int get_current_line () const override
 Returns current line no.
 
int get_line_count () const override
 Returns number of lines.
 
int get_line_count_request () override
 Request for number of lines.
 
void goto_line (int line) override
 Goes to specified line.
 
- Public Member Functions inherited from wex::factory::text_window
virtual ~text_window ()=default
 Destructor.
 

Detailed Description

Offers a basic styled text ctrl.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Margin flags.

Enumerator
MARGIN_DIVIDER 

divider margin

MARGIN_FOLDING 

folding margin

MARGIN_LINENUMBER 

line number margin

MARGIN_TEXT 

text margin

Member Function Documentation

◆ clear()

void wex::factory::stc::clear ( bool set_savepoint = true)

Clears the component: all text is cleared and all styles are reset.

(Clear is used by scintilla to clear the selection).

◆ eol()

const std::string wex::factory::stc::eol ( ) const

Returns EOL string.

If you only want to insert a newline, use NewLine() (from wxStyledTextCtrl).

◆ get_find_string()

virtual const std::string wex::factory::stc::get_find_string ( ) const
inlinevirtual

Returns find string, from selected text or from config.

The search flags are taken from frd. If text is selected, it also sets the find string.

Reimplemented in wex::stc.

◆ path()

virtual const wex::path & wex::factory::stc::path ( ) const
pure virtual

Returns the path, as used by the file.

Pure virtual, must be overridden.

Implemented in wex::stc.

◆ position_restore()

bool wex::factory::stc::position_restore ( )

Restores saved position.

Returns true if position was saved before.

◆ properties_message()

virtual void wex::factory::stc::properties_message ( path::log_t flags = path::log_t().set(path::LOG_MOD))
inlinevirtual

Shows properties on the statusbar using specified flags.

Default not implemented.

Reimplemented in wex::stc.

◆ reset_margins()

void wex::factory::stc::reset_margins ( margin_t type = margin_t().set())

Resets (all) margins.

Default just resets all margins.

◆ set_search_flags()

virtual void wex::factory::stc::set_search_flags ( int flags)
inlinevirtual

Sets search flags, default invokes SetSearchFlags.

search flags to be used:

  • wxSTC_FIND_WHOLEWORD
  • wxSTC_FIND_MATCHCASE
  • wxSTC_FIND_WORDSTART
  • wxSTC_FIND_REGEXP
  • wxSTC_FIND_POSIX

Reimplemented in wex::stc.

◆ sync()

virtual void wex::factory::stc::sync ( bool start = true)
inlinevirtual

Starts or stops syncing.

Default syncing is started during construction.

Reimplemented in wex::stc.

◆ use_modification_markers()

virtual void wex::factory::stc::use_modification_markers ( bool use)
inlinevirtual

Use and show modification markers in the margin.

If you open a file, the modification markers are used.

Reimplemented in wex::stc.