76 cr->set_source_rgb(0.15, 0.15, 0.15);
81 cr->set_source_rgb(0.2, 0.5, 0.8);
82 cr->arc(
width / 2.0,
height / 2.0, radius, 0.0, 2.0 * 3.1415927);
97 cache_context->set_source_rgb(1., 1., 1.);
98 cache_context->paint();
122 case GDK_BUTTON_PRIMARY:
125 case GDK_BUTTON_MIDDLE:
128 case GDK_BUTTON_SECONDARY:
149 case GDK_BUTTON_PRIMARY:
152 case GDK_BUTTON_MIDDLE:
155 case GDK_BUTTON_SECONDARY:
195 if ((modifiers & Gdk::ModifierType::BUTTON1_MASK) == Gdk::ModifierType::BUTTON1_MASK) {
197 }
else if ((modifiers & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK) {
209 buffer = selected->GetName();
211 buffer.
Append(selected->GetObjectInfo(px, py));
213 buffer.
Form(
"No selected object x = %d y = %d", px, py);
240 if (title && *title) {
241 auto item = Gio::MenuItem::create(
"",
"");
242 item->set_attribute_value(
"custom", Glib::Variant<Glib::ustring>::create(
"header"));
243 menu_model->prepend_item(item);
246 auto menu = Gtk::make_managed<Gtk::PopoverMenu>(menu_model);
247 menu->set_parent(*
this);
248 menu->set_has_arrow(
false);
250 menu->add_css_class(
"compact-menu");
252 static bool has_compact_style =
false;
253 if (!has_compact_style) {
254 auto css_provider = Gtk::CssProvider::create();
255 std::string css_data =
256 "popover.compact-menu contents modelbutton, "
257 "popover.compact-menu contents button.model { "
258 " padding-top: 1px; "
259 " padding-bottom: 0px; "
261 " margin-bottom: 0px; "
262 " min-height: 10px; "
265 css_provider->load_from_data(css_data);
268 Gtk::StyleContext::add_provider_for_display(
269 Gdk::Display::get_default(),
271 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
274 has_compact_style =
true;
277 if (title && *title) {
278 auto label = Gtk::make_managed<Gtk::Label>(title);
279 label->add_css_class(
"heading");
280 menu->add_child(*label,
"header");
283 Gdk::Rectangle
rect(
x,
y, 1, 1);
286 menu->set_pointing_to(
rect);
294 if (keyboard_tooltip)
301 TObject *selected = canv->GetSelected();
302 Int_t px = canv->GetEventX();
303 Int_t py = canv->GetEventY();
306 customText.
Form(
"%s::%s\n%s\n%d, %d\n%s",selected->ClassName() ,selected->GetName(),
307 selected->GetTitle(), px, py, selected->GetObjectInfo(px, py));
309 customText.
Form(
"No selected object\n%d, %d",
x,
y);
311 tooltip->set_text(customText.
Data());
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 rect
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
bool on_mouse_scroll(double dx, double dy)
Cairo::RefPtr< Cairo::ImageSurface > fDrawingCache
void on_mouse_move(double x, double y)
Glib::RefPtr< Gtk::GestureClick > m_click_gesture
sigc::signal< void(const char *) status_changed)()
void on_mouse_enter(double x, double y)
Glib::RefPtr< Gtk::EventControllerMotion > m_motion_controller
TCanvas * GetCanvas() const
Glib::RefPtr< Gtk::EventControllerScroll > m_scroll_controller
sigc::signal< void(const char *) m_status_changed)
void on_mouse_released(int n_press, double x, double y)
void ShowContextMenu(Glib::RefPtr< Gio::Menu > menu_model, const char *title, int x, int y)
Shows context menu with provided items and title at specified position.
void on_draw(const Cairo::RefPtr< Cairo::Context > &cr, int width, int height)
void on_mouse_click(int n_press, double x, double y)
bool on_my_query_tooltip(int x, int y, bool keyboard_tooltip, const Glib::RefPtr< Gtk::Tooltip > &tooltip)
Cairo::Context * fContext
Int_t GetEventY() const override
virtual void Resize(Option_t *option="")
Recompute canvas parameters following a X11 Resize.
virtual void HandleInput(EEventType button, Int_t x, Int_t y)
Handle Input Events.
TObject * GetSelected() const override
Int_t GetEventX() const override
UInt_t GetPadHeight() const override
UInt_t GetPadWidth() const override
void Paint(Option_t *option="") override
Paint canvas.
Mother of all ROOT objects.
const char * Data() const
TString & Append(const char *cs)
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.