JG ROOT Tools libraries  version 5.0 - august 2014
RGPrintRequester.hh
Go to the documentation of this file.
1 //======================================================================
2 /*! \file RGPrintRequester.hh
3  *
4  * Include file for class RGPrintRequester
5  */
6 //======================================================================
7 
8 #ifndef RG_PRINT_REQUESTER_HH
9 #define RG_PRINT_REQUESTER_HH
10 
11 #include "RGMessageRequester.hh"
12 #include "RGPadPrintCommand.hh"
13 #include "RDico.hh"
14 
15 #include <TStyle.h>
16 #include <TSystem.h>
17 #include <TPad.h>
18 
19 
20 /*! New options for RGPrintRequester.*/
22 {
23  rgReqNoPrintFormat = 0x00010000 // pas de widget de format de papier
24 };
25 
26 //======================================================================
27 /*! class RGPrintRequester
28  *
29  * This class defines a print request:
30  * - either to print a file
31  * - either to get a printing command
32  *
33  * In the command line, the file name is indicated by '%f' tag.
34  *
35  * For a request returning a printing command, if '%f' tag is found, it
36  * is replaced by the file name, else the file name is added at the
37  * end of the command.
38  *
39  * The type of request depends on the constructor choice.
40  * The options are kept in static variables of the class, so that
41  * they are memorized.
42  */
44 {
45  //------------------------------------------------------------
46  /*! \object_doc{RGPrintRequester} */
48  //------------------------------------------------------------
49 
50  private:
51 
52  static string default_command; ///< Print command
53  static Double_t default_size_x; ///< Paper width
54  static Double_t default_size_y; ///< Paper height
55  static Int_t default_orientation; ///< Paper orientation
56 
57 #ifndef __MAKECINT__
58  string * print_command; ///< Result print command pointer
59 #endif
60  bool exec_print; ///< Flag if command must be executed (printing)
61 
62  string file_name; ///< File name to print
63  TPad * pad_ptr; ///< Pointer to pad to print
64 
65  // widgets
66  RGPadPrintCommand * w_print_cmd; ///< Print command widget
67 
68  //------------------------------------------------------------
69  // Constructors / affectation / destructor
70  public:
71  // Constructor with command return
72  RGPrintRequester ( const TGWindow * parent,
73  const TGWindow * main,
74  string & command,
75  int & result,
76  const char * title,
77  const char * message = "",
78  const char * buttons = rDico.prrq_print_buttons.c_str(),
79  const ULong_t opts = 0,
80  const bool auto_start = true);
81 
82  // Constructor with command return, including file name
83  RGPrintRequester ( const TGWindow * parent,
84  const TGWindow * main,
85  const string & fname,
86  string & command,
87  int & result,
88  const char * title,
89  const char * message = "",
90  const char * buttons = rDico.prrq_print_buttons.c_str(),
91  const ULong_t opts = 0,
92  const bool auto_start = true);
93 
94  // Constructor without command return for immediate printing of file
95  RGPrintRequester ( const TGWindow * parent,
96  const TGWindow * main,
97  const string & fname,
98  const char * title,
99  const char * message = "",
100  const char * buttons = rDico.prrq_print_buttons.c_str(),
101  const ULong_t opts = 0,
102  const bool auto_start = true);
103 
104  // Constructor without command return for immediate printing of a pad
105  RGPrintRequester ( const TGWindow * parent,
106  const TGWindow * main,
107  TPad * pad,
108  const char * title,
109  const char * message = "",
110  const char * buttons = rDico.prrq_print_buttons.c_str(),
111  const ULong_t opts = 0,
112  const bool auto_start = true);
113 
114  private:
115  RGPrintRequester ( const RGPrintRequester & req );
116 
117  public:
118  virtual ~RGPrintRequester();
119 
120  //------------------------------------------------------------
121  // Construction
122  virtual void Construct ( );
123 
124  static string GetCommand ( ); // inline
125  static Double_t GetSizeX ( ); // inline
126  static Double_t GetSizeY ( ); // inline
127  static Int_t GetOrientation ( ); // inline
128  static string GetPrintOptions ( );
129 
130  static void SetCommand ( const string &cmd ); // inline
131  static void SetSizeX ( const Double_t x ); // inline
132  static void SetSizeY ( const Double_t y ); // inline
133  static void SetOrientation ( const Int_t opt ); // inline
134 
135  static string GetPrintCommand ( const string & fname );
136  static void Print ( const string & fname );
137  static void Print ( TPad * pad );
138 
139  //------------------------------------------------------------
140  // Slot
141  virtual void Button ( const int n );
142 
143  //------------------------------------------------------------
144  /*! For ROOT dictionary.*/
146 };
147 
148 //----------------------------------------------------------------------
149 // Inline functions
150 #include "icc/RGPrintRequester.icc"
151 
152 //======================================================================
153 #endif
string * print_command
Result print command pointer.
Definition: RGPrintRequester.hh:58
Definition: RGPadPrintCommand.hh:44
GObject(RGPrintRequester)
virtual void Construct()
Definition: RGPrintRequester.cpp:220
static Double_t GetSizeY()
Definition: RGPrintRequester.icc:21
bool exec_print
Flag if command must be executed (printing)
Definition: RGPrintRequester.hh:60
static Double_t GetSizeX()
Definition: RGPrintRequester.icc:17
string prrq_print_buttons
Button texts.
Definition: RDico.hh:207
static void SetSizeX(const Double_t x)
Definition: RGPrintRequester.icc:38
string file_name
File name to print.
Definition: RGPrintRequester.hh:62
TPad * pad_ptr
Pointer to pad to print.
Definition: RGPrintRequester.hh:63
static Int_t GetOrientation()
Definition: RGPrintRequester.icc:25
static void SetCommand(const string &cmd)
Definition: RGPrintRequester.icc:32
static void SetOrientation(const Int_t opt)
Definition: RGPrintRequester.icc:50
virtual void Button(const int n)
Definition: RGPrintRequester.cpp:335
RGPadPrintCommand * w_print_cmd
Print command widget.
Definition: RGPrintRequester.hh:66
virtual ~RGPrintRequester()
Definition: RGPrintRequester.cpp:211
static Double_t default_size_y
Paper height.
Definition: RGPrintRequester.hh:54
RGPrintRequesterOptions
Definition: RGPrintRequester.hh:21
static void SetSizeY(const Double_t y)
Definition: RGPrintRequester.icc:44
static string GetPrintOptions()
Definition: RGPrintRequester.cpp:243
static Double_t default_size_x
Paper width.
Definition: RGPrintRequester.hh:53
Definition: RGPrintRequester.hh:43
RDico & rDico
! Unique instance of the dictionary class
Definition: RDico.cpp:12
static Int_t default_orientation
Paper orientation.
Definition: RGPrintRequester.hh:55
static string GetCommand()
Definition: RGPrintRequester.icc:13
static void Print(const string &fname)
Definition: RGPrintRequester.cpp:293
ClassDef(RGPrintRequester, 0)
static string default_command
Print command.
Definition: RGPrintRequester.hh:52
Definition: RGMessageRequester.hh:22
RGPrintRequester(const TGWindow *parent, const TGWindow *main, string &command, int &result, const char *title, const char *message="", const char *buttons=rDico.prrq_print_buttons.c_str(), const ULong_t opts=0, const bool auto_start=true)
Definition: RGPrintRequester.cpp:37
static string GetPrintCommand(const string &fname)
Definition: RGPrintRequester.cpp:263