TokenizedTextWidget

Detailed Description

Classes

struct  TokenizedTextWidgetCursorPosition
 
class  TokenizedTextWidget
 QWidget that displays lines of InstructionTextTokens with the ability to make selections. More...
 

Enumerations

enum  TokenizedTextWidgetSelectionStyle {
  NoSelection = 1 << 0 , SelectLines = 1 << 1 , SelectOneToken = 1 << 2 , SelectTokens = 1 << 3 ,
  SelectCharacters = 1 << 4 , AllStyles = NoSelection | SelectLines | SelectOneToken | SelectTokens | SelectCharacters
}
 

Class Documentation

◆ TokenizedTextWidgetCursorPosition

struct TokenizedTextWidgetCursorPosition

Public Member Functions

bool isValid () const
 
bool operator== (const TokenizedTextWidgetCursorPosition &other) const
 
bool operator!= (const TokenizedTextWidgetCursorPosition &other) const
 
bool operator< (const TokenizedTextWidgetCursorPosition &other) const
 

Public Attributes

size_t lineIndex = BN_INVALID_OPERAND
 Index of line in widget. More...
 
size_t tokenIndex = BN_INVALID_OPERAND
 Index of token in current line. More...
 
size_t characterIndex = BN_INVALID_OPERAND
 Index of character in current token. More...
 
int cursorX
 
int cursorY
 

Member Function Documentation

◆ isValid()

bool TokenizedTextWidgetCursorPosition::isValid ( ) const
inline

◆ operator==()

bool TokenizedTextWidgetCursorPosition::operator== ( const TokenizedTextWidgetCursorPosition other) const

◆ operator!=()

bool TokenizedTextWidgetCursorPosition::operator!= ( const TokenizedTextWidgetCursorPosition other) const
inline

◆ operator<()

bool TokenizedTextWidgetCursorPosition::operator< ( const TokenizedTextWidgetCursorPosition other) const

Member Data Documentation

◆ lineIndex

size_t TokenizedTextWidgetCursorPosition::lineIndex = BN_INVALID_OPERAND

Index of line in widget.

◆ tokenIndex

size_t TokenizedTextWidgetCursorPosition::tokenIndex = BN_INVALID_OPERAND

Index of token in current line.

◆ characterIndex

size_t TokenizedTextWidgetCursorPosition::characterIndex = BN_INVALID_OPERAND

Index of character in current token.

◆ cursorX

int TokenizedTextWidgetCursorPosition::cursorX

◆ cursorY

int TokenizedTextWidgetCursorPosition::cursorY

◆ TokenizedTextWidget

class TokenizedTextWidget

QWidget that displays lines of InstructionTextTokens with the ability to make selections.

Signals

void sizeChanged (int cols, int rows)
 
void visibleChanged (int leftCol, int topRow)
 
void linesChanged ()
 
void selectionChanged (const TokenizedTextWidgetCursorPosition &begin, const TokenizedTextWidgetCursorPosition &end)
 
void tokenLeftClicked (const TokenizedTextWidgetCursorPosition &position)
 
void tokenRightClicked (const TokenizedTextWidgetCursorPosition &position)
 
void tokenDoubleClicked (const TokenizedTextWidgetCursorPosition &position)
 
void tokenOtherClicked (const TokenizedTextWidgetCursorPosition &position, Qt::MouseButton button)
 
void tokenHovered (const TokenizedTextWidgetCursorPosition &position)
 
void lineLeftClicked (size_t lineIndex)
 
void lineRightClicked (size_t lineIndex)
 
void lineDoubleClicked (size_t lineIndex)
 
void lineOtherClicked (size_t lineIndex, Qt::MouseButton button)
 
void lineHovered (size_t lineIndex)
 

Public Member Functions

 TokenizedTextWidget (QWidget *parent, const std::vector< BinaryNinja::LinearDisassemblyLine > &lines=std::vector< BinaryNinja::LinearDisassemblyLine >())
 
virtual ~TokenizedTextWidget ()
 
void bindActions ()
 
QFont font () const
 
void setFont (const QFont &font)
 
DisassemblySettingsRef settings ()
 
const DisassemblySettingsRefsettings () const
 
int topLineIndex () const
 
int leftmostCharIndex () const
 
int visibleColumnCount () const
 
int visibleRowCount () const
 
int contentsColumnCount () const
 
int contentsRowCount () const
 
bool hasSelection () const
 
TokenizedTextWidgetSelectionStyle selectionStyle () const
 
TokenizedTextWidgetCursorPosition selectionBegin () const
 
TokenizedTextWidgetCursorPosition selectionEnd () const
 
TokenizedTextWidgetCursorPosition selectionBase () const
 
TokenizedTextWidgetCursorPosition cursorPosition () const
 
bool forceLineSelect () const
 
void setForceLineSelect (bool value)
 
void setSelection (TokenizedTextWidgetCursorPosition base, TokenizedTextWidgetCursorPosition cursor, TokenizedTextWidgetSelectionStyle mode)
 
void setCursorPosition (TokenizedTextWidgetCursorPosition newPosition, bool selecting, bool cursorKeys, bool evenIfNoChange)
 
void moveCursorHorizontal (int count, bool allTheWay, bool selecting, bool cursorKeys)
 
void moveCursorVertical (int count, bool allTheWay, bool selecting, bool cursorKeys)
 
bool autoScrollHorizontal () const
 
void setAutoScrollHorizontal (bool value)
 
bool autoScrollVertical () const
 
void setAutoScrollVertical (bool value)
 
HighlightTokenState highlightTokenState ()
 
UIActionHandleractionHandler ()
 
virtual UIActionContext actionContext ()
 
MenucontextMenu ()
 
void showContextMenu ()
 
void left (size_t count, bool selecting)
 
void right (size_t count, bool selecting)
 
void leftToWord (bool selecting)
 
void rightToWord (bool selecting)
 
void up (bool selecting)
 
void down (bool selecting)
 
void pageUp (bool selecting)
 
void pageDown (bool selecting)
 
void moveToStartOfLine (bool selecting)
 
void moveToEndOfLine (bool selecting)
 
void moveToStartOfView (bool selecting)
 
void moveToEndOfView (bool selecting)
 
void selectAll ()
 
void selectNone ()
 
void scrollLines (int count)
 
void scrollLineToVisible (int lineIndex)
 
void scrollLineToTop (int lineIndex)
 
void scrollChars (int count)
 
void scrollCharToVisible (int charIndex)
 
void scrollCharToLeftmost (int charIndex)
 
void copy () const
 
std::string selectedText () const
 
const std::vector< BinaryNinja::LinearDisassemblyLine > & lines () const
 
std::optional< std::reference_wrapper< const BinaryNinja::LinearDisassemblyLine > > lineAtPosition (const TokenizedTextWidgetCursorPosition &position) const
 
std::optional< std::reference_wrapper< const BinaryNinja::InstructionTextToken > > tokenAtPosition (const TokenizedTextWidgetCursorPosition &position) const
 
std::optional< char > charAtPosition (const TokenizedTextWidgetCursorPosition &position) const
 
void clearLines ()
 
void setLines (const std::vector< BinaryNinja::LinearDisassemblyLine > &lines, bool resetScroll=true)
 
void setLines (const std::vector< BinaryNinja::DisassemblyTextLine > &lines, bool resetScroll=true)
 
void setLines (const std::vector< BinaryNinja::TypeDefinitionLine > &lines, bool resetScroll=true)
 
int lineCopyStyles (size_t lineIndex) const
 
void setLineCopyStyles (size_t lineIndex, int styles)
 
int tokenCopyStyles (size_t lineIndex, size_t tokenIndex) const
 
void setTokenCopyStyles (size_t lineIndex, size_t tokenIndex, int styles)
 
bool tokenSelectLineTarget (size_t lineIndex, size_t tokenIndex) const
 
void setTokenSelectLineTarget (size_t lineIndex, size_t tokenIndex, bool selectLineTarget)
 

Protected Member Functions

virtual void updateMetadata (const std::vector< BinaryNinja::LinearDisassemblyLine > &lines, int &width, int &height)
 
virtual void resizeEvent (QResizeEvent *event) override
 
virtual void paintEvent (QPaintEvent *event) override
 
virtual void wheelEvent (QWheelEvent *event) override
 
virtual void mousePressEvent (QMouseEvent *event) override
 
virtual void mouseMoveEvent (QMouseEvent *event) override
 
virtual void mouseDoubleClickEvent (QMouseEvent *event) override
 
virtual void leaveEvent (QEvent *event) override
 
virtual void focusInEvent (QFocusEvent *event) override
 
virtual void focusOutEvent (QFocusEvent *event) override
 
virtual void contextMenuEvent (QContextMenuEvent *event) override
 

Constructor & Destructor Documentation

◆ TokenizedTextWidget()

TokenizedTextWidget::TokenizedTextWidget ( QWidget *  parent,
const std::vector< BinaryNinja::LinearDisassemblyLine > &  lines = std::vector< BinaryNinja::LinearDisassemblyLine >() 
)
explicit

◆ ~TokenizedTextWidget()

virtual TokenizedTextWidget::~TokenizedTextWidget ( )
virtual

Member Function Documentation

◆ updateMetadata()

virtual void TokenizedTextWidget::updateMetadata ( const std::vector< BinaryNinja::LinearDisassemblyLine > &  lines,
int &  width,
int &  height 
)
protectedvirtual

◆ bindActions()

void TokenizedTextWidget::bindActions ( )

◆ font()

QFont TokenizedTextWidget::font ( ) const

◆ setFont()

void TokenizedTextWidget::setFont ( const QFont &  font)

◆ settings() [1/2]

DisassemblySettingsRef TokenizedTextWidget::settings ( )
inline

◆ settings() [2/2]

const DisassemblySettingsRef & TokenizedTextWidget::settings ( ) const
inline

◆ topLineIndex()

int TokenizedTextWidget::topLineIndex ( ) const

◆ leftmostCharIndex()

int TokenizedTextWidget::leftmostCharIndex ( ) const

◆ visibleColumnCount()

int TokenizedTextWidget::visibleColumnCount ( ) const
inline

◆ visibleRowCount()

int TokenizedTextWidget::visibleRowCount ( ) const
inline

◆ contentsColumnCount()

int TokenizedTextWidget::contentsColumnCount ( ) const
inline

◆ contentsRowCount()

int TokenizedTextWidget::contentsRowCount ( ) const
inline

◆ hasSelection()

bool TokenizedTextWidget::hasSelection ( ) const

◆ selectionStyle()

TokenizedTextWidgetSelectionStyle TokenizedTextWidget::selectionStyle ( ) const

◆ selectionBegin()

TokenizedTextWidgetCursorPosition TokenizedTextWidget::selectionBegin ( ) const

◆ selectionEnd()

TokenizedTextWidgetCursorPosition TokenizedTextWidget::selectionEnd ( ) const

◆ selectionBase()

TokenizedTextWidgetCursorPosition TokenizedTextWidget::selectionBase ( ) const

◆ cursorPosition()

TokenizedTextWidgetCursorPosition TokenizedTextWidget::cursorPosition ( ) const

◆ forceLineSelect()

bool TokenizedTextWidget::forceLineSelect ( ) const
inline

◆ setForceLineSelect()

void TokenizedTextWidget::setForceLineSelect ( bool  value)
inline

◆ setSelection()

void TokenizedTextWidget::setSelection ( TokenizedTextWidgetCursorPosition  base,
TokenizedTextWidgetCursorPosition  cursor,
TokenizedTextWidgetSelectionStyle  mode 
)

◆ setCursorPosition()

void TokenizedTextWidget::setCursorPosition ( TokenizedTextWidgetCursorPosition  newPosition,
bool  selecting,
bool  cursorKeys,
bool  evenIfNoChange 
)

◆ moveCursorHorizontal()

void TokenizedTextWidget::moveCursorHorizontal ( int  count,
bool  allTheWay,
bool  selecting,
bool  cursorKeys 
)

◆ moveCursorVertical()

void TokenizedTextWidget::moveCursorVertical ( int  count,
bool  allTheWay,
bool  selecting,
bool  cursorKeys 
)

◆ autoScrollHorizontal()

bool TokenizedTextWidget::autoScrollHorizontal ( ) const
inline

◆ setAutoScrollHorizontal()

void TokenizedTextWidget::setAutoScrollHorizontal ( bool  value)
inline

◆ autoScrollVertical()

bool TokenizedTextWidget::autoScrollVertical ( ) const
inline

◆ setAutoScrollVertical()

void TokenizedTextWidget::setAutoScrollVertical ( bool  value)
inline

◆ highlightTokenState()

HighlightTokenState TokenizedTextWidget::highlightTokenState ( )

◆ actionHandler()

UIActionHandler * TokenizedTextWidget::actionHandler ( )
inline

◆ actionContext()

virtual UIActionContext TokenizedTextWidget::actionContext ( )
virtual

◆ contextMenu()

Menu & TokenizedTextWidget::contextMenu ( )
inline

◆ showContextMenu()

void TokenizedTextWidget::showContextMenu ( )

◆ left()

void TokenizedTextWidget::left ( size_t  count,
bool  selecting 
)

◆ right()

void TokenizedTextWidget::right ( size_t  count,
bool  selecting 
)

◆ leftToWord()

void TokenizedTextWidget::leftToWord ( bool  selecting)

◆ rightToWord()

void TokenizedTextWidget::rightToWord ( bool  selecting)

◆ up()

void TokenizedTextWidget::up ( bool  selecting)

◆ down()

void TokenizedTextWidget::down ( bool  selecting)

◆ pageUp()

void TokenizedTextWidget::pageUp ( bool  selecting)

◆ pageDown()

void TokenizedTextWidget::pageDown ( bool  selecting)

◆ moveToStartOfLine()

void TokenizedTextWidget::moveToStartOfLine ( bool  selecting)

◆ moveToEndOfLine()

void TokenizedTextWidget::moveToEndOfLine ( bool  selecting)

◆ moveToStartOfView()

void TokenizedTextWidget::moveToStartOfView ( bool  selecting)

◆ moveToEndOfView()

void TokenizedTextWidget::moveToEndOfView ( bool  selecting)

◆ selectAll()

void TokenizedTextWidget::selectAll ( )

◆ selectNone()

void TokenizedTextWidget::selectNone ( )

◆ scrollLines()

void TokenizedTextWidget::scrollLines ( int  count)

◆ scrollLineToVisible()

void TokenizedTextWidget::scrollLineToVisible ( int  lineIndex)

◆ scrollLineToTop()

void TokenizedTextWidget::scrollLineToTop ( int  lineIndex)

◆ scrollChars()

void TokenizedTextWidget::scrollChars ( int  count)

◆ scrollCharToVisible()

void TokenizedTextWidget::scrollCharToVisible ( int  charIndex)

◆ scrollCharToLeftmost()

void TokenizedTextWidget::scrollCharToLeftmost ( int  charIndex)

◆ copy()

void TokenizedTextWidget::copy ( ) const

◆ selectedText()

std::string TokenizedTextWidget::selectedText ( ) const

◆ lines()

const std::vector< BinaryNinja::LinearDisassemblyLine > & TokenizedTextWidget::lines ( ) const
inline

◆ lineAtPosition()

std::optional< std::reference_wrapper< const BinaryNinja::LinearDisassemblyLine > > TokenizedTextWidget::lineAtPosition ( const TokenizedTextWidgetCursorPosition position) const

◆ tokenAtPosition()

std::optional< std::reference_wrapper< const BinaryNinja::InstructionTextToken > > TokenizedTextWidget::tokenAtPosition ( const TokenizedTextWidgetCursorPosition position) const

◆ charAtPosition()

std::optional< char > TokenizedTextWidget::charAtPosition ( const TokenizedTextWidgetCursorPosition position) const

◆ clearLines()

void TokenizedTextWidget::clearLines ( )

◆ setLines() [1/3]

void TokenizedTextWidget::setLines ( const std::vector< BinaryNinja::LinearDisassemblyLine > &  lines,
bool  resetScroll = true 
)

◆ setLines() [2/3]

void TokenizedTextWidget::setLines ( const std::vector< BinaryNinja::DisassemblyTextLine > &  lines,
bool  resetScroll = true 
)

◆ setLines() [3/3]

void TokenizedTextWidget::setLines ( const std::vector< BinaryNinja::TypeDefinitionLine > &  lines,
bool  resetScroll = true 
)

◆ lineCopyStyles()

int TokenizedTextWidget::lineCopyStyles ( size_t  lineIndex) const

◆ setLineCopyStyles()

void TokenizedTextWidget::setLineCopyStyles ( size_t  lineIndex,
int  styles 
)

◆ tokenCopyStyles()

int TokenizedTextWidget::tokenCopyStyles ( size_t  lineIndex,
size_t  tokenIndex 
) const

◆ setTokenCopyStyles()

void TokenizedTextWidget::setTokenCopyStyles ( size_t  lineIndex,
size_t  tokenIndex,
int  styles 
)

◆ tokenSelectLineTarget()

bool TokenizedTextWidget::tokenSelectLineTarget ( size_t  lineIndex,
size_t  tokenIndex 
) const

◆ setTokenSelectLineTarget()

void TokenizedTextWidget::setTokenSelectLineTarget ( size_t  lineIndex,
size_t  tokenIndex,
bool  selectLineTarget 
)

◆ sizeChanged

void TokenizedTextWidget::sizeChanged ( int  cols,
int  rows 
)
signal

◆ visibleChanged

void TokenizedTextWidget::visibleChanged ( int  leftCol,
int  topRow 
)
signal

◆ linesChanged

void TokenizedTextWidget::linesChanged ( )
signal

◆ selectionChanged

void TokenizedTextWidget::selectionChanged ( const TokenizedTextWidgetCursorPosition begin,
const TokenizedTextWidgetCursorPosition end 
)
signal

◆ tokenLeftClicked

void TokenizedTextWidget::tokenLeftClicked ( const TokenizedTextWidgetCursorPosition position)
signal

◆ tokenRightClicked

void TokenizedTextWidget::tokenRightClicked ( const TokenizedTextWidgetCursorPosition position)
signal

◆ tokenDoubleClicked

void TokenizedTextWidget::tokenDoubleClicked ( const TokenizedTextWidgetCursorPosition position)
signal

◆ tokenOtherClicked

void TokenizedTextWidget::tokenOtherClicked ( const TokenizedTextWidgetCursorPosition position,
Qt::MouseButton  button 
)
signal

◆ tokenHovered

void TokenizedTextWidget::tokenHovered ( const TokenizedTextWidgetCursorPosition position)
signal

◆ lineLeftClicked

void TokenizedTextWidget::lineLeftClicked ( size_t  lineIndex)
signal

◆ lineRightClicked

void TokenizedTextWidget::lineRightClicked ( size_t  lineIndex)
signal

◆ lineDoubleClicked

void TokenizedTextWidget::lineDoubleClicked ( size_t  lineIndex)
signal

◆ lineOtherClicked

void TokenizedTextWidget::lineOtherClicked ( size_t  lineIndex,
Qt::MouseButton  button 
)
signal

◆ lineHovered

void TokenizedTextWidget::lineHovered ( size_t  lineIndex)
signal

◆ resizeEvent()

virtual void TokenizedTextWidget::resizeEvent ( QResizeEvent *  event)
overrideprotectedvirtual

◆ paintEvent()

virtual void TokenizedTextWidget::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

◆ wheelEvent()

virtual void TokenizedTextWidget::wheelEvent ( QWheelEvent *  event)
overrideprotectedvirtual

◆ mousePressEvent()

virtual void TokenizedTextWidget::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

◆ mouseMoveEvent()

virtual void TokenizedTextWidget::mouseMoveEvent ( QMouseEvent *  event)
overrideprotectedvirtual

◆ mouseDoubleClickEvent()

virtual void TokenizedTextWidget::mouseDoubleClickEvent ( QMouseEvent *  event)
overrideprotectedvirtual

◆ leaveEvent()

virtual void TokenizedTextWidget::leaveEvent ( QEvent *  event)
overrideprotectedvirtual

◆ focusInEvent()

virtual void TokenizedTextWidget::focusInEvent ( QFocusEvent *  event)
overrideprotectedvirtual

◆ focusOutEvent()

virtual void TokenizedTextWidget::focusOutEvent ( QFocusEvent *  event)
overrideprotectedvirtual

◆ contextMenuEvent()

virtual void TokenizedTextWidget::contextMenuEvent ( QContextMenuEvent *  event)
overrideprotectedvirtual

◆ TokenizedTextWidget::LineMetadata

struct TokenizedTextWidget::LineMetadata

Public Member Functions

 LineMetadata ()
 

Public Attributes

size_t charWidth
 
int copyStyles
 

Constructor & Destructor Documentation

◆ LineMetadata()

TokenizedTextWidget::LineMetadata::LineMetadata ( )
inline

Member Data Documentation

◆ charWidth

size_t TokenizedTextWidget::LineMetadata::charWidth

◆ copyStyles

int TokenizedTextWidget::LineMetadata::copyStyles

◆ TokenizedTextWidget::TokenMetadata

struct TokenizedTextWidget::TokenMetadata

Public Member Functions

 TokenMetadata ()
 

Public Attributes

size_t charOffset
 
int copyStyles
 
bool selectLineTarget
 

Constructor & Destructor Documentation

◆ TokenMetadata()

TokenizedTextWidget::TokenMetadata::TokenMetadata ( )
inline

Member Data Documentation

◆ charOffset

size_t TokenizedTextWidget::TokenMetadata::charOffset

◆ copyStyles

int TokenizedTextWidget::TokenMetadata::copyStyles

◆ selectLineTarget

bool TokenizedTextWidget::TokenMetadata::selectLineTarget

Enumeration Type Documentation

◆ TokenizedTextWidgetSelectionStyle

Enumerator
NoSelection 
SelectLines 
SelectOneToken 
SelectTokens 
SelectCharacters 
AllStyles