Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Gtk4CanvasWindow.h
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 12/08/2026
2
3/*************************************************************************
4 * Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11/* gtkmm example Copyright (C) 2002 gtkmm development team
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, see <https://www.gnu.org/licenses/>.
25 */
26
27#ifndef ROOT_Gtk4CanvasWindow_H
28#define ROOT_Gtk4CanvasWindow_H
29
30#include <gtkmm.h>
31
32#include "Gtk4DrawArea.h"
33#include <vector>
34#include <string>
35
36class TCanvas;
37
38class Gtk4CanvasWindow : public Gtk::Window {
39public:
40 Gtk4CanvasWindow(TCanvas *canv = nullptr, unsigned width = 400, unsigned height = 200);
41 virtual ~Gtk4CanvasWindow();
42
44
45private:
46 const std::vector<std::string> &GetSupportedFileFormats() const;
47
48 // Signal handlers:
49
50 void on_status_changed(const char *msg);
51 void on_show_toolbar_changed(const Glib::VariantBase &);
52 void on_show_eventstatus_changed(const Glib::VariantBase &);
53 void on_show_tooltip_changed(const Glib::VariantBase &);
54 void on_file_selected(const Glib::RefPtr<Gio::AsyncResult> &result);
55 void on_save_selected(const Glib::RefPtr<Gio::AsyncResult> &result);
56 void on_openRootFile();
57 void on_saveCanvas(const std::string &fname, const std::string &opt);
58 void on_saveCanvasAs();
59 void on_printCanvas();
60
61 // void on_action_file_new();
62 // void on_action_file_quit();
63 // void on_action_others();
64 // void on_action_toggle();
65
66 void fillSaveMenu(TCanvas *canv);
67 void fillMenuBar(TCanvas *canv);
68
69 void fillToolBar();
70
71 void clickToolButton(int id);
72
73 // Child widgets:
74 Gtk::Box m_Box;
75
76 Glib::RefPtr<Gio::SimpleActionGroup> m_action_group;
77 std::string fCanvasFileName;
78 Glib::RefPtr<Gio::Menu> fSaveMenu;
79
80 Glib::RefPtr<Gtk::FileDialog> m_file_dialog;
81 Glib::RefPtr<Gtk::FileDialog> m_save_dialog;
82
83 Gtk::Box m_ToolBar;
85 Gtk::Statusbar m_StatusBar;
86 unsigned int fContextId = 0;
87};
88
89#endif //GTKMM_Gtk4CanvasWindow_H
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
void on_show_tooltip_changed(const Glib::VariantBase &)
Glib::RefPtr< Gtk::FileDialog > m_file_dialog
void on_show_eventstatus_changed(const Glib::VariantBase &)
Glib::RefPtr< Gio::SimpleActionGroup > m_action_group
void on_status_changed(const char *msg)
Gtk4DrawArea m_DrawArea
const std::vector< std::string > & GetSupportedFileFormats() const
Return vector with supported file formats with description and print option To be moved in base class...
void on_saveCanvas(const std::string &fname, const std::string &opt)
Save canvas with specified format.
void on_save_selected(const Glib::RefPtr< Gio::AsyncResult > &result)
Signal handler when save as dialog select file.
unsigned int fContextId
std::string fCanvasFileName
void fillSaveMenu(TCanvas *canv)
Fill or update canvas save menu Only performed when canvas name is changed.
void on_file_selected(const Glib::RefPtr< Gio::AsyncResult > &result)
Signal handler when open file dialog select file.
void on_show_toolbar_changed(const Glib::VariantBase &)
Gtk::Statusbar m_StatusBar
Glib::RefPtr< Gio::Menu > fSaveMenu
void clickToolButton(int id)
Gtk4DrawArea * GetDrawArea()
Gtk4CanvasWindow(TCanvas *canv=nullptr, unsigned width=400, unsigned height=200)
void fillMenuBar(TCanvas *canv)
void on_saveCanvasAs()
Start Save as dialog.
Glib::RefPtr< Gtk::FileDialog > m_save_dialog
The Canvas class.
Definition TCanvas.h:23