2021-01-06 14:46:57 +00:00
|
|
|
#pragma once
|
2021-01-10 19:49:50 +00:00
|
|
|
#include <map>
|
|
|
|
|
2021-01-06 14:46:57 +00:00
|
|
|
#include "common.hpp"
|
2021-02-03 18:29:09 +00:00
|
|
|
#include "tags/action_context.hpp"
|
2021-01-06 14:46:57 +00:00
|
|
|
#include "tags/context.hpp"
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
class renderer_interface {
|
|
|
|
public:
|
2021-02-02 22:03:44 +00:00
|
|
|
renderer_interface(const tags::action_context& action_ctxt) : m_action_ctxt(action_ctxt){};
|
2021-01-10 22:05:48 +00:00
|
|
|
|
2021-01-06 14:46:57 +00:00
|
|
|
virtual void render_offset(const tags::context& ctxt, int pixels) = 0;
|
2021-01-06 15:53:52 +00:00
|
|
|
virtual void render_text(const tags::context& ctxt, const string&& str) = 0;
|
2021-01-10 20:30:10 +00:00
|
|
|
virtual void change_alignment(const tags::context& ctxt) = 0;
|
2021-01-10 19:49:50 +00:00
|
|
|
|
2021-02-02 22:03:44 +00:00
|
|
|
/**
|
|
|
|
* Get the current x-coordinate of the renderer.
|
|
|
|
*
|
|
|
|
* This position denotes the coordinate where the next thing will be rendered.
|
|
|
|
* It is relative to the start of the current alignment because the absolute
|
|
|
|
* positions may not be known until after the renderer has finished.
|
|
|
|
*/
|
|
|
|
virtual double get_x(const tags::context& ctxt) const = 0;
|
2021-01-10 19:49:50 +00:00
|
|
|
|
2021-01-10 22:05:48 +00:00
|
|
|
/**
|
2021-02-02 22:03:44 +00:00
|
|
|
* Get the absolute x-position of the start of an alignment block.
|
|
|
|
*
|
|
|
|
* The position is absolute in terms of the bar window.
|
2021-01-10 22:05:48 +00:00
|
|
|
*
|
2021-02-02 22:03:44 +00:00
|
|
|
* Only call this after all the rendering is finished as these values change
|
|
|
|
* when new things are rendered.
|
|
|
|
*/
|
|
|
|
virtual double get_alignment_start(const alignment align) const = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Stores information about actions in the current render cycle.
|
2021-01-10 22:05:48 +00:00
|
|
|
*/
|
2021-02-02 22:03:44 +00:00
|
|
|
const tags::action_context& m_action_ctxt;
|
2021-01-06 14:46:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
POLYBAR_NS_END
|