Hypr/src/bar/Bar.hpp

46 lines
1.1 KiB
C++
Raw Normal View History

2021-11-21 11:25:26 +01:00
#pragma once
#include <unordered_map>
#include "../defines.hpp"
#include "../ipc/ipc.hpp"
2021-11-21 11:25:26 +01:00
struct SDrawingContext {
xcb_gcontext_t GContext;
xcb_font_t Font;
};
class CStatusBar {
public:
EXPOSED_MEMBER(WindowID, xcb_window_t, i);
2021-11-21 17:40:02 +01:00
EXPOSED_MEMBER(MonitorID, int, i);
2021-11-24 19:17:13 +01:00
EXPOSED_MEMBER(StatusCommand, std::string, sz); // TODO: make the bar better
2021-11-21 11:25:26 +01:00
void draw();
2021-11-21 20:40:22 +01:00
void setup(int MonitorID);
2021-11-21 12:40:03 +01:00
void destroy();
2021-11-21 11:25:26 +01:00
std::vector<int> openWorkspaces;
EXPOSED_MEMBER(CurrentWorkspace, int, i);
2021-11-21 11:25:26 +01:00
private:
Vector2D m_vecSize;
Vector2D m_vecPosition;
xcb_pixmap_t m_iPixmap;
// Cairo
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;
void drawText(Vector2D, std::string, uint32_t);
int getTextWidth(std::string);
2021-11-21 11:25:26 +01:00
std::unordered_map<std::string, SDrawingContext> m_mContexts;
};
// Main thread for the bar. Is only initted once in main.cpp so we can do this.
int64_t barMainThread();