From f08409f93e67526f206cf2492a36afbd46e5d709 Mon Sep 17 00:00:00 2001 From: daleclack Date: Sat, 23 Mar 2024 22:48:14 +0800 Subject: [PATCH] Replace title bar for draw app --- Gtkmm3_Mac/src/apps/CalcApp.hh | 2 ++ Gtkmm3_Mac/src/apps/drawing.hh | 4 ++++ Gtkmm3_Mac/src/draw_app/drawing.cc | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Gtkmm3_Mac/src/apps/CalcApp.hh b/Gtkmm3_Mac/src/apps/CalcApp.hh index 52b28a4..69a9735 100644 --- a/Gtkmm3_Mac/src/apps/CalcApp.hh +++ b/Gtkmm3_Mac/src/apps/CalcApp.hh @@ -1,6 +1,7 @@ #pragma once #include +#include "MyTitleBar.hh" class CalcApp : public Gtk::Window { @@ -11,6 +12,7 @@ public: private: // Main GtkBuilder Glib::RefPtr ref_builder; + MyTitleBar title_bar; // Calculator Class int pos; diff --git a/Gtkmm3_Mac/src/apps/drawing.hh b/Gtkmm3_Mac/src/apps/drawing.hh index 5f1af99..c5b31e2 100644 --- a/Gtkmm3_Mac/src/apps/drawing.hh +++ b/Gtkmm3_Mac/src/apps/drawing.hh @@ -1,6 +1,7 @@ #pragma once #include +#include "MyTitleBar.hh" // 4 Draw modes: default(free draw), circle, line, rectangle enum class DrawMode{ @@ -19,6 +20,9 @@ enum class DrawProcess{ class Drawing : public Gtk::Window { + // Custom title bar + MyTitleBar title_bar; + // Drawing Mode DrawMode drawing_mode; diff --git a/Gtkmm3_Mac/src/draw_app/drawing.cc b/Gtkmm3_Mac/src/draw_app/drawing.cc index 1b10065..6f3b345 100644 --- a/Gtkmm3_Mac/src/draw_app/drawing.cc +++ b/Gtkmm3_Mac/src/draw_app/drawing.cc @@ -15,7 +15,8 @@ Drawing::Drawing() { // Ininalize window set_icon_name("org.gtk.daleclack"); - set_title("Drawing"); + title_bar.set_ctrl_win(this); + title_bar.set_title("Drawing"); set_default_size(640, 480); // Set the buttons grouped and set normal draw mode