1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/include/components/renderer_interface.hpp
raffael0 4961a7dcfc
feat(tray): Position using a module (#2595)
Closes: #1526
Closes: #314

* debug log

* semi-working prototype. works on the left and the center but not on the right

* fixes formatting

* fixes tests

* - fixed tray_width_change signal
- implements suggestions

* - fixes error with tray positioning

* - tries to fix tests. Does not work

* - fixes tests

* - implemented suggestions

* reverted formatting in comake and doc

* - changed unique_ptr to const reference

* - fixed formatting errors in code

* - actually fixed formatting(ran clang-format)

* - implemented suggestions

* - Added CHANGELOG.md entry(not sure about wording)

* - removed bar_settings from tray_manager::setup

* - fixed issue from rebase

* - fixed issue with tests from rebase

* implemented suggestions

* Update CHANGELOG.md

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2022-04-15 23:50:04 +02:00

45 lines
1.4 KiB
C++

#pragma once
#include <map>
#include "common.hpp"
#include "tags/action_context.hpp"
#include "tags/context.hpp"
POLYBAR_NS
class renderer_interface {
public:
renderer_interface(const tags::action_context& action_ctxt) : m_action_ctxt(action_ctxt){};
virtual void render_offset(const tags::context& ctxt, const extent_val offset) = 0;
virtual void render_text(const tags::context& ctxt, const string&& str) = 0;
virtual void change_alignment(const tags::context& ctxt) = 0;
/**
* 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;
/**
* Get the absolute x-position of the start of an alignment block.
*
* The position is absolute in terms of the bar window.
*
* 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;
virtual void apply_tray_position(const tags::context& context) = 0;
protected:
/**
* Stores information about actions in the current render cycle.
*/
const tags::action_context& m_action_ctxt;
};
POLYBAR_NS_END