SavvyUI C++ UI Library
Loading...
Searching...
No Matches
IconMenu.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4
17
24class IconMenu : public Component
25{
26 wstring _title;
27 vector<IconMenuItem> _items;
28
29 long _maxVisibleItems;
30 long _firstVisibleItem;
31 long _lastVisibleItem;
32 long _currentItem;
33
34 long _indexOfPressedItem;
35
36 BOOL _isPinnable;
37
38protected:
47 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
48
53
54public:
56 virtual ~IconMenu();
57
61 void clear();
62
67 void setTitle(const wstring& title);
68
69 void setPinnable(BOOL isPinnable);
70
77 long addItem(const wstring& imageFile, const wstring& itemText);
78 long addItem(int imageResourceID, const ImageType& imageType, const wstring& itemText);
79
84 void onPaint(Graphics *g);
85
90
94 void onArrowUp(BOOL shiftPressed, BOOL ctrlPressed);
95
99 void onArrowDown(BOOL shiftPressed, BOOL ctrlPressed);
100
104 void onPageUp(BOOL shiftPressed, BOOL ctrlPressed);
105
109 void onPageDown(BOOL shiftPressed, BOOL ctrlPressed);
110
114 void onKeyHome(BOOL shiftPressed, BOOL ctrlPressed);
115
119 void onKeyEnd(BOOL shiftPressed, BOOL ctrlPressed);
120
124 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed);
125 void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
126
130 void onMouseRightClicked(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
131
136 BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta);
137
145 BOOL getScrollingInfo(__int64& scrollMin, __int64& scrollMax, __int64& pageSize);
146
150 void setScrollbarTopOffset(__int64 firstVisibleRow);
151
157};
ImageType
Definition Common.h:133
HWND WinHandle
Definition Common.h:16
Definition Common.h:20
Component()
Constructs a new Component instance.
Definition Graphics.h:161
virtual ~IconMenu()
long addItem(const wstring &imageFile, const wstring &itemText)
Adds a new item to the menu.
void addSelectionChangedListener(SelectionChangeListener *l)
Adds a listener to receive selection change events.
void onPaint(Graphics *g)
Paints the menu, drawing visible items with their icons and text.
void setTitle(const wstring &title)
Sets the title displayed at the top of the menu.
void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse button is released within the component.
void onPageDown(BOOL shiftPressed, BOOL ctrlPressed)
Handles page-down keyboard navigation.
BOOL getScrollingInfo(__int64 &scrollMin, __int64 &scrollMax, __int64 &pageSize)
Retrieves scroll bar information for scrolling through items.
void onArrowUp(BOOL shiftPressed, BOOL ctrlPressed)
Handles keyboard navigation: moves selection up.
void setPinnable(BOOL isPinnable)
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Sets window creation options specific to the IconMenu.
void onPageUp(BOOL shiftPressed, BOOL ctrlPressed)
Handles page-up keyboard navigation.
void onMouseRightClicked(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Handles mouse right-click events, possibly for context menu or other actions.
void setScrollbarTopOffset(__int64 firstVisibleRow)
Sets the scrollbar's top offset (first visible item).
long addItem(int imageResourceID, const ImageType &imageType, const wstring &itemText)
void windowCreated()
Called once the native window is created; performs initialization.
void clear()
Removes all menu items and clears the menu.
void onWindowResized()
Handles resizing of the menu window, recalculating layout.
void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
Handles mouse press events, selecting or interacting with items.
void onArrowDown(BOOL shiftPressed, BOOL ctrlPressed)
Handles keyboard navigation: moves selection down.
void onKeyHome(BOOL shiftPressed, BOOL ctrlPressed)
Handles keyboard Home key navigation: moves selection to first item.
void onKeyEnd(BOOL shiftPressed, BOOL ctrlPressed)
Handles keyboard End key navigation: moves selection to last item.
BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta)
Handles mouse wheel scrolling for scrolling through menu items.
Definition IconMenu.h:6
wstring _imageFile
Definition IconMenu.h:11
Bounds _textRect
Definition IconMenu.h:15
ImageType _imageType
Definition IconMenu.h:10
Bounds _rect
Definition IconMenu.h:13
BOOL _imageIsResourceID
Definition IconMenu.h:8
int _imageResourceID
Definition IconMenu.h:9
Bounds _imageRect
Definition IconMenu.h:14
wstring _text
Definition IconMenu.h:12
Definition EventListeners.h:31