tbx  0.7.5
iconbar.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_ICONBAR_H_
26 #define TBX_ICONBAR_H_
27 
28 #include "object.h"
29 #include "menu.h"
30 
31 namespace tbx
32 {
33  class Loader;
34  class IconbarClickListener;
35 
36  namespace res
37  {
38  class ResIconbar;
39  }
40 
44  class Iconbar : public Object
45  {
46  public:
47  enum {TOOLBOX_CLASS = 0x82900};
48 
55  Iconbar() {};
56 
62  Iconbar(const Iconbar &other) : Object(other._handle) {}
63 
70  Iconbar(const Object &other) : Object(other) {check_toolbox_class(Iconbar::TOOLBOX_CLASS);}
71 
77  Iconbar(const char *template_name) : Object(template_name) {check_toolbox_class(Iconbar::TOOLBOX_CLASS);}
78 
84  Iconbar(const res::ResIconbar &object_template);
85 
91  Iconbar &operator=(const Iconbar &other) {_handle = other.handle(); return *this;}
92 
99  Iconbar &operator=(const Object &other) {_handle = other.handle(); check_toolbox_class(TOOLBOX_CLASS); return *this;}
100 
106  bool operator==(const Object &other) const {return (_handle == other.handle());}
107 
113  bool operator!=(const Object &other) const {return (_handle != other.handle());}
114 
115 
116 // Properties
117  int icon_handle() const;
118  void menu(Menu m);
119  Menu menu() const;
120  void help_message(const std::string &value);
121  std::string help_message() const;
122  int help_message_length() const;
123  void text(std::string value);
124  std::string text() const;
125  int text_length() const;
126  void sprite(const std::string &value);
127  std::string sprite() const;
128  int sprite_length() const;
129  void select_show(Object show_object);
130  Object select_show();
131  void adjust_show(Object show_object);
132  Object adjust_show();
133 
134 //TODO: void show(...) - priority show
135 
136 // Listeners
137  void add_click_listener(IconbarClickListener *listener);
138  void remove_click_listener(IconbarClickListener *listener);
139  void add_click_command(Command *command);
140  void remove_click_command(Command *command);
141  void add_select_command(Command *command);
142  void remove_select_command(Command *command);
143  void add_adjust_command(Command *command);
144  void remove_adjust_command(Command *command);
145  void add_loader(Loader *loader, int file_type = -2);
146  void remove_loader(Loader *loader, int file_type = -2);
147  };
148 };
149 
150 #endif
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:34
Class representing a toolbox menu.
Definition: menu.h:49
Listener for button selected events.
Definition: iconbarclicklistener.h:59
Class for Iconbar in memory template.
Definition: resiconbar.h:38
bool operator!=(const Object &other) const
Checks if this Iconbar refers to the same underlying toolbox object as the given object.
Definition: iconbar.h:113
Base class for commands in tbx.
Definition: command.h:36
Classes to use/edit toolbox resources in memory.
Iconbar(const Object &other)
Construct a Iconbar from another toolbox object.
Definition: iconbar.h:70
Iconbar()
Construct an uninitiased Iconbar.
Definition: iconbar.h:55
bool operator==(const Object &other) const
Checks if this Iconbar refers to the same underlying toolbox object as the given object.
Definition: iconbar.h:106
Class to handle file/data loading from the filer or an external application.
Definition: loader.h:179
Iconbar(const char *template_name)
Construct a iconbar creating a toolbox iconbar object.
Definition: iconbar.h:77
Class to represent toolbox iconbar icon.
Definition: iconbar.h:44
Iconbar & operator=(const Object &other)
Assign a Iconbar to an existing object.
Definition: iconbar.h:99
Iconbar(const Iconbar &other)
Construct a Iconbar from another Iconbar.
Definition: iconbar.h:62
Class to manipulate a toolbox object.
Definition: object.h:50
Iconbar & operator=(const Iconbar &other)
Assign a Iconbar to an existing Iconbar.
Definition: iconbar.h:91
ObjectId handle() const
Return the underlying toolbox object id this object references.
Definition: object.h:93