| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #pragma once
- #include "lumacs/editor_core.hpp"
- #include "lumacs/window.hpp"
- #include "lumacs/theme.hpp"
- #include <gtkmm.h>
- #include <pangomm.h>
- #include <memory>
- #include <optional>
- namespace lumacs {
- // Forward declarations
- class EditorCore;
- class Window;
- // Constants for padding
- static constexpr double PADDING_LEFT = 8.0;
- static constexpr double PADDING_TOP = 8.0;
- static constexpr double PADDING_RIGHT = 8.0;
- static constexpr double PADDING_BOTTOM = 8.0;
- class GtkRenderer {
- public:
- GtkRenderer(EditorCore& core, Gtk::DrawingArea& main_drawing_area);
- void initialize_font_metrics();
- void apply_face_attributes(Pango::AttrList& attr_list, const FaceAttributes& face, int start_index, int end_index);
- std::optional<Position> resolve_screen_pos(std::shared_ptr<Window> window, double x, double y);
- void on_draw(const Cairo::RefPtr<Cairo::Context>& cr, int width, int height,
- std::shared_ptr<Window> active_window_cache, bool cursor_visible_state);
- void draw_window(const Cairo::RefPtr<Cairo::Context>& cr, int width, int height,
- std::shared_ptr<Window> window, Gtk::DrawingArea* widget,
- std::shared_ptr<Window> active_window_cache, bool cursor_visible_state);
- void render_modeline_for_window(const Cairo::RefPtr<Cairo::Context>& cr, int width, int height,
- std::shared_ptr<Window> window,
- std::shared_ptr<Window> active_window_cache);
-
- void render_minibuffer(const Cairo::RefPtr<Cairo::Context>& cr, int width, int height);
- private:
- EditorCore& core_;
- Gtk::DrawingArea& main_drawing_area_;
- Pango::FontDescription font_desc_;
- bool font_initialized_ = false;
- double char_width_ = 0;
- double line_height_ = 0;
- double ascent_ = 0;
- };
- } // namespace lumacs
|