Replace title bar for draw app

This commit is contained in:
daleclack 2024-03-23 22:48:14 +08:00
parent df11ea4d11
commit f08409f93e
3 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <gtkmm.h> #include <gtkmm.h>
#include "MyTitleBar.hh"
class CalcApp : public Gtk::Window class CalcApp : public Gtk::Window
{ {
@ -11,6 +12,7 @@ public:
private: private:
// Main GtkBuilder // Main GtkBuilder
Glib::RefPtr<Gtk::Builder> ref_builder; Glib::RefPtr<Gtk::Builder> ref_builder;
MyTitleBar title_bar;
// Calculator Class // Calculator Class
int pos; int pos;

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <gtkmm.h> #include <gtkmm.h>
#include "MyTitleBar.hh"
// 4 Draw modes: default(free draw), circle, line, rectangle // 4 Draw modes: default(free draw), circle, line, rectangle
enum class DrawMode{ enum class DrawMode{
@ -19,6 +20,9 @@ enum class DrawProcess{
class Drawing : public Gtk::Window class Drawing : public Gtk::Window
{ {
// Custom title bar
MyTitleBar title_bar;
// Drawing Mode // Drawing Mode
DrawMode drawing_mode; DrawMode drawing_mode;

View File

@ -15,7 +15,8 @@ Drawing::Drawing()
{ {
// Ininalize window // Ininalize window
set_icon_name("org.gtk.daleclack"); 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_default_size(640, 480);
// Set the buttons grouped and set normal draw mode // Set the buttons grouped and set normal draw mode