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

Offers a styled text ctrl with: 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...
 

Public Member Functions

virtual void add_text (const std::string &text)
 Virtual interface. More...
 
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 void fold (bool fold_all=false)
 Enables or disables folding depending on fold property (default not implemented). More...
 
virtual const ex_commandget_ex_command () const
 Returns a ex command.
 
virtual const std::string get_find_string () const
 Returns find string, from selected text or from config. More...
 
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)
 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 int get_margin_text_click () const
 Returns line on which text margin was clicked, or -1 if not.
 
virtual const std::string get_word_at_pos (int pos) const
 Returns word at position.
 
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 (default true).
 
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. More...
 
virtual bool position_restore ()
 Restores saved position. More...
 
virtual void position_save ()
 Saves position.
 
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. More...
 
virtual void reset_margins (margin_t type=margin_t().set())
 Reset all margins. More...
 
virtual bool set_hexmode (bool on)
 Sets hex mode (default false).
 
virtual bool set_indicator (const indicator &indicator, int start, int end)
 Sets an indicator at specified start and end pos. More...
 
virtual void set_search_flags (int flags)
 Sets search flags, default invokes SetSearchFlags. More...
 
virtual void set_text (const std::string &value)
 Sets the text.
 
virtual void show_line_numbers (bool show)
 Shows or hides line numbers.
 
virtual void sync (bool start=true)
 Starts or stops syncing. More...
 
virtual void use_modification_markers (bool use)
 Use and show modification markers in the margin. More...
 
virtual bool vi_command (const std::string &command)
 Runs a vi command on this stc (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).
 
const std::string eol () const
 Other methods. More...
 
size_t get_fold_level () const
 Returns current line fold level.
 
const auto & get_lexer () const
 Returns the lexer.
 
auto & get_lexer ()
 Returns the lexer.
 
const std::string get_selected_text () const
 Returns selected text as a string.
 
const std::string get_text () const
 Returns the text.
 
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 styled text ctrl with:

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

◆ add_text()

virtual void wex::factory::stc::add_text ( const std::string &  text)
inlinevirtual

Virtual interface.

Adds text.

Reimplemented in wex::stc.

◆ eol()

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

Other methods.

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

◆ fold()

virtual void wex::factory::stc::fold ( bool  fold_all = false)
inlinevirtual

Enables or disables folding depending on fold property (default not implemented).

Parameters
fold_allif document contains more than 'Auto fold' lines, or if fold_all (and fold property is on) is specified, always all lines are folded.

Reimplemented in wex::stc.

◆ 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()

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

Restores saved position.

Returns true if position was saved before.

Reimplemented in wex::stc.

◆ 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()

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

Reset all margins.

Default not implemented.

Reimplemented in wex::stc.

◆ set_indicator()

virtual bool wex::factory::stc::set_indicator ( const indicator indicator,
int  start,
int  end 
)
inlinevirtual

Sets an indicator at specified start and end pos.

Default false, not implemented.

Reimplemented in wex::stc.

◆ 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.