SavvyUI C++ UI Library
Loading...
Searching...
No Matches
Rating.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4
8class Rating : public Component
9{
10 int _savedRating = 2;
11 BOOL _hasHalf = TRUE;
12 Bounds _starRects[5];
13 int _hoverRating = _savedRating;
14 BOOL _isHovering = FALSE;
15
23 void DrawStar(Graphics *g, Bounds rect, BOOL selected = FALSE);
24
32 void DrawHalfStar(Graphics* g, Bounds rect, BOOL selected = FALSE);
33
34protected:
38 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
39
44
45public:
50
54 virtual ~Rating();
55
60
67 void setRating(int rating, BOOL includesHalf);
68
75 void getRating(int& rating, BOOL& includesHalf);
76
82 void onPaint(Graphics *g);
83
94 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed);
95
105 void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
106};
HWND WinHandle
Definition Common.h:16
Definition Common.h:20
Component()
Constructs a new Component instance.
Definition Graphics.h:161
void setRating(int rating, BOOL includesHalf)
Sets the current rating and whether half-star ratings are allowed.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Gets options for creating the window.
void onPaint(Graphics *g)
Paints the rating control.
virtual ~Rating()
Destructor for the Rating component.
void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Handles mouse move events over the control.
int getPreferredHeight()
Returns the preferred height.
Rating()
Constructs a new Rating component.
void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
Handles mouse press events on the control.
void getRating(int &rating, BOOL &includesHalf)
Gets the current rating and half-star status.
void windowCreated()
Called when the window is created.