SavvyUI C++ UI Library
Loading...
Searching...
No Matches
TitleBar.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4#include "Button.h"
5
6class TitleBar : public Component, public ActionListener
7{
8 Button _minimizeBtn, _maximizeRestoreBtn, _closeBtn;
9
10 Bounds _iconRect;
11 IconSource _iconSource;
12
13 Bounds _parentOriginalRect;
14 BOOL _parentOriginalRectSet;
15 BOOL _parentIsMaximized;
16
17 wstring _text;
18
19 BOOL _dragging;
20 POINT _dragStart;
21
22protected:
23
24 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
25
27
28public:
29
31 virtual ~TitleBar();
32
33 void setIcon(const IconSource& iconSource);
34
35 void setText(const wstring& text);
36
38
39 void onPaint(Graphics* g);
40
42
43 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed);
44 void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
45 void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
46
47 void onAction(const ActionEvent& ev);
48};
HWND WinHandle
Definition Common.h:16
Definition EventListeners.h:38
Definition EventListeners.h:46
Definition Common.h:21
A clickable UI component representing a button with customizable text and type.
Definition Button.h:13
Component()
Constructs a new Component instance.
Definition Graphics.h:171
Definition Graphics.h:125
void onPaint(Graphics *g)
Called to paint the component's client area.
void setIcon(const IconSource &iconSource)
int getPreferredHeight()
Returns the preferred height of the component.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Abstract method to get window creation options.
void onWindowResized()
Called when the component's window is resized.
void setText(const wstring &text)
void onAction(const ActionEvent &ev)
virtual ~TitleBar()
void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse is moved within the component.
void windowCreated()
Abstract method called after the window has been created.
void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse button is released within the component.
void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse is pressed within the component.