tbx  0.7.6
resfontdbox.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_RESFONTDBOX_H
26 #define TBX_RES_RESFONTDBOX_H
27 
28 #include "resobject.h"
29 
30 namespace tbx {
31 namespace res {
32 
36 class ResFontDbox : public ResObject
37 {
38 
39 public:
40  enum {CLASS_ID = 0x82a00 };
41 
48  ResFontDbox(const ResObject &other) : ResObject(other)
49  {
50  check_class_id(CLASS_ID);
51  }
52 
58  ResFontDbox(const ResFontDbox &other) : ResObject(other)
59  {
60  }
61 
62  virtual ~ResFontDbox() {}
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  ResFontDbox(std::string name)
96  : ResObject(name, CLASS_ID, 100, 36 + 32)
97  {
98  init_message(4,0); // title
99  init_string(12,0); // initial_font
100  initial_height(12);
101  initial_aspect(100);
102  init_message(24,"The quick brown fox jumps over the lazy dog"); // try_string
103  init_string(28,0); // window
104  }
105 
106 
115  int flags() const {return int_value(0);}
124  void flags(int value) {int_value(0,value);}
130  bool generate_about_to_be_shown() const {return flag(0, 1<<0);}
136  void generate_about_to_be_shown(bool value) {flag(0,1<<0,value);}
142  bool generate_dialogue_completed() const {return flag(0, 1<<1);}
148  void generate_dialogue_completed(bool value) {flag(0,1<<1,value);}
154  bool include_system_font() const {return flag(0, 1<<2);}
160  void include_system_font(bool value) {flag(0,1<<2,value);}
161 
167  const char *title() const {return message(4);}
175  void title(const char *value, int max_length = -1) {message_with_length(4, value, max_length);}
183  void title(const std::string &value, int max_length = -1) {message_with_length(4, value, max_length);}
187  int max_title() const {return int_value(8);}
188 
194  const char *initial_font() const {return string(12);}
200  void initial_font(const char *value) {string(12, value);}
206  void initial_font(const std::string &value) {string(12, value);}
212  int initial_height() const {return int_value(16);}
218  void initial_height(int value) {int_value(16,value);}
224  int initial_aspect() const {return int_value(20);}
230  void initial_aspect(int value) {int_value(20,value);}
237  const char *try_string() const {return message(24);}
245  void try_string(const char *value) {message(24, value);}
252  void try_string(const std::string &value) {message(24, value);}
259  const char *window() const {return string(28);}
266  void window(const char *value) {string(28, value);}
273  void window(const std::string &value) {string(28, value);}
274 
275 };
276 
277 }
278 }
279 
280 #endif // TBX_RES_RESFONTDBOX_H
281 
282 
tbx::res::ResFontDbox::try_string
void try_string(const std::string &value)
Set the string that is used to display an example of the currently selected font.
Definition: resfontdbox.h:252
tbx::res::ResFontDbox::operator=
ResFontDbox & operator=(const ResObject &other)
Assign from a ResObject.
Definition: resfontdbox.h:70
tbx::res::ResBase::message_with_length
void message_with_length(int offset, const char *value, int length=-1)
Assign a message where the length is at offset+4.
Definition: resbase.cc:1639
tbx::res::ResBase::operator=
ResBase & operator=(const ResBase &other)
Assignment.
Definition: resbase.cc:1534
tbx::res::ResFontDbox::operator=
ResFontDbox & operator=(const ResFontDbox &other)
Assign from another font dialogue resource.
Definition: resfontdbox.h:82
tbx
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
tbx::res::ResObject
Base class for a resource object that can be edited.
Definition: resobject.h:53
tbx::res::ResFontDbox::initial_height
void initial_height(int value)
Set the initial height in the dialogue.
Definition: resfontdbox.h:218
tbx::res::ResFontDbox::generate_dialogue_completed
void generate_dialogue_completed(bool value)
Set if the dialogue completed event should be generated.
Definition: resfontdbox.h:148
tbx::res::ResFontDbox::generate_about_to_be_shown
void generate_about_to_be_shown(bool value)
Set if the about to be shown event should be generated.
Definition: resfontdbox.h:136
tbx::res::ResFontDbox::title
const char * title() const
Get the title of the dialogue.
Definition: resfontdbox.h:167
tbx::res::ResBase::int_value
int int_value(int offset) const
Get an integer value.
Definition: resbase.h:316
tbx::res::ResFontDbox::generate_about_to_be_shown
bool generate_about_to_be_shown() const
Check if the about to be shown event should be generated.
Definition: resfontdbox.h:130
tbx::res::ResFontDbox::ResFontDbox
ResFontDbox(const ResObject &other)
Construct a font dialogue resource from a ResObject.
Definition: resfontdbox.h:48
tbx::res::ResFontDbox::title
void title(const char *value, int max_length=-1)
Set the title of the dialogue.
Definition: resfontdbox.h:175
tbx::res::ResFontDbox::initial_font
void initial_font(const std::string &value)
Set the name of the selected font.
Definition: resfontdbox.h:206
tbx::res::ResFontDbox::try_string
void try_string(const char *value)
Set the string that is used to display an example of the currently selected font.
Definition: resfontdbox.h:245
tbx::res::ResFontDbox::initial_height
int initial_height() const
Get the initial height in the dialogue.
Definition: resfontdbox.h:212
tbx::res::ResFontDbox::initial_aspect
int initial_aspect() const
Get the aspect ratio of the font.
Definition: resfontdbox.h:224
tbx::res::ResFontDbox::window
void window(const std::string &value)
Set the name of the window template that provides the window for this object.
Definition: resfontdbox.h:273
tbx::res::ResFontDbox::try_string
const char * try_string() const
Get the string that is used to display an example of the currently selected font.
Definition: resfontdbox.h:237
tbx::res::ResBase::init_message
void init_message(int offset, const char *value)
Initialise a message in a constructor helper.
Definition: resbase.cc:1736
tbx::res::ResObject::check_class_id
void check_class_id(int class_id) const
Check if this objects class id is as specified.
Definition: resobject.cc:383
tbx::res::ResFontDbox::ResFontDbox
ResFontDbox(const ResFontDbox &other)
Construct a font dialogue resource by copying another.
Definition: resfontdbox.h:58
tbx::res::ResBase::flag
bool flag(int offset, int mask) const
Check if any of the bits in a mask are set.
Definition: resbase.h:352
tbx::res::ResFontDbox::generate_dialogue_completed
bool generate_dialogue_completed() const
Check if the dialogue completed event should be generated.
Definition: resfontdbox.h:142
tbx::res::ResFontDbox::max_title
int max_title() const
Get the maximum size the title can be.
Definition: resfontdbox.h:187
tbx::res::ResFontDbox::flags
void flags(int value)
Set all the flags.
Definition: resfontdbox.h:124
tbx::res::ResObject::name
const char * name() const
Return pointer to name of object.
Definition: resobject.h:79
tbx::res::ResFontDbox::initial_font
void initial_font(const char *value)
Set the name of the selected font.
Definition: resfontdbox.h:200
tbx::res::ResFontDbox::title
void title(const std::string &value, int max_length=-1)
Set the title of the dialogue.
Definition: resfontdbox.h:183
tbx::res::ResFontDbox::ResFontDbox
ResFontDbox(std::string name)
Construct a font dialogue resource.
Definition: resfontdbox.h:95
tbx::res::ResFontDbox::include_system_font
bool include_system_font() const
Check if the system font should be included in the dialogue.
Definition: resfontdbox.h:154
tbx::res::ResBase::string
const char * string(int offset) const
Return a string at the given offset.
Definition: resbase.cc:1555
tbx::res::ResBase::init_string
void init_string(int offset, const char *value)
Initialise a string in a constructor helper.
Definition: resbase.cc:1725
tbx::res::ResFontDbox::window
void window(const char *value)
Set the name of the window template that provides the window for this object.
Definition: resfontdbox.h:266
tbx::res::ResFontDbox::initial_aspect
void initial_aspect(int value)
Set the aspect ratio of the font.
Definition: resfontdbox.h:230
tbx::res::ResFontDbox
Class for FontDbox object template.
Definition: resfontdbox.h:37
tbx::res::ResFontDbox::window
const char * window() const
Get the name of the window template that provides the window for this object.
Definition: resfontdbox.h:259
tbx::res::ResBase::message
const char * message(int offset) const
Get the message string at the given offset.
Definition: resbase.cc:1602
tbx::res::ResFontDbox::include_system_font
void include_system_font(bool value)
Set if the system font should be included in the dialogue.
Definition: resfontdbox.h:160
tbx::res::ResFontDbox::flags
int flags() const
Raw access to all the object flags.
Definition: resfontdbox.h:115
tbx::res::ResFontDbox::initial_font
const char * initial_font() const
Get the name of the selected font.
Definition: resfontdbox.h:194