GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
gui_framework::BaseComponent Class Referenceabstract

Base class for all windows, controls, etc. More...

#include <BaseComponent.h>

Inheritance diagram for gui_framework::BaseComponent:
gui_framework::interfaces::ISerializable gui_framework::BaseButton gui_framework::BaseComboBox gui_framework::BaseComposite gui_framework::BaseEditControl gui_framework::BaseInfiniteProgressBar gui_framework::BaseListBox gui_framework::BaseListView gui_framework::BaseProgressBar gui_framework::BaseRichEdit gui_framework::BaseScrollBar gui_framework::BaseStaticControl gui_framework::BaseTabControl gui_framework::BaseTrackbarControl

Public Member Functions

 BaseComponent (std::wstring_view className, std::wstring_view windowName, const utility::ComponentSettings &settings, const interfaces::IStyles &styles, BaseComposite *parent=nullptr, std::string_view windowFunctionName="", std::string_view moduleName="", uint16_t smallIconResource=NULL, uint16_t largeIconResource=NULL)
 
LRESULT handleMessages (HWND handle, UINT message, WPARAM wparam, LPARAM lparam, bool &isUsed)
 
bool destroyComponent ()
 
bool asyncDestroyComponent ()
 
void enable ()
 
void disable ()
 
bool isEnabled () const
 
bool isDisabled () const
 
LRESULT sendRawMessage (UINT message, WPARAM wparam, LPARAM lparam)
 SendMessage WinAPI wrapper.
 
void setDesiredWidth (uint16_t desiredWidth)
 
void setDesiredHeight (uint16_t desiredHeight)
 
void setDesiredX (int desiredX)
 
void setDesiredY (int desiredY)
 
virtual void setBackgroundColor (uint8_t red, uint8_t green, uint8_t blue)
 
virtual void setTextColor (uint8_t red, uint8_t green, uint8_t blue)
 
BaseComponentgetParent () const
 
HWND getHandle () const
 
std::wstring_view getWindowName () const
 
std::wstring_view getClassName () const
 
uint16_t getDesiredWidth () const
 
uint16_t getDesiredHeight () const
 
uint16_t getActualWidth () const
 
uint16_t getActualHeight () const
 
RECT getActualCoordinates () const
 
int getDesiredX () const
 
int getDesiredY () const
 
uint32_t getId () const
 
COLORREF getBackgroundColor () const
 
COLORREF getTextColor () const
 
const smartPointerType< interfaces::IStyles > & getStyles () const
 
virtual size_t getHash () const =0
 Used as key in creators.
 
virtual json::JSONBuilder getStructure () const override
 
virtual ~BaseComponent ()
 
- Public Member Functions inherited from gui_framework::interfaces::ISerializable
 ISerializable ()=default
 
virtual ~ISerializable ()=default
 

Static Public Member Functions

static void runFunctionAsync (const std::function< void()> &callable, const std::function< void()> &callback=nullptr) noexcept
 Add task to thread pool.
 
static void runFunctionAsync (std::function< void()> &&callable, const std::function< void()> &callback=nullptr) noexcept
 Add task to thread pool.
 
- Static Public Member Functions inherited from gui_framework::interfaces::ISerializable
static uint32_t getCodepage ()
 

Protected Member Functions

virtual LRESULT preWindowMessagesHandle (HWND handle, UINT message, WPARAM wparam, LPARAM lparam, bool &isUsed)
 
virtual LRESULT windowMessagesHandle (HWND handle, UINT message, WPARAM wparam, LPARAM lparam, bool &isUsed)
 
virtual void setLocalizationKeys (interfaces::ITextLocalized *localized, const std::vector< std::string > &localizationKeys)
 Override for custom localization.
 

Protected Attributes

BaseCompositeparent
 
const std::wstring className
 
const std::wstring windowName
 
HWND handle
 
uint16_t desiredWidth
 
uint16_t desiredHeight
 
int desiredX
 
int desiredY
 
uint32_t id
 
COLORREF backgroundColor
 
COLORREF textColor
 
smartPointerType< interfaces::IStylesstyles
 

Friends

class BaseComposite
 

Detailed Description

Base class for all windows, controls, etc.

Definition at line 16 of file BaseComponent.h.

Constructor & Destructor Documentation

◆ BaseComponent()

gui_framework::BaseComponent::BaseComponent ( std::wstring_view className,
std::wstring_view windowName,
const utility::ComponentSettings & settings,
const interfaces::IStyles & styles,
BaseComposite * parent = nullptr,
std::string_view windowFunctionName = "",
std::string_view moduleName = "",
uint16_t smallIconResource = NULL,
uint16_t largeIconResource = NULL )
Parameters
windowFunctionNameValue that you pass in CREATE_DEFAULT_WINDOW_FUNCTION macro
moduleNameName of loaded resource module with icons
smallIconResourceInteger value from auto generated Visual Studio resources
largeIconResourceInteger value from auto generated Visual Studio resources

Definition at line 75 of file BaseComponent.cpp.

◆ ~BaseComponent()

gui_framework::BaseComponent::~BaseComponent ( )
virtual

Definition at line 467 of file BaseComponent.cpp.

Member Function Documentation

◆ asyncDestroyComponent()

bool gui_framework::BaseComponent::asyncDestroyComponent ( )

Definition at line 238 of file BaseComponent.cpp.

◆ destroyComponent()

bool gui_framework::BaseComponent::destroyComponent ( )

Definition at line 223 of file BaseComponent.cpp.

◆ disable()

void gui_framework::BaseComponent::disable ( )

Definition at line 258 of file BaseComponent.cpp.

◆ enable()

void gui_framework::BaseComponent::enable ( )

Definition at line 253 of file BaseComponent.cpp.

◆ getActualCoordinates()

RECT gui_framework::BaseComponent::getActualCoordinates ( ) const

Definition at line 360 of file BaseComponent.cpp.

◆ getActualHeight()

uint16_t gui_framework::BaseComponent::getActualHeight ( ) const

Definition at line 351 of file BaseComponent.cpp.

◆ getActualWidth()

uint16_t gui_framework::BaseComponent::getActualWidth ( ) const

Definition at line 342 of file BaseComponent.cpp.

◆ getBackgroundColor()

COLORREF gui_framework::BaseComponent::getBackgroundColor ( ) const

Definition at line 386 of file BaseComponent.cpp.

◆ getClassName()

wstring_view gui_framework::BaseComponent::getClassName ( ) const

Definition at line 327 of file BaseComponent.cpp.

◆ getDesiredHeight()

uint16_t gui_framework::BaseComponent::getDesiredHeight ( ) const

Definition at line 337 of file BaseComponent.cpp.

◆ getDesiredWidth()

uint16_t gui_framework::BaseComponent::getDesiredWidth ( ) const

Definition at line 332 of file BaseComponent.cpp.

◆ getDesiredX()

int gui_framework::BaseComponent::getDesiredX ( ) const

Definition at line 371 of file BaseComponent.cpp.

◆ getDesiredY()

int gui_framework::BaseComponent::getDesiredY ( ) const

Definition at line 376 of file BaseComponent.cpp.

◆ getHandle()

HWND gui_framework::BaseComponent::getHandle ( ) const

Definition at line 317 of file BaseComponent.cpp.

◆ getHash()

virtual size_t gui_framework::BaseComponent::getHash ( ) const
pure virtual

Used as key in creators.

Returns
typeid().hash_code()

Implemented in gui_framework::BaseButton, gui_framework::BaseCheckBox, gui_framework::BaseChildWindow, gui_framework::BaseComboBox, gui_framework::BaseComposite, gui_framework::BaseDialogBox, gui_framework::BaseEditControl, gui_framework::BaseHorizontalScrollBar, gui_framework::BaseIconListView, gui_framework::BaseInfiniteProgressBar, gui_framework::BaseListBox, gui_framework::BaseListIconListView, gui_framework::BaseListListView, gui_framework::BaseListTextIconListView, gui_framework::BaseListTextListView, gui_framework::BaseListView, gui_framework::BaseMainWindow, gui_framework::BaseMultipleSelectListBox, gui_framework::BaseProgressBar, gui_framework::BaseRichEdit, gui_framework::BaseScrollBar, gui_framework::BaseSeparateWindow, gui_framework::BaseStaticControl, gui_framework::BaseTabControl, gui_framework::BaseTextIconListView, gui_framework::BaseTextListView, gui_framework::BaseTrackbarControl, gui_framework::BaseVerticalAndHorizontalScrollBar, gui_framework::BaseVerticalScrollBar, gui_framework::BaseWindow, gui_framework::Button, gui_framework::CheckBox, gui_framework::ChildWindow, gui_framework::DialogBox, gui_framework::DropDownComboBox, gui_framework::DropDownListComboBox, gui_framework::EditControl, gui_framework::GroupBox, gui_framework::HorizontalTrackbarControl, gui_framework::IconListView, gui_framework::ImageButton, gui_framework::InfiniteProgressBar, gui_framework::ListBox, gui_framework::ListIconListView, gui_framework::ListTextIconListView, gui_framework::ListTextListView, gui_framework::MultipleSelectListBox, gui_framework::ProgressBar, gui_framework::RichEdit, gui_framework::SeparateWindow, gui_framework::SimpleComboBox, gui_framework::StaticControl, gui_framework::TabControl, gui_framework::TextIconListView, gui_framework::TextListView, and gui_framework::VerticalTrackbarControl.

◆ getId()

uint32_t gui_framework::BaseComponent::getId ( ) const
Returns
Components returns id, composites returns 0

Definition at line 381 of file BaseComponent.cpp.

◆ getParent()

BaseComponent * gui_framework::BaseComponent::getParent ( ) const

Definition at line 312 of file BaseComponent.cpp.

◆ getStructure()

◆ getStyles()

const smartPointerType< interfaces::IStyles > & gui_framework::BaseComponent::getStyles ( ) const

Definition at line 396 of file BaseComponent.cpp.

◆ getTextColor()

COLORREF gui_framework::BaseComponent::getTextColor ( ) const

Definition at line 391 of file BaseComponent.cpp.

◆ getWindowName()

wstring_view gui_framework::BaseComponent::getWindowName ( ) const

Definition at line 322 of file BaseComponent.cpp.

◆ handleMessages()

LRESULT gui_framework::BaseComponent::handleMessages ( HWND handle,
UINT message,
WPARAM wparam,
LPARAM lparam,
bool & isUsed )

Definition at line 211 of file BaseComponent.cpp.

◆ isDisabled()

bool gui_framework::BaseComponent::isDisabled ( ) const

Definition at line 268 of file BaseComponent.cpp.

◆ isEnabled()

bool gui_framework::BaseComponent::isEnabled ( ) const

Definition at line 263 of file BaseComponent.cpp.

◆ preWindowMessagesHandle()

LRESULT gui_framework::BaseComponent::preWindowMessagesHandle ( HWND handle,
UINT message,
WPARAM wparam,
LPARAM lparam,
bool & isUsed )
protectedvirtual

Reimplemented in gui_framework::BaseComposite.

Definition at line 32 of file BaseComponent.cpp.

◆ runFunctionAsync() [1/2]

static void gui_framework::BaseComponent::runFunctionAsync ( const std::function< void()> & callable,
const std::function< void()> & callback = nullptr )
staticnoexcept

Add task to thread pool.

Parameters
callableFunction to call async
callbackFunction to call after callable invokes

◆ runFunctionAsync() [2/2]

static void gui_framework::BaseComponent::runFunctionAsync ( std::function< void()> && callable,
const std::function< void()> & callback = nullptr )
staticnoexcept

Add task to thread pool.

Parameters
callableFunction to call async
callbackFunction to call after callable invokes

◆ sendRawMessage()

LRESULT gui_framework::BaseComponent::sendRawMessage ( UINT message,
WPARAM wparam,
LPARAM lparam )

SendMessage WinAPI wrapper.

Parameters
message
wparam
lparam
Returns

Definition at line 273 of file BaseComponent.cpp.

◆ setBackgroundColor()

void gui_framework::BaseComponent::setBackgroundColor ( uint8_t red,
uint8_t green,
uint8_t blue )
virtual

◆ setDesiredHeight()

void gui_framework::BaseComponent::setDesiredHeight ( uint16_t desiredHeight)

Definition at line 283 of file BaseComponent.cpp.

◆ setDesiredWidth()

void gui_framework::BaseComponent::setDesiredWidth ( uint16_t desiredWidth)

Definition at line 278 of file BaseComponent.cpp.

◆ setDesiredX()

void gui_framework::BaseComponent::setDesiredX ( int desiredX)

Definition at line 288 of file BaseComponent.cpp.

◆ setDesiredY()

void gui_framework::BaseComponent::setDesiredY ( int desiredY)

Definition at line 293 of file BaseComponent.cpp.

◆ setLocalizationKeys()

void gui_framework::BaseComponent::setLocalizationKeys ( interfaces::ITextLocalized * localized,
const std::vector< std::string > & localizationKeys )
protectedvirtual

Override for custom localization.

Your interface must be implemented before BaseComponent subclass inheritance

Parameters
localizedNon nullptr base localization class pointer

Definition at line 60 of file BaseComponent.cpp.

◆ setTextColor()

◆ windowMessagesHandle()

LRESULT gui_framework::BaseComponent::windowMessagesHandle ( HWND handle,
UINT message,
WPARAM wparam,
LPARAM lparam,
bool & isUsed )
protectedvirtual

Friends And Related Symbol Documentation

◆ BaseComposite

friend class BaseComposite
friend

Definition at line 138 of file BaseComponent.h.

Member Data Documentation

◆ backgroundColor

COLORREF gui_framework::BaseComponent::backgroundColor
protected

Definition at line 39 of file BaseComponent.h.

◆ className

const std::wstring gui_framework::BaseComponent::className
protected

Definition at line 31 of file BaseComponent.h.

◆ desiredHeight

uint16_t gui_framework::BaseComponent::desiredHeight
protected

Definition at line 35 of file BaseComponent.h.

◆ desiredWidth

uint16_t gui_framework::BaseComponent::desiredWidth
protected

Definition at line 34 of file BaseComponent.h.

◆ desiredX

int gui_framework::BaseComponent::desiredX
protected

Definition at line 36 of file BaseComponent.h.

◆ desiredY

int gui_framework::BaseComponent::desiredY
protected

Definition at line 37 of file BaseComponent.h.

◆ handle

HWND gui_framework::BaseComponent::handle
protected

Definition at line 33 of file BaseComponent.h.

◆ id

uint32_t gui_framework::BaseComponent::id
protected

Definition at line 38 of file BaseComponent.h.

◆ parent

BaseComposite* gui_framework::BaseComponent::parent
protected

Definition at line 30 of file BaseComponent.h.

◆ styles

smartPointerType<interfaces::IStyles> gui_framework::BaseComponent::styles
protected

Definition at line 41 of file BaseComponent.h.

◆ textColor

COLORREF gui_framework::BaseComponent::textColor
protected

Definition at line 40 of file BaseComponent.h.

◆ windowName

const std::wstring gui_framework::BaseComponent::windowName
protected

Definition at line 32 of file BaseComponent.h.


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