tbx  0.7.6
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 
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
210 };
211 
212 
213 }
214 
215 #endif /* TBX_PROGINFO_H_ */
tbx::ProgInfo::operator==
bool operator==(const Object &other) const
Check if this ProgInfo refers to the same underlying toolbox object as another.
Definition: proginfo.h:131
tbx::ProgInfo::LicenceType
LicenceType
Enumeration of license types.
Definition: proginfo.h:171
tbx::Object::int_property
int int_property(int property_id) const
Return the value of a property that returns an integer.
Definition: object.cc:477
tbx
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
tbx::ProgInfo::version
std::string version() const
Return version string.
Definition: proginfo.h:159
tbx::Object::handle
ObjectId handle() const
Return the underlying toolbox object id this object references.
Definition: object.h:93
tbx::ProgInfo::add_about_to_be_shown_listener
void add_about_to_be_shown_listener(AboutToBeShownListener *listener)
This event is raised just before the ProgInfo underlying window is about to be shown.
Definition: proginfo.cc:45
tbx::ProgInfo::title_length
int title_length() const
Return the title length.
Definition: proginfo.h:203
tbx::Object::_handle
ObjectId _handle
Handle for toolbox object.
Definition: object.h:175
tbx::Object::string_property
std::string string_property(int property_id) const
Return the value of a property that returns text.
Definition: object.cc:519
tbx::ProgInfo::title
std::string title() const
Return the title.
Definition: proginfo.h:198
tbx::Window
The Window object represents a toolbox window.
Definition: window.h:70
tbx::ProgInfo::operator!=
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
tbx::ProgInfo::window
Window window() const
Return the underlying toolbox window used to implement the ProgInfo object.
Definition: proginfo.h:146
tbx::HasBeenHiddenListener
Listener for an object has been hidden event.
Definition: hasbeenhiddenlistener.h:36
tbx::ProgInfo::ProgInfo
ProgInfo(const ProgInfo &other)
Construct a ProgInfo from another ProgInfo.
Definition: proginfo.h:75
tbx::ProgInfo::remove_has_been_hidden_listener
void remove_has_been_hidden_listener(HasBeenHiddenListener *listener)
Remove has been hidden listener.
Definition: proginfo.cc:69
tbx::ProgInfo::operator=
ProgInfo & operator=(const ProgInfo &other)
Assign this ProgInfo from another.
Definition: proginfo.h:111
tbx::Object::string_property_length
int string_property_length(int property_id) const
Gets the size of a string properties buffer.
Definition: object.cc:572
tbx::ProgInfo::licence_type
LicenceType licence_type() const
Get the licence type.
Definition: proginfo.h:188
tbx::ProgInfo
Class to show a toolbox ProgInfo object.
Definition: proginfo.h:57
tbx::Object::check_toolbox_class
void check_toolbox_class(int class_id) const
Check if this objects toolbox class is as specified.
Definition: object.cc:122
tbx::ProgInfo::ProgInfo
ProgInfo(const std::string &template_name)
Create a ProgInfo from the named template.
Definition: proginfo.h:94
tbx::AboutToBeShownListener
Listener for about to be shown event.
Definition: abouttobeshownlistener.h:77
tbx::ProgInfo::ProgInfo
ProgInfo()
Construct creates an unassigned ProgInfo.
Definition: proginfo.h:66
tbx::Object
Class to manipulate a toolbox object.
Definition: object.h:51
tbx::ProgInfo::remove_about_to_be_shown_listener
void remove_about_to_be_shown_listener(AboutToBeShownListener *listener)
Remove about to be shown listener.
Definition: proginfo.cc:53
tbx::ShowFullObject
Objects derived from this class can be shown with there full location and size specified as well as t...
Definition: showfullobject.h:41
tbx::ObjectId
unsigned int ObjectId
Type for underlying toolbox object id.
Definition: handles.h:31
tbx::ProgInfo::add_has_been_hidden_listener
void add_has_been_hidden_listener(HasBeenHiddenListener *listener)
This event is raised after the ProgInfo dialog has been completed.
Definition: proginfo.cc:61
tbx::ProgInfo::title
void title(std::string value)
Set the title.
Definition: proginfo.h:193
tbx::ProgInfo::ProgInfo
ProgInfo(const Object &other)
Construct a ProgInfo from an Object that refers to a ProgInfo.
Definition: proginfo.h:86
tbx::ProgInfo::version
void version(std::string value)
Set version.
Definition: proginfo.h:153
tbx::res::ResProgInfo
Class to represent a ProgInfo resource.
Definition: resproginfo.h:43
tbx::ProgInfo::licence_type
void licence_type(LicenceType type)
Set the licence type.
Definition: proginfo.h:183
tbx::ProgInfo::operator=
ProgInfo & operator=(const Object &other)
Assign this ProgInfo from an Object that refers to a ProgInfo.
Definition: proginfo.h:123
tbx::ProgInfo::version_length
int version_length() const
Return version string length.
Definition: proginfo.h:165