tbx  0.7.3
rescolourdbox.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_RESCOLOURDBOX_H
26 #define TBX_RES_RESCOLOURDBOX_H
27 
28 #include "resobject.h"
29 
30 namespace tbx {
31 namespace res {
32 
36 class ResColourDbox : public ResObject
37 {
38 
39 public:
40  enum {CLASS_ID = 0x829C0 };
41 
48  ResColourDbox(const ResObject &other) : ResObject(other)
49  {
50  check_class_id(CLASS_ID);
51  }
52 
58  ResColourDbox(const ResColourDbox &other) : ResObject(other)
59  {
60  }
61 
62  virtual ~ResColourDbox() {}
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  ResColourDbox(std::string name)
96  : ResObject(name, CLASS_ID, 100, 36+16)
97  {
98  init_message(4,0); // title
99  }
100 
101 
110  int flags() const {return int_value(0);}
119  void flags(int value) {int_value(0,value);}
125  bool generate_about_to_be_shown() const {return flag(0, 1<<0);}
131  void generate_about_to_be_shown(bool value) {flag(0,1<<0,value);}
137  bool generate_dialogue_completed() const {return flag(0, 1<<1);}
143  void generate_dialogue_completed(bool value) {flag(0,1<<1,value);}
149  bool include_none() const {return flag(0, 1<<2);}
155  void include_none(bool value) {flag(0,1<<2,value);}
156 
162  bool select_none() const {return flag(0, 1<<3);}
168  void select_none(bool value) {flag(0,1<<3,value);}
169 
175  const char *title() const {return message(4);}
183  void title(const char *value, int max_length = -1) {message_with_length(4, value, max_length);}
191  void title(const std::string &value, int max_length = -1) {message_with_length(4, value, max_length);}
195  int max_title() const {return int_value(8);}
196 
202  int colour() const {return int_value(12);}
208  void colour(int value) {int_value(12,value);}
209 
210 };
211 
212 }
213 }
214 
215 #endif // TBX_RES_RESCOLOURDBOX_H
216 
int max_title() const
Get the maximum size the title can be.
Definition: rescolourdbox.h:195
ResColourDbox(const ResObject &other)
Construct a colour dialogue resource from a ResObject.
Definition: rescolourdbox.h:48
void generate_about_to_be_shown(bool value)
Set if the about to be shown event should be generated.
Definition: rescolourdbox.h:131
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
bool include_none() const
Check if an option to select no colour should be included.
Definition: rescolourdbox.h:149
ResColourDbox(const ResColourDbox &other)
Construct a colour dialogue resource by copying another.
Definition: rescolourdbox.h:58
ResColourDbox & operator=(const ResObject &other)
Assign from a ResObject.
Definition: rescolourdbox.h:70
bool flag(int offset, int mask) const
Check if any of the bits in a mask are set.
Definition: resbase.h:352
void generate_dialogue_completed(bool value)
Set if the dialogue completed event should be generated.
Definition: rescolourdbox.h:143
ResColourDbox(std::string name)
Construct a colour dialogue resource.
Definition: rescolourdbox.h:95
const char * message(int offset) const
Get the message string at the given offset.
Definition: resbase.cc:1602
void include_none(bool value)
Set if an option to select no colour should be included.
Definition: rescolourdbox.h:155
void flags(int value)
Set all the flags.
Definition: rescolourdbox.h:119
int flags() const
Raw access to all the object flags.
Definition: rescolourdbox.h:110
void colour(int value)
Set the initial selected colour.
Definition: rescolourdbox.h:208
bool select_none() const
Check if no colour option is selected.
Definition: rescolourdbox.h:162
void title(const std::string &value, int max_length=-1)
Set the title of the dialogue.
Definition: rescolourdbox.h:191
bool generate_about_to_be_shown() const
Check if the about to be shown event should be generated.
Definition: rescolourdbox.h:125
ResBase & operator=(const ResBase &other)
Assignment.
Definition: resbase.cc:1534
Base class for a resource object that can be edited.
Definition: resobject.h:52
ResColourDbox & operator=(const ResColourDbox &other)
Assign from another colour dialogue resource.
Definition: rescolourdbox.h:82
void select_none(bool value)
Set if no colour option is selected.
Definition: rescolourdbox.h:168
int colour() const
Get the initial selected colour.
Definition: rescolourdbox.h:202
void title(const char *value, int max_length=-1)
Set the title of the dialogue.
Definition: rescolourdbox.h:183
Class for ColourDbox object template.
Definition: rescolourdbox.h:36
int int_value(int offset) const
Get an integer value.
Definition: resbase.h:316
const char * title() const
Get the title of the dialogue.
Definition: rescolourdbox.h:175
const char * name() const
Return pointer to name of object.
Definition: resobject.h:79
bool generate_dialogue_completed() const
Check if the dialogue completed event should be generated.
Definition: rescolourdbox.h:137
void check_class_id(int class_id) const
Check if this objects class id is as specified.
Definition: resobject.cc:383
void init_message(int offset, const char *value)
Initialise a message in a constructor helper.
Definition: resbase.cc:1736