This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
The-Powder-Toy/src/gui/interface/ScrollPanel.h
Ian Bastos bf0cc9ba5f
Implement keyboard hotkey bindings (heavily squashed)
- add keyboard bindings button to options
 - hooked keyboard binding panel to button
 - WIP bindings drawn in activity
 - keyboard binding keys finally appear
 - keyboard binding input widget
 - reserved keys logic working
 - removed debug logs
 - pref saved on key release
 - more reserved keys
 - fixed memory bad alloc error
 - modifier bindings
 - scroll panel for bindings view
 - added sdl id to bindings
 - cache sdl scan id into prefs
 - function ids are getting picked up
 - more keyboard mappings
 - more key bindings + reserved keys
 - keyboard bindings working
 - write keyboard bindings pref on load
 - sync new functions to prefs
 - final touches
 - Keep those include trees flat (see 0179cefc)
 - Fix tabs
 - WIP - many to one binding
 - WriteDefaultPrefs is now instance method
 - model add, remove and save methods
 - clear prefs before saving
 - added method for checking binding conflict
 - notify view on key combo change
 - route binding notification to gameview
 - view foundations for overhaul
 - fixed memory issue + has conflicting key issue
 - fixed prefs not being cleared before save
 - override text input to do nothing
 - fixed many complications due to duplicated hotkeys
 - missing index on new model caused problems
 - WIP - view adaptation
 - WIP - add and remove button layout
 - more patches
 - fixed empty textboxes problem
 - WIP - frontend overhaul
 - fixed ordering issue
 - binding removal - wip
 - function store to hold no shortcut data
 - reset to defaults button added
 - add from no shortcut works
 - error message on conflict
 - better summary for PopBindingByFunctionId
 - keyboard bindings hooked to gameview keypress
 - do not return correcty function id if no shortcut
 - flatten include trees
 - remove debug comment
 - spaces to tabs
2019-09-17 19:44:37 +02:00

37 lines
938 B
C++

#pragma once
#include "Panel.h"
namespace ui
{
class ScrollPanel: public Panel
{
protected:
int scrollBarWidth;
Point maxOffset;
float offsetX;
float offsetY;
float yScrollVel;
float xScrollVel;
bool isMouseInsideScrollbar;
bool isMouseInsideScrollbarArea;
bool scrollbarSelected;
int scrollbarInitialYOffset;
int scrollbarInitialYClick;
int scrollbarClickLocation;
public:
ScrollPanel(Point position, Point size);
int GetScrollLimit();
void SetScrollPosition(int position);
inline float GetScrollPositionY() const { return offsetY; }
void Draw(const Point& screenPos) override;
void XTick(float dt) override;
void XOnMouseWheelInside(int localx, int localy, int d) override;
void XOnMouseClick(int localx, int localy, unsigned int button) override;
void XOnMouseUp(int x, int y, unsigned int button) override;
void XOnMouseMoved(int localx, int localy, int dx, int dy) override;
};
}