UIContext Class Referenceabstract

Public Member Functions

 UIContext ()
 
virtual ~UIContext ()
 
virtual QMainWindow * mainWindow ()=0
 
virtual void viewChanged (ViewFrame *frame, const QString &type)
 
virtual bool navigateForBinaryView (BinaryViewRef view, uint64_t addr)
 
virtual std::vector< std::pair< BinaryViewRef, QString > > getAvailableBinaryViews ()=0
 Get a list of all opened binary views, and their names. More...
 
virtual QWidget * getTabForSessionId (uint64_t sessionId)=0
 Gets the tab for for a given sessionId. More...
 
virtual QString getTabNameForSessionId (uint64_t sessionId)=0
 Gets the name of a tab for the given session. More...
 
virtual ViewgetCurrentView ()=0
 Get the currently visible View for the currently visible ViewFrame (if it exists) More...
 
virtual ViewFramegetCurrentViewFrame ()=0
 Get the currently visible ViewFrame (if it exists) More...
 
virtual UIActionHandlergetCurrentActionHandler ()=0
 Get the current Action Handler for the focused widget. More...
 
virtual void createTabForWidget (const QString &name, QWidget *widget)=0
 Open a tab containing the given widget with the given name. More...
 
virtual void splitToNewWindowAndNavigateToLocation (uint64_t location)=0
 Open a new window with the same file context and Navigate to a given location. More...
 
virtual void splitToNewTabAndNavigateToLocation (uint64_t location)=0
 Open a new tab with the same file context and Navigate to a given location. More...
 
virtual void openPane (Pane *pane, Qt::Orientation primaryDirection=Qt::Vertical)=0
 Open a new pane in the active tab. More...
 
virtual QList< QWidget * > getTabs ()=0
 Get a list of all tabs as QWidgets. More...
 
virtual QWidget * getTabForName (const QString &name)=0
 Get the QWidget responsible for the tab with the given name. More...
 
virtual QWidget * getTabForFile (FileContext *file)=0
 Get the QWidget responsible for the tab with the given file. More...
 
virtual QString getNameForTab (QWidget *tab)=0
 Get the name of the tab with the given QWidget. More...
 
virtual void activateTab (QWidget *tab)=0
 Activate and make visible the tab with the given QWidget. More...
 
virtual void closeTab (QWidget *tab, bool closeWindowIfLast=false)=0
 Close the tab with the given QWidget. More...
 
virtual QWidget * getCurrentTab ()=0
 Get the QWidget in the currently open tab. More...
 
virtual QWidget * createNewTab (bool focus=true)=0
 
virtual ViewgetViewForTab (QWidget *tab)=0
 Get the current View associated with the given QWidget, if it exists. More...
 
virtual ViewFramegetViewFrameForTab (QWidget *tab) const =0
 Get the active ViewFrame associated with the given QWidget, if it exists. More...
 
virtual std::vector< ViewFrame * > getAllViewFramesForTab (QWidget *tab) const =0
 Get all ViewFrame instances associated with the given QWidget, if they exist. More...
 
virtual bool openFilename (const QString &path, bool openOptions=false)
 
virtual ViewFrameopenFileContext (FileContext *file, const QString &forcedView="", bool addTab=true)
 
virtual void recreateViewFrames (FileContext *file)=0
 
UIActionHandlerglobalActions ()
 
virtual UIActionHandlercontentActionHandler ()=0
 
virtual Sidebarsidebar ()=0
 
virtual GlobalAreaglobalArea ()=0
 
void updateCrossReferences (ViewFrame *frame, View *view, const SelectionInfoForXref &selection)
 
QString GetNameForFile (FileContext *file)
 Get the displayed name for a given file. More...
 
QString GetNameForPath (const QString &path)
 Get the displayed name for a path to a file. More...
 
virtual QWidget * fileContentsLockStatusWidget ()=0
 

Static Public Member Functions

static void registerNotification (UIContextNotification *notification)
 Register an object to receive notifications of UIContext events. More...
 
static void unregisterNotification (UIContextNotification *notification)
 Unregister an object from receiving notifications of UIContext events. More...
 
static void setHandler (UIContextHandler *handler)
 
static QSize getScaledWindowSize (int x, int y)
 
static void updateStatus ()
 
static void notifyThemeChanged ()
 
static void showPreview (QWidget *parent, PreviewWidget *preview, QPoint localPos, bool anchorAtPoint=false)
 
static void closePreview ()
 
static bool sendPreviewWheelEvent (QWheelEvent *event)
 
static void closeOtherActiveModalWidget (QWidget *current)
 
static void registerFileOpenMode (const QString &buttonName, const QString &description, const QString &action)
 
static UIContextcontextForWidget (QWidget *widget)
 
static UIContextactiveContext ()
 
static std::set< UIContext * > allContexts ()
 
static QWidget * topLevelAt (const QPoint &pt, QWidget *ignoreWidget=nullptr)
 
static QRect placeNewTopLevelWindow (QScreen *screen, const QPoint &pos, QWidget *existingWidget)
 
static ViewFramecurrentViewFrameForWidget (QWidget *widget)
 

Protected Member Functions

void setupUIContext (QWidget *obj)
 
void NotifyOnContextOpen ()
 
void NotifyOnContextClose ()
 
bool NotifyOnBeforeOpenDatabase (FileMetadataRef metadata)
 
bool NotifyOnAfterOpenDatabase (FileMetadataRef metadata, BinaryViewRef data)
 
bool NotifyOnBeforeOpenFile (FileContext *file)
 
void NotifyOnAfterOpenFile (FileContext *file, ViewFrame *frame)
 
bool NotifyOnBeforeSaveFile (FileContext *file, ViewFrame *frame)
 
void NotifyOnAfterSaveFile (FileContext *file, ViewFrame *frame)
 
bool NotifyOnBeforeCloseFile (FileContext *file, ViewFrame *frame)
 
void NotifyOnAfterCloseFile (FileContext *file, ViewFrame *frame)
 
void NotifyOnViewChange (ViewFrame *frame, const QString &type)
 
void NotifyOnAddressChange (ViewFrame *frame, View *view, const ViewLocation &location)
 
void NotifyOnNewSelectionForXref (ViewFrame *frame, View *view, const SelectionInfoForXref &selection)
 

Constructor & Destructor Documentation

◆ UIContext()

UIContext::UIContext ( )

◆ ~UIContext()

virtual UIContext::~UIContext ( )
virtual

Member Function Documentation

◆ activateTab()

virtual void UIContext::activateTab ( QWidget *  tab)
pure virtual

Activate and make visible the tab with the given QWidget.

Parameters
tabQWidget which is in a tab

◆ activeContext()

static UIContext * UIContext::activeContext ( )
static

◆ allContexts()

static std::set< UIContext * > UIContext::allContexts ( )
static

◆ closeOtherActiveModalWidget()

static void UIContext::closeOtherActiveModalWidget ( QWidget *  current)
static

◆ closePreview()

static void UIContext::closePreview ( )
static

◆ closeTab()

virtual void UIContext::closeTab ( QWidget *  tab,
bool  closeWindowIfLast = false 
)
pure virtual

Close the tab with the given QWidget.

Parameters
tabQWidget which is in a tab
closeWindowIfLastIf false, displays the new tab page if the widget was the last tab

◆ contentActionHandler()

virtual UIActionHandler * UIContext::contentActionHandler ( )
pure virtual

◆ contextForWidget()

static UIContext * UIContext::contextForWidget ( QWidget *  widget)
static

◆ createNewTab()

virtual QWidget * UIContext::createNewTab ( bool  focus = true)
pure virtual

◆ createTabForWidget()

virtual void UIContext::createTabForWidget ( const QString &  name,
QWidget *  widget 
)
pure virtual

Open a tab containing the given widget with the given name.

Parameters
nameName for tab
widgetWidget to display in the tab (optionally a ViewFrame)

◆ currentViewFrameForWidget()

static ViewFrame * UIContext::currentViewFrameForWidget ( QWidget *  widget)
static

◆ fileContentsLockStatusWidget()

virtual QWidget * UIContext::fileContentsLockStatusWidget ( )
pure virtual

◆ getAllViewFramesForTab()

virtual std::vector< ViewFrame * > UIContext::getAllViewFramesForTab ( QWidget *  tab) const
pure virtual

Get all ViewFrame instances associated with the given QWidget, if they exist.

Parameters
tabQWidget which could contain a ViewFrame
Returns
List of ViewFrame objects for the QWidget

◆ getAvailableBinaryViews()

virtual std::vector< std::pair< BinaryViewRef, QString > > UIContext::getAvailableBinaryViews ( )
pure virtual

Get a list of all opened binary views, and their names.

Returns
List of binary views and names

◆ getCurrentActionHandler()

virtual UIActionHandler * UIContext::getCurrentActionHandler ( )
pure virtual

Get the current Action Handler for the focused widget.

Returns
Current Action Handler if the focused widget (or one of its parents) has one, else nullptr

◆ getCurrentTab()

virtual QWidget * UIContext::getCurrentTab ( )
pure virtual

Get the QWidget in the currently open tab.

Returns
QWidget for current tab. Qt claims "this value is never 0 (but if you try hard enough, it can be)"

◆ getCurrentView()

virtual View * UIContext::getCurrentView ( )
pure virtual

Get the currently visible View for the currently visible ViewFrame (if it exists)

Returns
Current View or nullptr if the current ViewFrame is null or does not have a View

◆ getCurrentViewFrame()

virtual ViewFrame * UIContext::getCurrentViewFrame ( )
pure virtual

Get the currently visible ViewFrame (if it exists)

Returns
Current ViewFrame or nullptr if the current widget does not have a ViewFrame

◆ GetNameForFile()

QString UIContext::GetNameForFile ( FileContext file)

Get the displayed name for a given file.

Parameters
fileFile whose displayed name to get
Returns
Name to display for this file

◆ GetNameForPath()

QString UIContext::GetNameForPath ( const QString &  path)

Get the displayed name for a path to a file.

Parameters
pathPath to file whose displayed name you want
Returns
Name to display for this path

◆ getNameForTab()

virtual QString UIContext::getNameForTab ( QWidget *  tab)
pure virtual

Get the name of the tab with the given QWidget.

Parameters
tabQWidget which is in a tab
Returns
Name of the tab, or empty string if no tab is found

◆ getScaledWindowSize()

static QSize UIContext::getScaledWindowSize ( int  x,
int  y 
)
static

◆ getTabForFile()

virtual QWidget * UIContext::getTabForFile ( FileContext file)
pure virtual

Get the QWidget responsible for the tab with the given file.

Parameters
fileFile of tab to get
Returns
QWidget of tab if one with that file exists

◆ getTabForName()

virtual QWidget * UIContext::getTabForName ( const QString &  name)
pure virtual

Get the QWidget responsible for the tab with the given name.

Parameters
nameName of tab to get
Returns
QWidget of tab if one with that name exists

◆ getTabForSessionId()

virtual QWidget * UIContext::getTabForSessionId ( uint64_t  sessionId)
pure virtual

Gets the tab for for a given sessionId.

◆ getTabNameForSessionId()

virtual QString UIContext::getTabNameForSessionId ( uint64_t  sessionId)
pure virtual

Gets the name of a tab for the given session.

◆ getTabs()

virtual QList< QWidget * > UIContext::getTabs ( )
pure virtual

Get a list of all tabs as QWidgets.

Returns
All tabs

◆ getViewForTab()

virtual View * UIContext::getViewForTab ( QWidget *  tab)
pure virtual

Get the current View associated with the given QWidget, if it exists.

Parameters
tabQWidget which could be a ViewFrame
Returns
View for the QWidget, or nullptr if the QWidget is not a ViewFrame or does not have a View

◆ getViewFrameForTab()

virtual ViewFrame * UIContext::getViewFrameForTab ( QWidget *  tab) const
pure virtual

Get the active ViewFrame associated with the given QWidget, if it exists.

Parameters
tabQWidget which could be a ViewFrame
Returns
ViewFrame for the QWidget (which is likely itself), or nullptr if the QWidget is not a ViewFrame

◆ globalActions()

UIActionHandler * UIContext::globalActions ( )
inline

◆ globalArea()

virtual GlobalArea * UIContext::globalArea ( )
pure virtual

◆ mainWindow()

virtual QMainWindow * UIContext::mainWindow ( )
pure virtual

◆ navigateForBinaryView()

virtual bool UIContext::navigateForBinaryView ( BinaryViewRef  view,
uint64_t  addr 
)
virtual

◆ NotifyOnAddressChange()

void UIContext::NotifyOnAddressChange ( ViewFrame frame,
View view,
const ViewLocation location 
)
protected

◆ NotifyOnAfterCloseFile()

void UIContext::NotifyOnAfterCloseFile ( FileContext file,
ViewFrame frame 
)
protected

◆ NotifyOnAfterOpenDatabase()

bool UIContext::NotifyOnAfterOpenDatabase ( FileMetadataRef  metadata,
BinaryViewRef  data 
)
protected

◆ NotifyOnAfterOpenFile()

void UIContext::NotifyOnAfterOpenFile ( FileContext file,
ViewFrame frame 
)
protected

◆ NotifyOnAfterSaveFile()

void UIContext::NotifyOnAfterSaveFile ( FileContext file,
ViewFrame frame 
)
protected

◆ NotifyOnBeforeCloseFile()

bool UIContext::NotifyOnBeforeCloseFile ( FileContext file,
ViewFrame frame 
)
protected

◆ NotifyOnBeforeOpenDatabase()

bool UIContext::NotifyOnBeforeOpenDatabase ( FileMetadataRef  metadata)
protected

◆ NotifyOnBeforeOpenFile()

bool UIContext::NotifyOnBeforeOpenFile ( FileContext file)
protected

◆ NotifyOnBeforeSaveFile()

bool UIContext::NotifyOnBeforeSaveFile ( FileContext file,
ViewFrame frame 
)
protected

◆ NotifyOnContextClose()

void UIContext::NotifyOnContextClose ( )
protected

◆ NotifyOnContextOpen()

void UIContext::NotifyOnContextOpen ( )
protected

◆ NotifyOnNewSelectionForXref()

void UIContext::NotifyOnNewSelectionForXref ( ViewFrame frame,
View view,
const SelectionInfoForXref selection 
)
protected

◆ NotifyOnViewChange()

void UIContext::NotifyOnViewChange ( ViewFrame frame,
const QString &  type 
)
protected

◆ notifyThemeChanged()

static void UIContext::notifyThemeChanged ( )
static

◆ openFileContext()

virtual ViewFrame * UIContext::openFileContext ( FileContext file,
const QString &  forcedView = "",
bool  addTab = true 
)
virtual

◆ openFilename()

virtual bool UIContext::openFilename ( const QString &  path,
bool  openOptions = false 
)
virtual

◆ openPane()

virtual void UIContext::openPane ( Pane pane,
Qt::Orientation  primaryDirection = Qt::Vertical 
)
pure virtual

Open a new pane in the active tab.

Parameters
panePane widget to open
primaryDirectionPrimary axis for content in pane (determines default split direction)

◆ placeNewTopLevelWindow()

static QRect UIContext::placeNewTopLevelWindow ( QScreen *  screen,
const QPoint &  pos,
QWidget *  existingWidget 
)
static

◆ recreateViewFrames()

virtual void UIContext::recreateViewFrames ( FileContext file)
pure virtual

◆ registerFileOpenMode()

static void UIContext::registerFileOpenMode ( const QString &  buttonName,
const QString &  description,
const QString &  action 
)
static

◆ registerNotification()

static void UIContext::registerNotification ( UIContextNotification notification)
static

Register an object to receive notifications of UIContext events.

Parameters
notificationObject which will receive notifications

◆ sendPreviewWheelEvent()

static bool UIContext::sendPreviewWheelEvent ( QWheelEvent *  event)
static

◆ setHandler()

static void UIContext::setHandler ( UIContextHandler handler)
static

◆ setupUIContext()

void UIContext::setupUIContext ( QWidget *  obj)
protected

◆ showPreview()

static void UIContext::showPreview ( QWidget *  parent,
PreviewWidget preview,
QPoint  localPos,
bool  anchorAtPoint = false 
)
static

◆ sidebar()

virtual Sidebar * UIContext::sidebar ( )
pure virtual

◆ splitToNewTabAndNavigateToLocation()

virtual void UIContext::splitToNewTabAndNavigateToLocation ( uint64_t  location)
pure virtual

Open a new tab with the same file context and Navigate to a given location.

Parameters
location

◆ splitToNewWindowAndNavigateToLocation()

virtual void UIContext::splitToNewWindowAndNavigateToLocation ( uint64_t  location)
pure virtual

Open a new window with the same file context and Navigate to a given location.

Parameters
location

◆ topLevelAt()

static QWidget * UIContext::topLevelAt ( const QPoint &  pt,
QWidget *  ignoreWidget = nullptr 
)
static

◆ unregisterNotification()

static void UIContext::unregisterNotification ( UIContextNotification notification)
static

Unregister an object from receiving notifications of UIContext events.

Parameters
notificationObject which will no longer receive notifications

◆ updateCrossReferences()

void UIContext::updateCrossReferences ( ViewFrame frame,
View view,
const SelectionInfoForXref selection 
)

◆ updateStatus()

static void UIContext::updateStatus ( )
static

◆ viewChanged()

virtual void UIContext::viewChanged ( ViewFrame frame,
const QString &  type 
)
virtual

The documentation for this class was generated from the following file: