wex v24.04.0
Public Types | Public Member Functions | List of all members
wex::data::control Class Reference

Offers user data to be used by ctrl classes (as listview, stc). More...

#include <wex/factory/control.h>

Inheritance diagram for wex::data::control:
Inheritance graph
[legend]

Public Types

enum  action_t {
  INV , NOT , OR , SET ,
  XOR
}
 Determine how flags value are set. More...
 

Public Member Functions

const auto col () const
 Returns col.
 
controlcol (int col)
 Sets column.
 
const auto & command () const
 Returns command.
 
controlcommand (const std::string &rhs)
 Sets command.
 
controlis_ctag (bool rhs)
 Sets is_ctag.
 
const auto & find () const
 Returns find.
 
controlfind (const std::string &text, int find_flags=0)
 Sets find.
 
const auto find_flags () const
 Returns find flags.
 
template<std::size_t N>
controlflags (const std::bitset< N > &flags, std::bitset< N > &result, action_t action=SET)
 Sets specified flags.
 
bool inject (const std::function< bool(void)> &line=nullptr, const std::function< bool(void)> &col=nullptr, const std::function< bool(void)> &find=nullptr, const std::function< bool(void)> &command=nullptr) const
 injects data.
 
const auto is_required () const
 Returns required.
 
controlis_required (bool required)
 Sets required.
 
const auto line () const
 Returns line.
 
controlline (int line, std::function< int(int)> f=nullptr)
 Sets line number.
 
const auto validator () const
 Returns validator.
 
controlvalidator (wxValidator *validator)
 Sets validator.
 
const auto & window () const
 Returns window data.
 
controlwindow (const data::window &data)
 Sets window data.
 
void reset () override
 Resets members to default state.
 
- Public Member Functions inherited from wex::line_data
const auto col () const
 Returns column.
 
line_datacol (int col)
 Sets column.
 
const auto & command () const
 Returns command.
 
line_datacommand (const std::string &command)
 Sets command.
 
auto is_ctag () const
 Returns true if command is a ctag command.
 
line_datais_ctag (bool rhs)
 Sets ctag.
 
const auto line () const
 Returns line number.
 
line_dataline (int line, std::function< int(int)> f=nullptr)
 Sets line number.
 

Detailed Description

Offers user data to be used by ctrl classes (as listview, stc).

First you can set the data using col, command, line, etc., then call inject to perform the action. You can set several items, inject prioritizes the actions.

Member Enumeration Documentation

◆ action_t

Determine how flags value are set.

Enumerator
INV 

sets value and flips result

NOT 

remove this flag

OR 

add this flag

SET 

set value

XOR 

xor this flag

Member Function Documentation

◆ find()

control & wex::data::control::find ( const std::string & text,
int find_flags = 0 )

Sets find.

If not empty selects the text on that line (if line was specified) or finds text from begin (if line was 0) or end (line was -1).

Parameters
texttext to find
find_flagsfind flags to be used

◆ flags()

template<std::size_t N>
control & wex::data::control::flags ( const std::bitset< N > & flags,
std::bitset< N > & result,
action_t action = SET )
inline

Sets specified flags.

This is used by the other data classes as generic method to operate on flags.

◆ inject()

bool wex::data::control::inject ( const std::function< bool(void)> & line = nullptr,
const std::function< bool(void)> & col = nullptr,
const std::function< bool(void)> & find = nullptr,
const std::function< bool(void)> & command = nullptr ) const

injects data.

If there is a callback specified, injects current data in it:

  • if line available: goto line
  • if col available: goto col
  • if text not empty: finds text
  • if vi command not empty: executes vi command
  • if flags are set: sets flag on Control Returns true if data could be injected into the control.
Parameters
linecallback to inject line number
colcallback to inject column number
findcallback to inject find text
commandcallback to inject vi command

◆ line()

control & wex::data::control::line ( int line,
std::function< int(int)> f = nullptr )
inline

Sets line number.

Goes to the line if > 0, if -1 goes to end of file