ArcdpsExtension
 
Loading...
Searching...
No Matches
ArcdpsExtension::MainWindow Class Referenceabstract

#include <MainWindow.h>

Inheritance diagram for ArcdpsExtension::MainWindow:

Public Types

typedef std::function< void(ImGuiWindowFlags &)> PreDrawHookFunction
 
typedef std::function< void()> ContextMenuHookFunction
 
typedef std::function< void()> DrawContentHookFunction
 
typedef std::function< void()> InitHookFunction
 
typedef std::function< void()> DrawStyleSubMenuHookFunction
 

Public Member Functions

 MainWindow ()=default
 
virtual ~MainWindow ()
 
 MainWindow (const MainWindow &other)=delete
 
 MainWindow (MainWindow &&other) noexcept=delete
 
MainWindowoperator= (const MainWindow &other)=delete
 
MainWindowoperator= (MainWindow &&other) noexcept=delete
 
virtual void Draw (ImGuiWindowFlags imGuiWindowFlags=0, MainWindowFlags mainWindowFlags=0)
 
virtual void Init ()
 
void DrawOptionCheckbox ()
 
virtual void SetMaxHeightCursorPos (float pNewCursorPos=ImGui::GetCursorPosY())
 
virtual bool & GetOpenVar ()=0
 
ImGuiWindow * GetInnerWindow ()
 
template<typename T >
requires std::is_base_of_v<ComponentBase, T>
void CreateComponent ()
 
void RegisterPreDrawHook (PreDrawHookFunction pFun)
 
void RegisterContextMenuHook (ContextMenuHookFunction pFun)
 
void RegisterContentHook (DrawContentHookFunction pFun)
 
void RegisterInitHook (InitHookFunction pFun)
 
void RegisterDrawStyleSubMenuHook (DrawStyleSubMenuHookFunction pFun)
 
virtual bool & GetShowScrollbar ()=0
 
float GetMaxCursorPos ()
 

Protected Member Functions

virtual void DrawContextMenu ()=0
 
virtual void DrawContent ()=0
 
virtual void DrawSizingPolicySubSettings (SizingPolicy sizingPolicy)
 
virtual SizingPolicygetSizingPolicy ()=0
 
virtual bool & getShowTitleBar ()=0
 
virtual std::optional< std::string > & getTitle ()=0
 
virtual const std::string & getTitleDefault ()=0
 
virtual const std::string & getWindowID ()=0
 
virtual std::optional< std::string > & getAppearAsInOption ()=0
 
virtual const std::string & getAppearAsInOptionDefault ()=0
 
virtual bool & getShowBackground ()=0
 
virtual std::optional< ImVec2 > & getPadding ()=0
 
virtual bool getMaxHeightActive ()
 
virtual gwlanguage getCurrentLanguage ()
 
virtual void DrawStyleSettingsSubMenu ()
 
virtual bool KeyBindPressed ()
 

Protected Attributes

ImGuiWindow * mThisWindow = nullptr
 

Member Typedef Documentation

◆ ContextMenuHookFunction

◆ DrawContentHookFunction

◆ DrawStyleSubMenuHookFunction

◆ InitHookFunction

typedef std::function<void()> ArcdpsExtension::MainWindow::InitHookFunction

◆ PreDrawHookFunction

typedef std::function<void(ImGuiWindowFlags&)> ArcdpsExtension::MainWindow::PreDrawHookFunction

Constructor & Destructor Documentation

◆ MainWindow() [1/3]

ArcdpsExtension::MainWindow::MainWindow ( )
default

◆ ~MainWindow()

ArcdpsExtension::MainWindow::~MainWindow ( )
virtual

◆ MainWindow() [2/3]

ArcdpsExtension::MainWindow::MainWindow ( const MainWindow other)
delete

◆ MainWindow() [3/3]

ArcdpsExtension::MainWindow::MainWindow ( MainWindow &&  other)
deletenoexcept

Member Function Documentation

◆ CreateComponent()

template<typename T >
requires std::is_base_of_v<ComponentBase, T>
void ArcdpsExtension::MainWindow::CreateComponent ( )
inline

◆ Draw()

void ArcdpsExtension::MainWindow::Draw ( ImGuiWindowFlags  imGuiWindowFlags = 0,
MainWindowFlags  mainWindowFlags = 0 
)
virtual

Draw the Window itself, has to be called in mod_imgui to draw the window. It will only be drawn if GetOpenVar returns true.

◆ DrawContent()

virtual void ArcdpsExtension::MainWindow::DrawContent ( )
protectedpure virtual

Called when the content of the Window should be drawn. This is the main function to draw into the window.

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ DrawContextMenu()

virtual void ArcdpsExtension::MainWindow::DrawContextMenu ( )
protectedpure virtual

Subcall inside context menu to add more things to it. Will be called at the beginning of the ContextMenu.

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ DrawOptionCheckbox()

void ArcdpsExtension::MainWindow::DrawOptionCheckbox ( )

Draw a checkbox for this window. Call it in mod_windows. Check the param of that function yourself.

◆ DrawSizingPolicySubSettings()

virtual void ArcdpsExtension::MainWindow::DrawSizingPolicySubSettings ( SizingPolicy  sizingPolicy)
inlineprotectedvirtual

Used to draw additional settings below the sizingPolicy combobox. Example: Tables might have a specific column size depending on the sizingPolicy.

◆ DrawStyleSettingsSubMenu()

void ArcdpsExtension::MainWindow::DrawStyleSettingsSubMenu ( )
protectedvirtual

This can be called to draw the SubMenu of the "Style". It will only draw the submenu and not the Menu option itself.

It is called by default at the bottom of the context menu. You can disable that by setting the flag MainWindowFlags_NoPositionMenu

Reimplemented in ArcdpsExtension::DemoWindow.

◆ getAppearAsInOption()

virtual std::optional< std::string > & ArcdpsExtension::MainWindow::getAppearAsInOption ( )
protectedpure virtual

Get the name of this window in the arcdps options. This has to return a string, else ImGui will cause an assert failure. This is set in the options

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ getAppearAsInOptionDefault()

virtual const std::string & ArcdpsExtension::MainWindow::getAppearAsInOptionDefault ( )
protectedpure virtual

Default for appear as in option, if the optional there is nullopt.

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ getCurrentLanguage()

virtual gwlanguage ArcdpsExtension::MainWindow::getCurrentLanguage ( )
inlineprotectedvirtual

The current language the plugin is set to. Default to english, this should be overridden to get proper language selection. The current language can be tracked with the unofficial_extras add-on.

◆ GetInnerWindow()

ImGuiWindow * ArcdpsExtension::MainWindow::GetInnerWindow ( )

◆ GetMaxCursorPos()

float ArcdpsExtension::MainWindow::GetMaxCursorPos ( )

◆ getMaxHeightActive()

virtual bool ArcdpsExtension::MainWindow::getMaxHeightActive ( )
inlineprotectedvirtual

Check if the window should have a maximal height. If this is true, the variable set with SetMaxHeightCursorPos will be used to determine the max-height. This has to be tracked by the implementation, cause this window has no idea what it's content looks like.

Reimplemented in ArcdpsExtension::DemoWindow.

◆ GetOpenVar()

virtual bool & ArcdpsExtension::MainWindow::GetOpenVar ( )
pure virtual

◆ getPadding()

virtual std::optional< ImVec2 > & ArcdpsExtension::MainWindow::getPadding ( )
protectedpure virtual

This padding is optional, if the optional is not set, no change to the window padding is applied. Default should be nullopt.

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ getShowBackground()

virtual bool & ArcdpsExtension::MainWindow::getShowBackground ( )
protectedpure virtual

This has to be true to show the background. Therefore setting it to true by default is recommended.

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ GetShowScrollbar()

virtual bool & ArcdpsExtension::MainWindow::GetShowScrollbar ( )
pure virtual

This has to be true to show the scrollbar. Therefore setting it to true by default is recommended. A scrollbar is only shown when the window is bigger than it's content.

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ getShowTitleBar()

virtual bool & ArcdpsExtension::MainWindow::getShowTitleBar ( )
protectedpure virtual

This has to be true to show the titlebar. Therefore setting it to true by default is recommended.

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ getSizingPolicy()

virtual SizingPolicy & ArcdpsExtension::MainWindow::getSizingPolicy ( )
protectedpure virtual

◆ getTitle()

virtual std::optional< std::string > & ArcdpsExtension::MainWindow::getTitle ( )
protectedpure virtual

The name of the window (shown in the title bar) and changeable by the user.

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ getTitleDefault()

virtual const std::string & ArcdpsExtension::MainWindow::getTitleDefault ( )
protectedpure virtual

The default Text for the title bar, when the above optional is nullopt

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ getWindowID()

virtual const std::string & ArcdpsExtension::MainWindow::getWindowID ( )
protectedpure virtual

The ID appended onto the title to be used by the ImGuiWindow, so it doesn't crash. This should never change!

Implemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

◆ Init()

void ArcdpsExtension::MainWindow::Init ( )
virtual

Call this function in mod_init, so the window is fully initialized!

◆ KeyBindPressed()

bool ArcdpsExtension::MainWindow::KeyBindPressed ( )
protectedvirtual

Override if you want to add additional checks when the keybind is pressed. e.g. arcdps is hidden

◆ operator=() [1/2]

MainWindow & ArcdpsExtension::MainWindow::operator= ( const MainWindow other)
delete

◆ operator=() [2/2]

MainWindow & ArcdpsExtension::MainWindow::operator= ( MainWindow &&  other)
deletenoexcept

◆ RegisterContentHook()

void ArcdpsExtension::MainWindow::RegisterContentHook ( DrawContentHookFunction  pFun)

◆ RegisterContextMenuHook()

void ArcdpsExtension::MainWindow::RegisterContextMenuHook ( ContextMenuHookFunction  pFun)

◆ RegisterDrawStyleSubMenuHook()

void ArcdpsExtension::MainWindow::RegisterDrawStyleSubMenuHook ( DrawStyleSubMenuHookFunction  pFun)

◆ RegisterInitHook()

void ArcdpsExtension::MainWindow::RegisterInitHook ( InitHookFunction  pFun)

◆ RegisterPreDrawHook()

void ArcdpsExtension::MainWindow::RegisterPreDrawHook ( PreDrawHookFunction  pFun)

◆ SetMaxHeightCursorPos()

void ArcdpsExtension::MainWindow::SetMaxHeightCursorPos ( float  pNewCursorPos = ImGui::GetCursorPosY())
virtual

Function to call to make the max-height work. Call this within your window at a position where the max-height should be. Multiple calls to this will override the value and only the last call will be used for calculation.

Depending on where you call this function it is off by a few pixel. Override it to correct it. Example: The DemoWindow wants to have - GImGui->Style.ItemSpacing.y added and a ImGui::Table wants to have the inline border added.

Reimplemented in ArcdpsExtension::DemoTableWindow, and ArcdpsExtension::DemoWindow.

Member Data Documentation

◆ mThisWindow

ImGuiWindow* ArcdpsExtension::MainWindow::mThisWindow = nullptr
protected

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