2021-01-06 09:46:57 -05:00
|
|
|
#pragma once
|
2021-01-10 14:49:50 -05:00
|
|
|
#include <map>
|
|
|
|
|
2021-01-06 09:46:57 -05:00
|
|
|
#include "common.hpp"
|
2021-02-03 13:29:09 -05:00
|
|
|
#include "tags/action_context.hpp"
|
2021-01-06 09:46:57 -05:00
|
|
|
#include "tags/context.hpp"
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
class renderer_interface {
|
|
|
|
public:
|
2021-02-02 17:03:44 -05:00
|
|
|
renderer_interface(const tags::action_context& action_ctxt) : m_action_ctxt(action_ctxt){};
|
2021-01-10 17:05:48 -05:00
|
|
|
|
2021-01-06 09:46:57 -05:00
|
|
|
virtual void render_offset(const tags::context& ctxt, int pixels) = 0;
|
2021-01-06 10:53:52 -05:00
|
|
|
virtual void render_text(const tags::context& ctxt, const string&& str) = 0;
|
2021-01-10 15:30:10 -05:00
|
|
|
virtual void change_alignment(const tags::context& ctxt) = 0;
|
2021-01-10 14:49:50 -05:00
|
|
|
|
2021-02-02 17:03:44 -05: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 14:49:50 -05:00
|
|
|
|
2021-01-10 17:05:48 -05:00
|
|
|
/**
|
2021-02-02 17:03:44 -05: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 17:05:48 -05:00
|
|
|
*
|
2021-02-02 17:03:44 -05: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 17:05:48 -05:00
|
|
|
*/
|
2021-02-02 17:03:44 -05:00
|
|
|
const tags::action_context& m_action_ctxt;
|
2021-01-06 09:46:57 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
POLYBAR_NS_END
|