GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TWebCanvasFull.h
Go to the documentation of this file.
1 // Author: Sergey Linev, GSI 7/12/2016
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2019, 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 #ifndef ROOT_TWebCanvasFull
12 #define ROOT_TWebCanvasFull
13 
15 // //
16 // TWebCanvasFull //
17 // //
18 // Complete implementation of web-based TCanvasImp, //
19 // including all kind of interactivity //
20 // //
22 
23 #include "TWebCanvas.h"
24 
25 #include "TWebPadOptions.h"
26 
27 class TObjLink;
28 class TPad;
29 
30 class TWebCanvasFull : public TWebCanvas {
31 public:
33  using PadSignal_t = std::function<void(TPad *)>;
34 
36  using PadClickedSignal_t = std::function<void(TPad *, int, int)>;
37 
39  using ObjectSelectSignal_t = std::function<void(TPad *, TObject *)>;
40 
41 protected:
42 
47  Bool_t fCanCreateObjects{kTRUE};
48 
49  Bool_t ProcessData(unsigned connid, const std::string &arg) override;
50 
51  Bool_t DecodePadOptions(const std::string &) override;
52 
53  TPad *ProcessObjectOptions(TWebObjectOptions &item, TPad *pad);
54 
55  TObject *FindPrimitive(const std::string &id, TPad *pad = nullptr, TObjLink **padlnk = nullptr, TPad **objpad = nullptr);
56 
57  Bool_t CanCreateObject(const std::string &) override { return fCanCreateObjects; }
58 
59 public:
60  TWebCanvasFull(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height);
61 
62  Bool_t IsReadOnly() const override { return kFALSE; }
63 
64  void SetCanCreateObjects(Bool_t on = kTRUE) { fCanCreateObjects = on; }
65 
66  void SetActivePadChangedHandler(PadSignal_t func) { fActivePadChangedSignal = func; }
67 
68  void SetPadClickedHandler(PadClickedSignal_t func) { fPadClickedSignal = func; }
69 
70  void SetPadDblClickedHandler(PadClickedSignal_t func) { fPadDblClickedSignal = func; }
71 
72  void SetObjSelectHandler(ObjectSelectSignal_t func) { fObjSelectSignal = func; }
73 
74  ClassDefOverride(TWebCanvasFull, 0) // Web-based implementation for TCanvasImp, full interactive mode
75 };
76 
77 
78 #endif
void SetPadDblClickedHandler(PadClickedSignal_t func)
void SetActivePadChangedHandler(PadSignal_t func)
Bool_t IsReadOnly() const override
TPad * ProcessObjectOptions(TWebObjectOptions &item, TPad *pad)
std::function< void(TPad *)> PadSignal_t
Function type for pad-related signals - like click or double click.
ObjectSelectSignal_t fObjSelectSignal
! signal emitted when new object selected in the pad
TWebCanvasFull(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height)
constructor
PadClickedSignal_t fPadClickedSignal
! signal emitted when simple mouse click performed on the pad
Bool_t DecodePadOptions(const std::string &) override
Decode all pad options, which includes ranges plus objects options.
Bool_t CanCreateObject(const std::string &) override
std::function< void(TPad *, TObject *)> ObjectSelectSignal_t
Function type for signals, invoked when object is selected.
Bool_t fCanCreateObjects kTRUE
! indicates if canvas allowed to create extra objects for interactive painting
PadClickedSignal_t fPadDblClickedSignal
! signal emitted when simple mouse click performed on the pad
PadSignal_t fActivePadChangedSignal
! signal emitted when active pad changed in the canvas
void SetCanCreateObjects(Bool_t on=kTRUE)
TObject * FindPrimitive(const std::string &id, TPad *pad=nullptr, TObjLink **padlnk=nullptr, TPad **objpad=nullptr)
Class used to transport drawing options from the client.
void SetPadClickedHandler(PadClickedSignal_t func)
void SetObjSelectHandler(ObjectSelectSignal_t func)
Bool_t ProcessData(unsigned connid, const std::string &arg) override
Process reply from client, which is not processed by basic TWebCanvas.
std::function< void(TPad *, int, int)> PadClickedSignal_t
Function type for pad-click signals.