changeset 131:d51a648d5276

Client: new style in window
author David Demelier <markand@malikania.fr>
date Wed, 27 Sep 2017 12:38:40 +0200
parents f58075b58fa1
children 37df5aa9ba82
files libclient/malikania/client/window.cpp libclient/malikania/client/window.hpp
diffstat 2 files changed, 33 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/libclient/malikania/client/window.cpp	Wed Sep 27 06:37:18 2017 +0200
+++ b/libclient/malikania/client/window.cpp	Wed Sep 27 12:38:40 2017 +0200
@@ -43,8 +43,8 @@
 }
 
 window::window(unsigned width, unsigned height, const std::string& title)
-    : m_backend(std::make_unique<backend_impl>(*this, width, height, title))
-    , m_theme(std::make_unique<mlk::client::theme>())
+    : backend_(std::make_unique<backend_impl>(*this, width, height, title))
+    , theme_(std::make_unique<mlk::client::theme>())
 {
 }
 
@@ -54,90 +54,90 @@
 
 void window::clear()
 {
-    m_backend->clear();
+    backend_->clear();
 }
 
 void window::present()
 {
-    m_backend->present();
+    backend_->present();
 }
 
 void window::close() noexcept
 {
-    m_is_open = false;
-    m_backend->close();
+    is_open_ = false;
+    backend_->close();
 }
 
 color window::drawing_color() const
 {
-    return m_backend->drawing_color();
+    return backend_->drawing_color();
 }
 
 void window::set_drawing_color(const color& color)
 {
-    m_backend->set_drawing_color(color);
+    backend_->set_drawing_color(color);
 }
 
 void window::draw_line(const line& line)
 {
-    m_backend->draw_line(line);
+    backend_->draw_line(line);
 }
 
 void window::draw_lines(const std::vector<point>& points)
 {
-    m_backend->draw_lines(points);
+    backend_->draw_lines(points);
 }
 
 void window::draw_point(const point& point)
 {
-    m_backend->draw_point(point);
+    backend_->draw_point(point);
 }
 
 void window::draw_points(const std::vector<point>& points)
 {
-    m_backend->draw_points(points);
+    backend_->draw_points(points);
 }
 
 void window::draw_rectangle(const rectangle& rectangle)
 {
-    m_backend->draw_rectangle(rectangle);
+    backend_->draw_rectangle(rectangle);
 }
 
 void window::draw_rectangles(const std::vector<rectangle>& rectangles)
 {
-    m_backend->draw_rectangles(rectangles);
+    backend_->draw_rectangles(rectangles);
 }
 
 void window::draw_frames()
 {
-    for (const auto& f : m_frames) {
+    for (const auto& f : frames_) {
         f->draw(*this);
     }
 }
 
 void window::fill_rectangle(const rectangle& rectangle)
 {
-    m_backend->fill_rectangle(rectangle);
+    backend_->fill_rectangle(rectangle);
 }
 
 void window::fill_rectangles(const std::vector<rectangle>& rectangles)
 {
-    m_backend->fill_rectangles(rectangles);
+    backend_->fill_rectangles(rectangles);
 }
 
 void window::draw_text(const std::string& text, font& font, const rectangle& rectangle)
 {
-    m_backend->draw_text(text, font, rectangle);
+    backend_->draw_text(text, font, rectangle);
 }
 
 void window::draw_text(const std::string& text, font& font, const point& point)
 {
-    m_backend->draw_text(text, font, point);
+    backend_->draw_text(text, font, point);
 }
 
 void window::poll()
 {
-    m_backend->poll(*this);
+    backend_->poll(*this);
 }
 
 void window::handle_key_down(const key_event&)
@@ -150,7 +150,7 @@
 
 void window::handle_mouse_down(const mouse_click_event& ev)
 {
-    for (const auto& f : m_frames) {
+    for (const auto& f : frames_) {
         if (is_frame_bound(*f, ev.pos)) {
             f->layout()->handle_mouse_down({
                 ev.button,
@@ -170,7 +170,7 @@
 
 void window::handle_quit()
 {
-    m_is_open = false;
+    is_open_ = false;
 }
 
 window& window::operator=(window&&) noexcept = default;
--- a/libclient/malikania/client/window.hpp	Wed Sep 27 06:37:18 2017 +0200
+++ b/libclient/malikania/client/window.hpp	Wed Sep 27 12:38:40 2017 +0200
@@ -53,11 +53,11 @@
 private:
     class backend_impl;
 
-    std::unique_ptr<backend_impl> m_backend;
-    std::unique_ptr<mlk::client::theme> m_theme;
-    std::unordered_set<std::shared_ptr<frame>> m_frames;
+    std::unique_ptr<backend_impl> backend_;
+    std::unique_ptr<mlk::client::theme> theme_;
+    std::unordered_set<std::shared_ptr<frame>> frames_;
 
-    bool m_is_open{true};
+    bool is_open_{true};
 
     bool is_frame_bound(frame&, const point&) noexcept;
 
@@ -91,7 +91,7 @@
      */
     inline bool is_open() const noexcept
     {
-        return m_is_open;
+        return is_open_;
     }
 
     /**
@@ -101,7 +101,7 @@
      */
     inline const backend_impl& backend() const noexcept
     {
-        return *m_backend;
+        return *backend_;
     }
 
     /**
@@ -111,17 +111,17 @@
      */
     inline backend_impl& backend() noexcept
     {
-        return *m_backend;
+        return *backend_;
     }
 
     void add_frame(std::shared_ptr<mlk::client::frame> frame)
     {
-        m_frames.insert(std::move(frame));
+        frames_.insert(std::move(frame));
     }
 
     void remove_frame(std::shared_ptr<mlk::client::frame> frame)
     {
-        m_frames.erase(frame);
+        frames_.erase(frame);
     }
 
     /**
@@ -131,7 +131,7 @@
      */
     inline const mlk::client::theme& theme() const noexcept
     {
-        return *m_theme;
+        return *theme_;
     }
 
     /**
@@ -141,7 +141,7 @@
      */
     inline mlk::client::theme& theme() noexcept
     {
-        return *m_theme;
+        return *theme_;
     }
 
     /**