💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

61 lines
1.4 KiB

#ifndef TOOLBAR_HPP
#define TOOLBAR_HPP
#include "ui.hpp"
#include <functional>
#include <emergent/emergent.hpp>
using namespace Emergent;
class Toolbar
{
public:
Toolbar();
void setToolbarTopTexture(Texture* texture);
void setToolbarBottomTexture(Texture* texture);
void setToolbarMiddleTexture(Texture* texture);
void setButtonRaisedTexture(Texture* texture);
void setButtonDepressedTexture(Texture* texture);
void resize();
void addButton(Texture* iconTexture, std::function<void()> pressCallback, std::function<void()> releaseCallback);
void pressButton(std::size_t index);
void releaseButton(std::size_t index);
const UIContainer* getContainer() const;
UIContainer* getContainer();
private:
Texture* toolbarTopTexture;
Texture* toolbarBottomTexture;
Texture* toolbarMiddleTexture;
Texture* buttonRaisedTexture;
Texture* buttonDepressedTexture;
UIContainer toolbarContainer;
UIImage toolbarTopImage;
UIImage toolbarBottomImage;
UIImage toolbarMiddleImage;
std::vector<UIImage*> buttons;
std::vector<UIImage*> icons;
std::vector<std::function<void()>> pressCallbacks;
std::vector<std::function<void()>> releaseCallbacks;
std::size_t depressedButtonIndex;
};
inline const UIContainer* Toolbar::getContainer() const
{
return &toolbarContainer;
}
inline UIContainer* Toolbar::getContainer()
{
return &toolbarContainer;
}
#endif // TOOLBAR_HPP