tbx  0.7.5
resprintdbox.h
1 /*
2  * tbx RISC OS toolbox library
3  *
4  * Copyright (C) 2010 Alan Buckley All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 
25 #ifndef TBX_RES_RESPRINTDBOX_H
26 #define TBX_RES_RESPRINTDBOX_H
27 
28 #include "resobject.h"
29 
30 namespace tbx {
31 namespace res {
32 
36 class ResPrintDbox : public ResObject
37 {
38 
39 public:
40  enum {CLASS_ID = 0x82b00 };
41 
48  ResPrintDbox(const ResObject &other) : ResObject(other)
49  {
50  check_class_id(CLASS_ID);
51  }
52 
58  ResPrintDbox(const ResPrintDbox &other) : ResObject(other)
59  {
60  }
61 
62  virtual ~ResPrintDbox() {}
63 
71  {
72  other.check_class_id(CLASS_ID);
73  ResBase::operator=(other);
74  return *this;
75  }
76 
83  {
84  ResBase::operator=(other);
85  return *this;
86  }
87 
95  ResPrintDbox(std::string name)
96  : ResObject(name, CLASS_ID, 100, 36+28)
97  {
98  flags(0x2f8); // has page range, copies, scale, orientation, save, draft
99  from(1);
100  to(1);
101  copies(1);
102  scale(100);
103  init_string(20,0); // further_options
104  init_string(24,0); // window
105  }
106 
107 
116  int flags() const {return int_value(0);}
125  void flags(int value) {int_value(0,value);}
131  bool generate_about_to_be_shown() const {return flag(0, 1<<0);}
137  void generate_about_to_be_shown(bool value) {flag(0,1<<0,value);}
143  bool generate_dialogue_completed() const {return flag(0, 1<<1);}
149  void generate_dialogue_completed(bool value) {flag(0,1<<1,value);}
156  bool generate_setup_about_to_be_shown() const {return flag(0, 1<<2);}
163  void generate_setup_about_to_be_shown(bool value) {flag(0,1<<2,value);}
169  bool has_page_range() const {return flag(0, 1<<3);}
175  void has_page_range(bool value) {flag(0,1<<3,value);}
181  bool has_copies() const {return flag(0, 1<<4);}
187  void has_copies(bool value) {flag(0,1<<4,value);}
193  bool has_scale() const {return flag(0, 1<<5);}
199  void has_scale(bool value) {flag(0,1<<5,value);}
205  bool has_orientation() const {return flag(0, 1<<6);}
211  void has_orientation(bool value) {flag(0,1<<6,value);}
217  bool has_save() const {return flag(0, 1<<7);}
223  void has_save(bool value) {flag(0,1<<7,value);}
229  bool has_setup() const {return flag(0, 1<<8);}
235  void has_setup(bool value) {flag(0,1<<8,value);}
241  bool has_draft() const {return flag(0, 1<<9);}
247  void has_draft(bool value) {flag(0,1<<9,value);}
253  bool has_from_to() const {return flag(0, 1<<10);}
259  void has_from_to(bool value) {flag(0,1<<10,value);}
265  bool sideways_selected() const {return flag(0, 1<<11);}
271  void sideways_selected(bool value) {flag(0,1<<11,value);}
277  bool draft_selected() const {return flag(0, 1<<12);}
283  void draft_selected(bool value) {flag(0,1<<12,value);}
284 
290  int from() const {return int_value(4);}
296  void from(int value) {int_value(4,value);}
302  int to() const {return int_value(8);}
308  void to(int value) {int_value(8,value);}
314  int copies() const {return int_value(12);}
320  void copies(int value) {int_value(12,value);}
326  int scale() const {return int_value(16);}
332  void scale(int value) {int_value(16,value);}
333 
339  const char *further_options() const {return string(20);}
345  void further_options(const char *value) {string(20, value);}
351  void further_options(const std::string &value) {string(20, value);}
358  const char *window() const {return string(24);}
365  void window(const char *value) {string(24);}
372  void window(const std::string &value) {string(24, value);}
373 
374 };
375 
376 }
377 }
378 
379 #endif // TBX_RES_RESPRINTDBOX_H
380 
void generate_about_to_be_shown(bool value)
Set if the about to be shown event should be generated.
Definition: resprintdbox.h:137
void has_save(bool value)
Set if the dialogue has a save button.
Definition: resprintdbox.h:223
const char * window() const
Get the name of the window template that provides the window for this object.
Definition: resprintdbox.h:358
bool has_scale() const
Check if the scale can be specified.
Definition: resprintdbox.h:193
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:34
void has_copies(bool value)
Set if the number of copies can be specified.
Definition: resprintdbox.h:187
bool generate_dialogue_completed() const
Check if the dialogue completed event should be generated.
Definition: resprintdbox.h:143
void has_orientation(bool value)
Set if the orientation can be specified.
Definition: resprintdbox.h:211
void init_string(int offset, const char *value)
Initialise a string in a constructor helper.
Definition: resbase.cc:1725
void to(int value)
Set to page number when dialogue is shown.
Definition: resprintdbox.h:308
const char * further_options() const
Get the name of the window that shows further options.
Definition: resprintdbox.h:339
bool has_page_range() const
Check if the dialogue will show a choice of page range.
Definition: resprintdbox.h:169
void has_draft(bool value)
Set if the dialogue include a draft option.
Definition: resprintdbox.h:247
int to() const
Get to page number when dialogue is shown.
Definition: resprintdbox.h:302
void draft_selected(bool value)
Set if draft is selected when dialogue is shown.
Definition: resprintdbox.h:283
bool flag(int offset, int mask) const
Check if any of the bits in a mask are set.
Definition: resbase.h:352
void has_from_to(bool value)
Set if from/to for page range is set.
Definition: resprintdbox.h:259
int copies() const
Get the number of copies set when the dialogue is shown.
Definition: resprintdbox.h:314
ResPrintDbox(const ResPrintDbox &other)
Construct a print dialogue resource by copying another.
Definition: resprintdbox.h:58
void check_class_id(int class_id) const
Check if this objects class id is as specified.
Definition: resobject.cc:383
Classes to use/edit toolbox resources in memory.
void sideways_selected(bool value)
Set if sideways is selected when dialogue is shown.
Definition: resprintdbox.h:271
bool generate_about_to_be_shown() const
Check if the about to be shown event should be generated.
Definition: resprintdbox.h:131
void flags(int value)
Set all the flags.
Definition: resprintdbox.h:125
ResPrintDbox(const ResObject &other)
Construct a print dialogue resource from a ResObject.
Definition: resprintdbox.h:48
void further_options(const std::string &value)
Set the name of the window that shows further options.
Definition: resprintdbox.h:351
Class for PrintDbox object template.
Definition: resprintdbox.h:36
ResPrintDbox(std::string name)
Construct a print dialogue resource.
Definition: resprintdbox.h:95
int int_value(int offset) const
Get an integer value.
Definition: resbase.h:316
bool sideways_selected() const
Check if sideways is selected when dialogue is shown.
Definition: resprintdbox.h:265
void window(const char *value)
Set the name of the window template that provides the window for this object.
Definition: resprintdbox.h:365
const char * string(int offset) const
Return a string at the given offset.
Definition: resbase.cc:1555
bool draft_selected() const
Check if draft is selected when dialogue is shown.
Definition: resprintdbox.h:277
void scale(int value)
Set the scale set when the dialogue is shown.
Definition: resprintdbox.h:332
bool generate_setup_about_to_be_shown() const
Check if an event should be generated when the printer setup dialogue is about to be shown...
Definition: resprintdbox.h:156
void window(const std::string &value)
Set the name of the window template that provides the window for this object.
Definition: resprintdbox.h:372
void has_scale(bool value)
Set if the scale can be specified.
Definition: resprintdbox.h:199
int flags() const
Raw access to all the object flags.
Definition: resprintdbox.h:116
void copies(int value)
Set the number of copies set when the dialogue is shown.
Definition: resprintdbox.h:320
void generate_dialogue_completed(bool value)
Set if the dialogue completed event should be generated.
Definition: resprintdbox.h:149
bool has_copies() const
Check if the number of copies can be specified.
Definition: resprintdbox.h:181
const char * name() const
Return pointer to name of object.
Definition: resobject.h:79
ResPrintDbox & operator=(const ResPrintDbox &other)
Assign from another print dialogue resource.
Definition: resprintdbox.h:82
bool has_setup() const
Check if the dialogue has a setup button.
Definition: resprintdbox.h:229
bool has_draft() const
Check if the dialogue include a draft option.
Definition: resprintdbox.h:241
ResBase & operator=(const ResBase &other)
Assignment.
Definition: resbase.cc:1534
int from() const
Get from page number when dialogue is shown.
Definition: resprintdbox.h:290
ResPrintDbox & operator=(const ResObject &other)
Assign from a ResObject.
Definition: resprintdbox.h:70
Base class for a resource object that can be edited.
Definition: resobject.h:52
bool has_save() const
Check if the dialogue has a save button.
Definition: resprintdbox.h:217
bool has_from_to() const
Check if from/to for page range is set.
Definition: resprintdbox.h:253
void from(int value)
Set from page number when dialogue is shown.
Definition: resprintdbox.h:296
bool has_orientation() const
Check if the orientation can be specified.
Definition: resprintdbox.h:205
void has_setup(bool value)
Set if the dialogue has a setup button.
Definition: resprintdbox.h:235
void has_page_range(bool value)
Set if the dialogue will show a choice of page range.
Definition: resprintdbox.h:175
void generate_setup_about_to_be_shown(bool value)
Set if an event should be generated when the printer setup dialogue is about to be shown...
Definition: resprintdbox.h:163
int scale() const
Get the scale set when the dialogue is shown.
Definition: resprintdbox.h:326
void further_options(const char *value)
Set the name of the window that shows further options.
Definition: resprintdbox.h:345