tbx  0.7.5
proginfo.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 /*
26  * proginfo.h
27  *
28  * Created on: 01-Jul-2010
29  * Author: alanb
30  */
31 
32 #ifndef TBX_PROGINFO_H_
33 #define TBX_PROGINFO_H_
34 
35 #include "showfullobject.h"
36 #include "listener.h"
37 #include "window.h"
38 
39 namespace tbx {
40 
41 // Listeners
42 class AboutToBeShownListener;
43 class HasBeenHiddenListener;
44 
45 namespace res
46 {
47  class ResProgInfo;
48 }
49 
50 
57 {
58 public:
59  enum { TOOLBOX_CLASS = 0x82b40 };
60 
66  ProgInfo() {};
75  ProgInfo(const ProgInfo &other) : ShowFullObject(other._handle) {}
86  ProgInfo(const Object &other) : ShowFullObject(other) {check_toolbox_class(ProgInfo::TOOLBOX_CLASS);}
94  ProgInfo(const std::string &template_name) : ShowFullObject(template_name) {check_toolbox_class(ProgInfo::TOOLBOX_CLASS);}
101  ProgInfo(const res::ResProgInfo &object_template);
102 
111  ProgInfo &operator=(const ProgInfo &other) {_handle = other.handle(); return *this;}
123  ProgInfo &operator=(const Object &other) {_handle = other.handle(); check_toolbox_class(TOOLBOX_CLASS); return *this;}
131  bool operator==(const Object &other) const {return (_handle == other.handle());}
139  bool operator!=(const Object &other) const {return (_handle != other.handle());}
140 
141 
142  // Properties
146  Window window() const {return Window((ObjectId)int_property(0));}
147 
153  void version(std::string value) {string_property(1, value);}
154 
159  std::string version() const {return string_property(2);}
160 
165  int version_length() const {return string_property_length(2);}
166 
171  {
172  PUBLIC_DOMAIN,
173  SINGLE_USER,
174  SINGLE_MACHINE,
175  SITE,
176  NETWORK,
177  AUTHORIY
178  };
179 
183  void licence_type(LicenceType type) {int_property(3, type);}
184 
188  LicenceType licence_type() const {return (LicenceType)int_property(4);}
189 
193  void title(std::string value) {string_property(5, value);}
194 
198  std::string title() const {return string_property(6);}
199 
203  int title_length() const {return string_property_length(6);}
204 
205  // Listeners
206  void add_about_to_be_shown_listener(AboutToBeShownListener *listener);
207  void remove_about_to_be_shown_listener(AboutToBeShownListener *listener);
208  void add_has_been_hidden_listener(HasBeenHiddenListener *listener);
209  void remove_has_been_hidden_listener(HasBeenHiddenListener *listener);
210 };
211 
212 
213 }
214 
215 #endif /* TBX_PROGINFO_H_ */
void title(std::string value)
Set the title.
Definition: proginfo.h:193
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:34
std::string title() const
Return the title.
Definition: proginfo.h:198
LicenceType licence_type() const
Get the licence type.
Definition: proginfo.h:188
ProgInfo & operator=(const Object &other)
Assign this ProgInfo from an Object that refers to a ProgInfo.
Definition: proginfo.h:123
bool operator!=(const Object &other) const
Check if this ProgInfo does not refers to the same underlying toolbox object as another.
Definition: proginfo.h:139
Listener for about to be shown event.
Definition: abouttobeshownlistener.h:76
Window window() const
Return the underlying toolbox window used to implement the ProgInfo object.
Definition: proginfo.h:146
std::string version() const
Return version string.
Definition: proginfo.h:159
Class to show a toolbox ProgInfo object.
Definition: proginfo.h:56
ProgInfo(const Object &other)
Construct a ProgInfo from an Object that refers to a ProgInfo.
Definition: proginfo.h:86
Classes to use/edit toolbox resources in memory.
bool operator==(const Object &other) const
Check if this ProgInfo refers to the same underlying toolbox object as another.
Definition: proginfo.h:131
ProgInfo & operator=(const ProgInfo &other)
Assign this ProgInfo from another.
Definition: proginfo.h:111
void licence_type(LicenceType type)
Set the licence type.
Definition: proginfo.h:183
unsigned int ObjectId
Type for underlying toolbox object id.
Definition: handles.h:31
void version(std::string value)
Set version.
Definition: proginfo.h:153
The Window object represents a toolbox window.
Definition: window.h:69
LicenceType
Enumeration of license types.
Definition: proginfo.h:170
ProgInfo()
Construct creates an unassigned ProgInfo.
Definition: proginfo.h:66
ProgInfo(const ProgInfo &other)
Construct a ProgInfo from another ProgInfo.
Definition: proginfo.h:75
int title_length() const
Return the title length.
Definition: proginfo.h:203
Listener for an object has been hidden event.
Definition: hasbeenhiddenlistener.h:36
Objects derived from this class can be shown with there full location and size specified as well as t...
Definition: showfullobject.h:40
Class to manipulate a toolbox object.
Definition: object.h:50
Class to represent a ProgInfo resource.
Definition: resproginfo.h:42
ProgInfo(const std::string &template_name)
Create a ProgInfo from the named template.
Definition: proginfo.h:94
ObjectId handle() const
Return the underlying toolbox object id this object references.
Definition: object.h:93
int version_length() const
Return version string length.
Definition: proginfo.h:165