Cixo Develop 5 달 전
부모
커밋
d3f1884cd1
5개의 변경된 파일19개의 추가작업 그리고 98개의 파일을 삭제
  1. 0 17
      cppGTK/source/buttons.cpp
  2. 0 16
      cppGTK/source/buttons.hpp
  3. 5 7
      cppGTK/source/core.cpp
  4. 8 44
      cppGTK/source/core_window.cpp
  5. 6 14
      cppGTK/source/core_window.hpp

+ 0 - 17
cppGTK/source/buttons.cpp

@@ -1,17 +0,0 @@
-#include <gtkmm.h>
-#include <iostream>
-
-#include "strings.hpp"
-#include "buttons.hpp"
-
-namespace cx_light {
-
-add_light_button::add_light_button() {
-    this->set_label(__(ADD_LIGHT));
-}
-
-void add_light_button::on_clicked() {
-    std::cout << "Add light clicked\n";
-}
-
-}

+ 0 - 16
cppGTK/source/buttons.hpp

@@ -1,16 +0,0 @@
-#ifndef BUTTONS_HPP_INCLUDED
-#define BUTTONS_HPP_INCLUDED
-
-#include <gtkmm.h>
-
-namespace cx_light {
-
-class add_light_button : public Gtk::Button {
-    public:
-        add_light_button();
-        void on_clicked();
-};
-
-}
-
-#endif

+ 5 - 7
cppGTK/source/core.cpp

@@ -1,13 +1,11 @@
-#include <gtkmm.h>
+#include <gtkmm/application.h>
 
 #include "strings.hpp"
 #include "core_window.hpp"
 
 int main(int argc, char *argv[]) {
-    Gtk::Main kit(argc, argv);
-
-    cx_light::core_window window;
-    Gtk::Main::run(window);
-
-    return 0;
+    return Gtk
+    ::Application
+    ::create("cx-light.cixoelectronic.pl")
+    ->make_window_and_run <cx_light::core_window> (argc, argv);
 }

+ 8 - 44
cppGTK/source/core_window.cpp

@@ -1,10 +1,13 @@
-#include <gtkmm.h>
+#include <gtkmm/widget.h>
+#include <gtkmm/button.h>
+#include <gtkmm/window.h>
+#include <gtkmm/box.h>
+#include <gtkmm/orientable.h>
 #include <iostream>
 
 #include "strings.hpp"
 #include "config.hpp"
 #include "core_window.hpp"
-#include "buttons.hpp"
 
 namespace cx_light {
 
@@ -13,56 +16,17 @@ core_window::core_window() {
     this->set_default_size(400, 200);
 
     this->init_default();
-    this->show_all();
 }
 
 core_window::~core_window() {
-    delete this->add_light;
-    delete this->lights_list;
-    delete this->lights_list_frame;
-    delete this->content;
+    delete this->center;
 }
 
 void core_window::init_default() {
-    this->create_lights_list();
-
-    this->content = new Gtk::Grid();
-    this->content->attach(*this->lights_list_frame, 0, 0);
-
-    this->add(*this->content);
-}
-
-void core_window::create_lights_list() {
-    this->add_light = new add_light_button();
-
-    this->lights_list_frame = new Gtk::Frame();
-    this->lights_list_frame->set_label(__(LIGHTS_LIST));
-    this->set_margin(this->lights_list_frame, DEFAULT_MARGIN);
-
-    this->lights_list = new Gtk::ListBox();
-    this->set_margin(this->lights_list, DEFAULT_MARGIN);
-
-    this->lights_list_frame->add(*this->lights_list);
-    this->lights_list->append(*this->add_light);
+    this->center = new Gtk::Box();
+    this->center->set_orientation(Gtk::Orientation::HORIZONTAL);
 }
 
-
-void core_window::set_margin(Gtk::Widget *target, unsigned int margin) {
-    target->set_margin_top(margin);
-    target->set_margin_left(margin);
-    target->set_margin_right(margin);
-    target->set_margin_bottom(margin);
 }
 
-void core_window::set_margin(
-    Gtk::Widget *target, 
-    unsigned int margin_top, 
-    unsigned int margin_side
-) {
-    target->set_margin_top(margin_top);
-    target->set_margin_left(margin_side);
-    target->set_margin_right(margin_side);
-    target->set_margin_bottom(margin_top);
-}
 
-}

+ 6 - 14
cppGTK/source/core_window.hpp

@@ -1,31 +1,23 @@
 #ifndef CORE_WINDOW_H_INCLUDED
 #define CORE_WINDOW_H_INCLUDED
 
-#include <gtkmm.h>
+#include <gtkmm/widget.h>
+#include <gtkmm/button.h>
+#include <gtkmm/window.h>
+#include <gtkmm/box.h>
 
 #include "strings.hpp"
-#include "buttons.hpp"
 
 namespace cx_light {
 
 class core_window: public Gtk::Window {
     public:
         core_window();
-        ~core_window();
+        ~core_window() override;
 
     private:
-        Gtk::Grid *content;
-        
-        Gtk::Frame *lights_list_frame;
-        Gtk::ListBox *lights_list;
-        
-        add_light_button *add_light;
-
         void init_default();
-        void create_lights_list();
-
-        void set_margin(Gtk::Widget *, unsigned int);
-        void set_margin(Gtk::Widget *, unsigned int, unsigned int);
+        Gtk::Box *center;
 };
 
 }