tbx  0.7.5
reswindow.h
1 /*
2  * tbx RISC OS toolbox library
3  *
4  * Copyright (C) 2010-2012 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 #ifndef TBX_RES_Window_H
25 #define TBX_RES_Window_H
26 
27 #include "resobject.h"
28 #include "resgadget.h"
29 #include "resshortcut.h"
30 #include "resiteratorbase.h"
31 #include "../handles.h"
32 #include "../colour.h"
33 
34 namespace tbx
35 {
36 typedef int *OsSpriteAreaPtr;
37 
38 namespace res
39 {
43 const ComponentId FOCUS_TO_WINDOW = (ComponentId)-2;
44 
48 class ResWindow : public ResObject
49 {
50  public:
51  enum { CLASS_ID = 0x82880 };
52 
58  ResWindow(std::string name, bool toolbar = false) :
59  ResObject(name, CLASS_ID, 102, 36 + 164)
60  {
61  if (toolbar) flags(16); // is a toolbar flag
62  else flags(6); // Default to auto-show/auto-close
63  init_message(4, 0); // Help message
64  init_string(12, 0); // Pointer shape
65  init_string(28, 0); // Menu
66  default_focus(-1);
67  show_event(-1);
68  hide_event(-1);
69  init_string(60, 0); // internal_bl
70  init_string(64, 0); // internal_tl
71  init_string(68, 0); // external_bl
72  init_string(72, 0); // external_tl
73  if (toolbar)
74  {
75  visible_xmin(154);
76  visible_ymin(828);
77  visible_xmax(554);
78  visible_ymax(1228);
79  } else
80  {
81  visible_xmin(32);
82  visible_ymin(840);
83  visible_xmax(724);
84  visible_ymax(1264);
85  }
86  behind(-1);
87  if (toolbar) window_flags(0x80000032);
88  else window_flags(0xff000012); // Window flags - TODO: lookup what bits mean
89  int_value(108, 0x1070207); // Colours - title and work fore and back
90  int_value(112, 0xc0103); // scroll bar for and bakcand title focus
91  if (toolbar)
92  {
93  work_ymin(-1000);
94  work_xmax(1000);
95  } else
96  {
97  work_ymin(-1024);
98  work_xmax(1280);
99  }
100  title_flags(0x119); // TODO: Look up what these mean
101  int_value(144, 0x640064); // Min width and height 100x100
102  init_string(152, 0); // title_validation
103  init_sprite_area_ref(140); // window sprite area
104  if (toolbar)
105  {
106  init_message(148, 0); // title_text
107  title_buflen(0); // Title buffer length
108  } else
109  {
110  init_message(148, "Window object"); // title_text
111  title_buflen(14); // Title buffer length
112  }
113  init_object_ref(36); // keyboard short cuts pointer
114  init_object_ref(44); // Gadget pointer
115  }
116 
122  ResWindow(const ResWindow &other) : ResObject(other) {}
123 
129  ResWindow(const ResObject &other) : ResObject(other) {check_class_id(CLASS_ID);}
130 
137  {
138  ResObject::operator=(other);
139  return *this;
140  }
141 
148  {
149  other.check_class_id(CLASS_ID);
150  ResObject::operator =(other);
151  return *this;
152  }
153 
161  unsigned int flags() const {return uint_value(0);}
162 
169  void flags(unsigned int value) {uint_value(0, value);}
170 
176  bool generate_about_to_be_shown() const {return flag(0,1);}
182  void generate_about_to_be_shown(bool value) {flag(0,1, value);}
183 
192  bool auto_show() const {return flag(0,2);}
201  void auto_show(bool value) {flag(0,2, value);}
202 
211  bool auto_close() const {return flag(0,4);}
220  void auto_close(bool value) {flag(0,4, value);}
221 
227  bool generate_has_been_hidden() const {return flag(0,8);}
233  void generate_has_been_hidden(bool value) {flag(0,8, value);}
234 
240  bool toolbar() const {return flag(0,16);}
246  void toolbar(bool value) {flag(0,16, value);}
247 
253  const char *help_message() const {return message(4);}
254 
262  void help_message(const char *value, int max_length = -1) {message_with_length(4, value, max_length);}
270  void help_message(const std::string &value, int max_length = -1) {message_with_length(4, value, max_length);}
271 
275  int max_help_message() const {return int_value(8);}
276 
283  const char *pointer_shape() const {return string(12);}
292  void pointer_shape(const char *value, int max_length = -1) {string_with_length(12, value, max_length);}
301  void pointer_shape(const std::string &value, int max_length = -1) {string_with_length(12, value, max_length);}
302 
306  int max_pointer_shape() const {return int_value(16);}
312  int pointer_x_hot() const {return int_value(20);}
318  void pointer_x_hot(int value) {int_value(20, value);}
324  int pointer_y_hot() const {return int_value(24);}
330  void pointer_y_hot(int value) {int_value(24, value);}
331 
337  const char *menu() const {return string(28);}
343  void menu(const char *value) {string(28, value);}
349  void menu(const std::string &value) {string(28, value);}
355  int num_shortcuts() const {return int_value(32);}
361  int num_gadgets() const {return int_value(40);}
362 
369  ComponentId default_focus() const {return int_value(48);}
376  void default_focus(ComponentId id) {int_value(48, id);}
377 
385  int show_event() const {return int_value(52);}
393  void show_event(int event_id) {int_value(52, event_id);}
394 
402  int hide_event() const {return int_value(56);}
410  void hide_event(int value) {int_value(56, value);}
411 
417  const char *internal_bl_toolbar() const {return string(60);}
423  void internal_bl_toolbar(const char *value) {string(60, value);}
429  void internal_bl_toolbar(const std::string &value) {string(60, value);}
435  const char *internal_tl_toolbar() const {return string(64);}
441  void internal_tl_toolbar(const char *value) {string(64, value);}
447  void internal_tl_toolbar(const std::string &value) {string(64, value);}
448 
454  const char *external_bl_toolbar() const {return string(68);}
460  void external_bl_toolbar(const char *value) {string(68, value);}
466  void external_bl_toolbar(const std::string &value) {string(68, value);}
467 
473  const char *external_tl_toolbar() const {return string(72);}
479  void external_tl_toolbar(const char *value) {string(72, value);}
485  void external_tl_toolbar(const std::string &value) {string(72, value);}
486 
487 // window 88 WimpWindow
493  int visible_xmin() const {return int_value(76);}
499  void visible_xmin(int value) {int_value(76, value);}
505  int visible_ymin() const {return int_value(80);}
511  void visible_ymin(int value) {int_value(80, value);}
517  int visible_xmax() const {return int_value(84);}
523  void visible_xmax(int value) {int_value(84, value);}
529  int visible_ymax() const {return int_value(88);}
535  void visible_ymax(int value) {int_value(88, value);}
541  int scroll_x() const {return int_value(92);}
547  void scroll_x(int value) {int_value(92, value);}
553  int scroll_y() const {return int_value(96);}
559  void scroll_y(int value) {int_value(96, value);}
565  int behind() const {return int_value(100);}
571  void behind(int value) {int_value(100, value);}
580  unsigned int window_flags() const {return uint_value(104);}
589  void window_flags(unsigned int value) {uint_value(104, value);}
590 
596  bool moveable() const {return flag(104,2);}
602  void moveable(bool move) {flag(104,2,move);}
610  bool auto_redraw() const {return flag(104,16);}
618  void auto_redraw(bool on) {flag(104,16,on);}
624  bool pane() const {return flag(104,32);}
630  void pane(bool p) {flag(104,32,p);}
636  bool allow_off_screen() const {return flag(104,64);}
642  void allow_off_screen(bool allow) {flag(104,64, allow);}
650  bool user_scroll() const {return flag(104,256);}
658  void user_scroll(bool scroll) {flag(104,256,scroll);}
666  bool user_scroll_debounced() const {return flag(104,512);}
674  void user_scroll_debounced(bool scroll) {flag(104,512,scroll);}
680  bool real_colours() const {return flag(104,1024);}
686  void real_colours(bool real) {flag(104,1024, real);}
692  bool top_window() const {return flag(104,2048);}
698  void top_window(bool tw) {flag(104,2048,tw);}
704  bool hot_keys() const {return flag(104,4096);}
710  void hot_keys(bool generate) {flag(104,4096,generate);}
716  bool force_on_screen() const {return flag(104,8192);}
722  void force_on_screen(bool on) {flag(104,8192,on);}
728  bool ignore_right_extent() const {return flag(104,16384);}
734  void ignore_right_extent(bool ignore) {flag(104,16384,ignore);}
740  bool ignore_lower_extent() const {return flag(104,32768);}
746  void ignore_lower_extent(bool ignore) {flag(104,32768,ignore);}
752  bool back_icon() const {return flag(104,(1<<24));}
758  void back_icon(bool has_icon) {flag(104,(1<<24), has_icon);}
764  bool close_icon() const {return flag(104,(1<<25));}
770  void close_icon(bool has_icon) {flag(104,(1<<25), has_icon);}
776  bool titlebar() const {return flag(104,(1<<26));}
782  void titlebar(bool has_tb) {flag(104,(1<<26), has_tb);}
788  bool toggle_size_icon() const {return flag(104,(1<<27));}
794  void toggle_size_icon(bool has_icon) {flag(104,(1<<27), has_icon);}
800  bool vscrollbar() const {return flag(104,(1<<28));}
806  void vscrollbar(bool has_vsb) {flag(104,(1<<28), has_vsb);}
812  bool adjust_size_icon() const {return flag(104,(1<<29));}
818  void adjust_size_icon(bool has_icon) {flag(104,(1<<29), has_icon);}
824  bool hscrollbar() const {return flag(104,(1<<30));}
830  void hscrollbar(bool has_hsb) {flag(104,(1<<30), has_hsb);}
831 
837  WimpColour title_fore() const {return byte_value(108);}
843  void title_fore(WimpColour value) {byte_value(108, value);}
849  WimpColour title_back() const {return byte_value(109);}
855  void title_back(WimpColour value) {byte_value(109, value);}
861  WimpColour work_fore() const {return byte_value(110);}
867  void work_fore(WimpColour value) {byte_value(110, value);}
873  WimpColour work_back() const {return byte_value(111);}
879  void work_back(WimpColour value) {byte_value(111, value);}
885  WimpColour scroll_outer() const {return byte_value(112);}
891  void scroll_outer(WimpColour value) {byte_value(112, value);}
897  WimpColour scroll_inner() const {return byte_value(113);}
903  void scroll_inner(WimpColour value) {byte_value(113, value);}
910  WimpColour title_inputfocus() const {return byte_value(114);}
917  void title_inputfocus(WimpColour value) {byte_value(114, value);}
918  // Note: 115 is a filler byte and must be 0
924  int work_xmin() const {return int_value(116);}
930  void work_xmin(int value) {int_value(116, value);}
936  int work_ymin() const {return int_value(120);}
942  void work_ymin(int value) {int_value(120, value);}
948  int work_xmax() const {return int_value(124);}
954  void work_xmax(int value) {int_value(124, value);}
960  int work_ymax() const {return int_value(128);}
966  void work_ymax(int value) {int_value(128, value);}
972  unsigned int title_flags() const {return uint_value(132);}
978  void title_flags(unsigned int value) {uint_value(132, value);}
979  //TODO: setters/getters for bits of title flags
985  unsigned int button_type() const {return uint_value(136);}
991  void button_type(unsigned int value) {uint_value(136, value);}
992  //TODO: enum for button_type
999  OsSpriteAreaPtr sprite_area() const {return (OsSpriteAreaPtr)uint_value(140);}
1006  void sprite_area(OsSpriteAreaPtr value) {uint_value(140, (unsigned int)value);}
1012  unsigned short min_width() const {return ushort_value(144);}
1018  void min_width(unsigned short value) {ushort_value(144, value);}
1024  unsigned short min_height() const {return ushort_value(146);}
1030  void min_height(unsigned short value) {ushort_value(146, value);}
1031 
1037  const char *title_text() const {return message(148);}
1043  void title_text(const char *value) {message(148, value);}
1049  void title_text(const std::string &value) {message(148, value);}
1055  const char *title_validation() const {return string(152);}
1061  void title_validation(const char *value) {string(152, value);}
1067  void title_validation(const std::string &value) {string(152, value);}
1073  int title_buflen() const {return int_value(156);}
1079  void title_buflen(int value) {int_value(156, value);}
1080 
1081  // num_icons at 160 (must be zero)
1082 
1086  class const_shortcut_iterator : public ResIteratorBase<ResWindow>
1087  {
1088  const_shortcut_iterator(const ResWindow *window, int offset) : ResIteratorBase<ResWindow>(window, offset) {}
1089  friend class ResWindow;
1090  public:
1096  const_shortcut_iterator &operator++() {_offset += SHORTCUT_SIZE; return *this;}
1102  const_shortcut_iterator operator++(int) {const_shortcut_iterator tmp(*this); _offset += SHORTCUT_SIZE; return tmp;}
1108  ResShortcut operator*() const {return _object->shortcut_at_offset(_offset);}
1109  };
1110  friend class const_shortcut_iterator;
1111 
1136 
1137  const_shortcut_iterator find_shortcut(int key_code) const;
1138 
1142  class shortcut_iterator : public ResIteratorBase<ResWindow>
1143  {
1144  shortcut_iterator(const ResWindow *window, int offset) : ResIteratorBase<ResWindow>(window, offset) {}
1145  friend class ResWindow;
1146  public:
1152  shortcut_iterator &operator++() {_offset += SHORTCUT_SIZE; return *this;}
1158  shortcut_iterator operator++(int) {shortcut_iterator tmp(*this); _offset += SHORTCUT_SIZE; return tmp;}
1164  ResShortcut operator*() const {return _object->shortcut_at_offset(_offset);}
1165  };
1166  friend class shortcut_iterator;
1167 
1180  //TODO: Document use of SpecialKeys from KeyListener
1181  shortcut_iterator find_shortcut(int key_code);
1182 
1183  ResShortcut shortcut(int key_code) const;
1184  bool contains_shortcut(int key_code) const;
1185  void add_shortcut(const ResShortcut &shortcut);
1186  void replace_shortcut(const ResShortcut &shortcut);
1187  void erase_shortcut(int key_code);
1188 
1192 
1193 
1197  class const_gadget_iterator : public ResIteratorBase<ResWindow>
1198  {
1199  const_gadget_iterator(const ResWindow *window, int offset) : ResIteratorBase<ResWindow>(window, offset) {}
1200  friend class ResWindow;
1201  public:
1207  const_gadget_iterator &operator++() {_object->next_gadget(_offset); return *this;}
1213  const_gadget_iterator operator++(int) {const_gadget_iterator tmp(*this); _object->next_gadget(_offset); return tmp;}
1219  ResGadget operator*() const {return _object->gadget_at_offset(_offset);}
1220  };
1221  friend class const_gadget_iterator;
1222 
1247  const_gadget_iterator find_gadget(int component_id) const;
1248 
1252  class gadget_iterator : public ResIteratorBase<ResWindow>
1253  {
1254  gadget_iterator(const ResWindow *window, int offset) : ResIteratorBase<ResWindow>(window, offset) {}
1255  friend class ResWindow;
1256  public:
1262  gadget_iterator &operator++() {_object->next_gadget(_offset); return *this;}
1268  gadget_iterator operator++(int) {gadget_iterator tmp(*this); _object->next_gadget(_offset); return tmp;}
1274  ResGadget operator*() const {return _object->gadget_at_offset(_offset);}
1275  };
1276  friend class gadget_iterator;
1277 
1290  gadget_iterator find_gadget(int component_id);
1291 
1292  ResGadget gadget(ComponentId component_id) const;
1293  bool contains_gadget(ComponentId component_id) const;
1294  void add_gadget(const ResGadget &gadget);
1295  void replace_gadget(const ResGadget &gadget);
1296  void erase_gadget(ComponentId component_id);
1297 
1301 
1302  protected:
1308  char *gadget_start() const {return (char *)int_value(44);}
1309  int first_gadget_offset() const;
1310  int end_gadget_offset() const;
1311  ResGadget gadget_at_offset(int item_offset) const;
1312  void next_gadget(int &item_offset) const;
1313 
1319  char *shortcut_start() const {return (char *)int_value(36);}
1320  int first_shortcut_offset() const;
1321  int end_shortcut_offset() const;
1322  ResShortcut shortcut_at_offset(int item_offset) const;
1323 
1324 };
1325 
1326 }
1327 
1328 }
1329 #endif // TBX_RES_Window_H
void back_icon(bool has_icon)
Set if window has a back icon.
Definition: reswindow.h:758
int first_shortcut_offset() const
Get offset of first shortcut in window.
Definition: reswindow.cc:369
bool user_scroll_debounced() const
Check if a Scroll_Request event if returned with no auto-repeat on the arrow icons and no auto-repeat...
Definition: reswindow.h:666
void title_validation(const std::string &value)
Set the title validation.
Definition: reswindow.h:1067
const_gadget_iterator gadget_cbegin() const
Get constant iterator to first gadget.
Definition: reswindow.h:1240
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:34
void title_buflen(int value)
Set the length of the buffer to hold the title.
Definition: reswindow.h:1079
void user_scroll(bool scroll)
Set if a Scroll_Request event if returned with auto-repeat on the arrow icons and no auto-repeat on t...
Definition: reswindow.h:658
const char * title_validation() const
Get the title validation.
Definition: reswindow.h:1055
int * OsSpriteAreaPtr
Type for pointer to underlying RISC OS Sprite area.
Definition: sprite.h:214
Base class for Resource component iterators.
Definition: resiteratorbase.h:8
const ResWindow * _object
Reference to object being iterated.
Definition: resiteratorbase.h:11
void scroll_inner(WimpColour value)
Set the scroll bar inner colour.
Definition: reswindow.h:903
int num_shortcuts() const
Get the number of shortcut keys in this window.
Definition: reswindow.h:355
const_gadget_iterator gadget_end() const
Get constant iterator to the end of the gadgets.
Definition: reswindow.h:1234
void add_gadget(const ResGadget &gadget)
Adds the gadget to the end of the window.
Definition: reswindow.cc:222
void title_inputfocus(WimpColour value)
Set the background colour for the title bar when it has the input focus.
Definition: reswindow.h:917
void titlebar(bool has_tb)
Set if window has a title bar.
Definition: reswindow.h:782
void internal_bl_toolbar(const std::string &value)
Set the name of the object to use for the internal bottom left toolbar.
Definition: reswindow.h:429
int end_shortcut_offset() const
Get offset to end of shortcuts in window.
Definition: reswindow.cc:379
void flags(unsigned int value)
Set all flags as a word.
Definition: reswindow.h:169
void auto_show(bool value)
Set if window is automatically shown.
Definition: reswindow.h:201
void hscrollbar(bool has_hsb)
Set if window has a horizontal scroll bar.
Definition: reswindow.h:830
Base class for gadget memory resources.
Definition: resgadget.h:42
bool contains_shortcut(int key_code) const
Returns true if Window contains a shortcut with the given id.
Definition: reswindow.cc:440
shortcut_iterator shortcut_begin()
Get iterator to first shortcut.
Definition: reswindow.h:1173
int visible_ymin() const
Get the minimum Y coordinate of the visible part of the window.
Definition: reswindow.h:505
bool auto_show() const
Check if window is automatically shown.
Definition: reswindow.h:192
bool auto_close() const
Check if window is automatically closed.
Definition: reswindow.h:211
void init_string(int offset, const char *value)
Initialise a string in a constructor helper.
Definition: resbase.cc:1725
void init_object_ref(int offset)
Initialise an object reference.
Definition: resbase.cc:1756
unsigned short min_width() const
Get the minimum width for the window.
Definition: reswindow.h:1012
ResGadget gadget(ComponentId component_id) const
Get a copy of gadget with given component id.
Definition: reswindow.cc:198
void title_fore(WimpColour value)
Set the foreground/text colour for the title bar.
Definition: reswindow.h:843
void ignore_lower_extent(bool ignore)
Set if lower extent is ignored.
Definition: reswindow.h:746
int scroll_x() const
Get the X scroll offset into the work area.
Definition: reswindow.h:541
bool top_window() const
Check if window can be opened below this.
Definition: reswindow.h:692
void min_width(unsigned short value)
Set the minimum width for the window.
Definition: reswindow.h:1018
bool adjust_size_icon() const
Check if window has an adjust size icon.
Definition: reswindow.h:812
int visible_ymax() const
Get the maximum Y coordinate of the visible part of the window.
Definition: reswindow.h:529
ResWindow & operator=(const ResWindow &other)
Assignment.
Definition: reswindow.h:136
ResShortcut shortcut_at_offset(int item_offset) const
Get a copy of the shortcut at the given offset.
Definition: reswindow.cc:343
void visible_ymax(int value)
Set the maximum Y coordinate of the visible part of the window.
Definition: reswindow.h:535
bool close_icon() const
Check if window has a close icon.
Definition: reswindow.h:764
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 flag(int offset, int mask) const
Check if any of the bits in a mask are set.
Definition: resbase.h:352
Constant iterator for shortcuts.
Definition: reswindow.h:1086
int scroll_y() const
Get the Y scroll offset into the work area.
Definition: reswindow.h:553
void hot_keys(bool generate)
Set if generates events for hot keys.
Definition: reswindow.h:710
unsigned int flags() const
Get all flags as a word raw access.
Definition: reswindow.h:161
int num_gadgets() const
Get the number of gadgets in this window.
Definition: reswindow.h:361
int max_help_message() const
Get the maximum help message length.
Definition: reswindow.h:275
void toolbar(bool value)
Set if this template is for a toolbar.
Definition: reswindow.h:246
void hide_event(int value)
Set the event ID of the event generated when the window has been hidden.
Definition: reswindow.h:410
const_shortcut_iterator shortcut_cend() const
Get constant iterator to end of shortcuts.
Definition: reswindow.h:1135
bool ignore_right_extent() const
Check if right extent is ignored.
Definition: reswindow.h:728
bool toggle_size_icon() const
Check if window has a toggle size icon.
Definition: reswindow.h:788
int title_buflen() const
Get the length of the buffer to hold the title.
Definition: reswindow.h:1073
int work_ymax() const
Get the maximum Y coordinate of the work area extent.
Definition: reswindow.h:960
int behind() const
Get the WIMP window handle this window will be opened behind.
Definition: reswindow.h:565
int ComponentId
Type for underlying toolbox component id.
Definition: handles.h:33
void pointer_shape(const char *value, int max_length=-1)
Set the name of the sprite to use for the mouse pointer when it is over this window.
Definition: reswindow.h:292
ResGadget operator*() const
Get the gadget pointed to by this iterator.
Definition: reswindow.h:1274
int end_gadget_offset() const
Get offset to end of gadgets.
Definition: reswindow.cc:146
char * shortcut_start() const
Get pointer to first short cut in memory.
Definition: reswindow.h:1319
WimpColour scroll_outer() const
Get the work area scroll bar outer colour.
Definition: reswindow.h:885
shortcut_iterator & operator++()
Increment to the next shortcut.
Definition: reswindow.h:1152
void adjust_size_icon(bool has_icon)
Set if window has an adjust size icon.
Definition: reswindow.h:818
unsigned int uint_value(int offset) const
Get an unsigned integer value.
Definition: resbase.h:324
ResShortcut shortcut(int key_code) const
Get a copy of shortcut with key_code.
Definition: reswindow.cc:429
bool allow_off_screen() const
Check if window is allowed off screen.
Definition: reswindow.h:636
void check_class_id(int class_id) const
Check if this objects class id is as specified.
Definition: resobject.cc:383
bool real_colours() const
Check if window colours are given as gcol numbers.
Definition: reswindow.h:680
void scroll_outer(WimpColour value)
Set the scroll bar outer colour.
Definition: reswindow.h:891
void string_with_length(int offset, const char *value, int length=-1)
Assign a string where the length is at offset+4.
Definition: resbase.cc:1591
void ignore_right_extent(bool ignore)
Set if right extent is ignored.
Definition: reswindow.h:734
WimpColour title_fore() const
Get the foreground/text colour for the title bar.
Definition: reswindow.h:837
void default_focus(ComponentId id)
Set the component ID of the gadget to get the default focus.
Definition: reswindow.h:376
const_shortcut_iterator shortcut_cbegin() const
Get constant iterator to first shortcut.
Definition: reswindow.h:1129
void sprite_area(OsSpriteAreaPtr value)
Set a pointer to the sprite area used for client icons on this window.
Definition: reswindow.h:1006
Classes to use/edit toolbox resources in memory.
int _offset
Offset of current item being iterated.
Definition: resiteratorbase.h:12
gadget_iterator & operator++()
Increment to the next gadget.
Definition: reswindow.h:1262
unsigned int window_flags() const
Get the window flags.
Definition: reswindow.h:580
void internal_bl_toolbar(const char *value)
Set the name of the object to use for the internal bottom left toolbar.
Definition: reswindow.h:423
void help_message(const std::string &value, int max_length=-1)
Set the help message.
Definition: reswindow.h:270
gadget_iterator gadget_end()
Get iterator to the end of the gadgets.
Definition: reswindow.h:1289
void pointer_x_hot(int value)
Set the X position of the hotspot in the pointer.
Definition: reswindow.h:318
void allow_off_screen(bool allow)
Set if window is allowed off screen.
Definition: reswindow.h:642
Window resource object.
Definition: reswindow.h:48
void scroll_x(int value)
Set the X scroll offset into the work area.
Definition: reswindow.h:547
WimpColour work_fore() const
Get the work area foreground colour.
Definition: reswindow.h:861
void auto_close(bool value)
Set if window is automatically closed.
Definition: reswindow.h:220
Class to represent a standard desktop WIMP colour.
Definition: colour.h:146
const_shortcut_iterator & operator++()
Increment to the next shortcut.
Definition: reswindow.h:1096
void help_message(const char *value, int max_length=-1)
Set the help message.
Definition: reswindow.h:262
bool toolbar() const
Check if this template is for a toolbar.
Definition: reswindow.h:240
void work_xmin(int value)
Set the minimum X coordinate of the work area extent.
Definition: reswindow.h:930
const char * internal_tl_toolbar() const
Get the name of the object to use for the internal top left toolbar.
Definition: reswindow.h:435
const char * help_message() const
Get the help message.
Definition: reswindow.h:253
bool hot_keys() const
Check if generates events for hot keys.
Definition: reswindow.h:704
int first_gadget_offset() const
Get offset to first gadget.
Definition: reswindow.cc:136
ResWindow & operator=(const ResObject &other)
Assignment from ResObject.
Definition: reswindow.h:147
void real_colours(bool real)
Set if window colours are given as gcol numbers.
Definition: reswindow.h:686
void pointer_y_hot(int value)
Set the Y position of the hotspot in the pointer.
Definition: reswindow.h:330
Keyboard short cut.
Definition: resshortcut.h:43
unsigned int title_flags() const
Get the title flags.
Definition: reswindow.h:972
int show_event() const
Get the event ID of the event generated when the window is shown.
Definition: reswindow.h:385
const_shortcut_iterator shortcut_begin() const
Get constant iterator to first shortcut.
Definition: reswindow.h:1117
void window_flags(unsigned int value)
Set the window flags.
Definition: reswindow.h:589
void title_validation(const char *value)
Set the title validation.
Definition: reswindow.h:1061
int int_value(int offset) const
Get an integer value.
Definition: resbase.h:316
void scroll_y(int value)
Set the Y scroll offset into the work area.
Definition: reswindow.h:559
ResWindow(std::string name, bool toolbar=false)
Constructor and empty ResWindow.
Definition: reswindow.h:58
int max_pointer_shape() const
Get the maximum pointer shape length.
Definition: reswindow.h:306
int visible_xmin() const
Get the minimum X coordinate of the visible part of the window.
Definition: reswindow.h:493
bool contains_gadget(ComponentId component_id) const
Check if the window contains a gadget with the given id.
Definition: reswindow.cc:211
Iterator for shortcuts.
Definition: reswindow.h:1142
bool generate_about_to_be_shown() const
Check if the about to be shown event will be generated.
Definition: reswindow.h:176
ResWindow(const ResWindow &other)
Copy constructor.
Definition: reswindow.h:122
void menu(const char *value)
Set the menu to be shown for this menu.
Definition: reswindow.h:343
void toggle_size_icon(bool has_icon)
Set if window has a toggle size icon.
Definition: reswindow.h:794
const char * string(int offset) const
Return a string at the given offset.
Definition: resbase.cc:1555
int work_ymin() const
Get the minimum Y coordinate of the work area extent.
Definition: reswindow.h:936
const char * external_bl_toolbar() const
Get the name of the object to use for the external bottom left toolbar.
Definition: reswindow.h:454
bool back_icon() const
Check if window has a back icon.
Definition: reswindow.h:752
void external_tl_toolbar(const char *value)
Set the name of the object to use for the external top left toolbar.
Definition: reswindow.h:479
void erase_shortcut(int key_code)
Erase shortcut with specific key_code.
Definition: reswindow.cc:479
ResWindow(const ResObject &other)
Construct from a ResObject.
Definition: reswindow.h:129
bool generate_has_been_hidden() const
Check if an event will be generated when the window has been hidden.
Definition: reswindow.h:227
void title_text(const char *value)
Set the text for the title of the window.
Definition: reswindow.h:1043
unsigned int button_type() const
Get the button type.
Definition: reswindow.h:985
void show_event(int event_id)
Set the event ID of the event generated when the window is shown.
Definition: reswindow.h:393
bool auto_redraw() const
Check if window can be redrawn entirely by the WIMP.
Definition: reswindow.h:610
WimpColour scroll_inner() const
Get the scroll bar inner colour.
Definition: reswindow.h:897
void external_bl_toolbar(const std::string &value)
Set the name of the object to use for the external bottom left toolbar.
Definition: reswindow.h:466
const_shortcut_iterator find_shortcut(int key_code) const
Find shortcut with given key.
Definition: reswindow.cc:413
bool titlebar() const
Check if window has a title bar.
Definition: reswindow.h:776
int work_xmax() const
Get the maximum X coordinate of the work area extent.
Definition: reswindow.h:948
const_gadget_iterator find_gadget(int component_id) const
Find gadget with given id.
Definition: reswindow.cc:182
WimpColour work_back() const
Get the work area background colour.
Definition: reswindow.h:873
gadget_iterator gadget_begin()
Get iterator to first gadget.
Definition: reswindow.h:1283
bool user_scroll() const
Check if a Scroll_Request event if returned with auto-repeat on the arrow icons and no auto-repeat on...
Definition: reswindow.h:650
void moveable(bool move)
Set if the window is moveable.
Definition: reswindow.h:602
void work_fore(WimpColour value)
Set the work area foreground colour.
Definition: reswindow.h:867
Iterator for gadgets in the window resource.
Definition: reswindow.h:1252
void init_sprite_area_ref(int offset)
Initialise a sprite area reference.
Definition: resbase.cc:1746
const char * message(int offset) const
Get the message string at the given offset.
Definition: resbase.cc:1602
const char * name() const
Return pointer to name of object.
Definition: resobject.h:79
void work_back(WimpColour value)
Set the work area background colour.
Definition: reswindow.h:879
void close_icon(bool has_icon)
Set if window has a close icon.
Definition: reswindow.h:770
void internal_tl_toolbar(const char *value)
Set the name of the object to use for the internal top left toolbar.
Definition: reswindow.h:441
const_gadget_iterator & operator++()
Increment to the next gadget.
Definition: reswindow.h:1207
void work_ymin(int value)
Set the minimum Y coordinate of the work area extent.
Definition: reswindow.h:942
void force_on_screen(bool on)
Set if window is forced on screen.
Definition: reswindow.h:722
const char * menu() const
Get the menu to be shown for this menu.
Definition: reswindow.h:337
WimpColour title_inputfocus() const
Get the background colour for the title bar when it has the input focus.
Definition: reswindow.h:910
void visible_xmax(int value)
Set the maximum X coordinate of the visible part of the window.
Definition: reswindow.h:523
bool ignore_lower_extent() const
Check if lower extent is ignored.
Definition: reswindow.h:740
void work_xmax(int value)
Set the maximum X coordinate of the work area extent.
Definition: reswindow.h:954
char * gadget_start() const
Get pointer to position of first gadget in memory.
Definition: reswindow.h:1308
void pointer_shape(const std::string &value, int max_length=-1)
Set the name of the sprite to use for the mouse pointer when it is over this window.
Definition: reswindow.h:301
shortcut_iterator operator++(int)
Increment to the next shortcut.
Definition: reswindow.h:1158
void top_window(bool tw)
Set if window can be opened below this.
Definition: reswindow.h:698
void generate_has_been_hidden(bool value)
Set if an event will be generated when the window has been hidden.
Definition: reswindow.h:233
ResObject & operator=(const ResObject &other)
Assignment.
Definition: resobject.cc:109
unsigned short ushort_value(int offset) const
Get a unsigned short value.
Definition: resbase.h:342
ComponentId default_focus() const
Get the component ID of the gadget to get the default focus.
Definition: reswindow.h:369
const char * internal_bl_toolbar() const
Get the name of the object to use for the internal bottom left toolbar.
Definition: reswindow.h:417
void replace_shortcut(const ResShortcut &shortcut)
Replace menu shortcut with same key_code as given shortcut.
Definition: reswindow.cc:462
void menu(const std::string &value)
Set the menu to be shown for this menu.
Definition: reswindow.h:349
Constant iterator for gadgets in the window resource.
Definition: reswindow.h:1197
void work_ymax(int value)
Set the maximum Y coordinate of the work area extent.
Definition: reswindow.h:966
void user_scroll_debounced(bool scroll)
Set if a Scroll_Request event if returned with no auto-repeat on the arrow icons and no auto-repeat o...
Definition: reswindow.h:674
void pane(bool p)
Set if a window is a pane.
Definition: reswindow.h:630
gadget_iterator insert_gadget(gadget_iterator pos, const ResGadget &gadget)
Insert gadget at given position.
Definition: reswindow.cc:266
OsSpriteAreaPtr sprite_area() const
Get a pointer to the sprite area used for client icons on this window.
Definition: reswindow.h:999
WimpColour title_back() const
Get the background colour for the title bar.
Definition: reswindow.h:849
void generate_about_to_be_shown(bool value)
Set if the about to be shown event will be generated.
Definition: reswindow.h:182
ResShortcut operator*() const
Get the shortcut pointed to by this iterator.
Definition: reswindow.h:1164
Base class for a resource object that can be edited.
Definition: resobject.h:52
void add_shortcut(const ResShortcut &shortcut)
Adds the shortcut to the end of the window.
Definition: reswindow.cc:451
shortcut_iterator insert_shortcut(shortcut_iterator pos, const ResShortcut &shortcut)
Insert shortcut at given position.
Definition: reswindow.cc:494
ResShortcut operator*() const
Get the shortcut pointed to by this iterator.
Definition: reswindow.h:1108
void title_flags(unsigned int value)
Set the title flags.
Definition: reswindow.h:978
void min_height(unsigned short value)
Set the minimum height for the window.
Definition: reswindow.h:1030
void external_tl_toolbar(const std::string &value)
Set the name of the object to use for the external top left toolbar.
Definition: reswindow.h:485
bool vscrollbar() const
Check if window has a vertical scroll bar.
Definition: reswindow.h:800
int visible_xmax() const
Get the maximum X coordinate of the visible part of the window.
Definition: reswindow.h:517
void erase_gadget(ComponentId component_id)
Erase gadget with specific id.
Definition: reswindow.cc:251
const char * pointer_shape() const
Get the name of the sprite to use for the mouse pointer when it is over this window.
Definition: reswindow.h:283
void internal_tl_toolbar(const std::string &value)
Set the name of the object to use for the internal top left toolbar.
Definition: reswindow.h:447
gadget_iterator operator++(int)
Increment to the next gadget.
Definition: reswindow.h:1268
ResGadget operator*() const
Get the gadget pointed to by this iterator.
Definition: reswindow.h:1219
const_gadget_iterator operator++(int)
Increment to the next gadget.
Definition: reswindow.h:1213
bool pane() const
Check if a window is a pane.
Definition: reswindow.h:624
void behind(int value)
Set the WIMP window handle this window will be opened behind.
Definition: reswindow.h:571
void title_back(WimpColour value)
Set the background colour for the title bar.
Definition: reswindow.h:855
ResGadget gadget_at_offset(int item_offset) const
Get a copy of the gadget at the given offset.
Definition: reswindow.cc:109
bool hscrollbar() const
Check if window has a horizontal scroll bar.
Definition: reswindow.h:824
int pointer_x_hot() const
Get the X position of the hotspot in the pointer.
Definition: reswindow.h:312
void button_type(unsigned int value)
Set the button type.
Definition: reswindow.h:991
const char * external_tl_toolbar() const
Get the name of the object to use for the external top left toolbar.
Definition: reswindow.h:473
const_gadget_iterator gadget_begin() const
Get constant iterator to first gadget.
Definition: reswindow.h:1228
void next_gadget(int &item_offset) const
Get offset to next gadget in window.
Definition: reswindow.cc:156
void vscrollbar(bool has_vsb)
Set if window has a vertical scroll bar.
Definition: reswindow.h:806
void external_bl_toolbar(const char *value)
Set the name of the object to use for the external bottom left toolbar.
Definition: reswindow.h:460
void visible_xmin(int value)
Set the minimum X coordinate of the visible part of the window.
Definition: reswindow.h:499
void replace_gadget(const ResGadget &gadget)
Replace menu gadget with same component id as given gadget.
Definition: reswindow.cc:233
void title_text(const std::string &value)
Set the text for the title of the window.
Definition: reswindow.h:1049
int hide_event() const
Get the event ID of the event generated when the window has been hidden.
Definition: reswindow.h:402
const_shortcut_iterator shortcut_end() const
Get constant iterator to end of shortcuts.
Definition: reswindow.h:1123
unsigned short min_height() const
Get the minimum height for the window.
Definition: reswindow.h:1024
void visible_ymin(int value)
Set the minimum Y coordinate of the visible part of the window.
Definition: reswindow.h:511
shortcut_iterator shortcut_end()
Get iterator to end of shortcuts.
Definition: reswindow.h:1179
unsigned char byte_value(int offset) const
Get a byte value.
Definition: resbase.h:333
const_gadget_iterator gadget_cend() const
Get constant iterator to the end of the gadgets.
Definition: reswindow.h:1246
bool force_on_screen() const
Check if window is forced on screen.
Definition: reswindow.h:716
const_shortcut_iterator operator++(int)
Increment to the next shortcut.
Definition: reswindow.h:1102
int pointer_y_hot() const
Get the Y position of the hotspot in the pointer.
Definition: reswindow.h:324
int work_xmin() const
Get the minimum X coordinate of the work area extent.
Definition: reswindow.h:924
const char * title_text() const
Get the text for the title of the window.
Definition: reswindow.h:1037
void init_message(int offset, const char *value)
Initialise a message in a constructor helper.
Definition: resbase.cc:1736
void auto_redraw(bool on)
Set if window can be redrawn entirely by the WIMP.
Definition: reswindow.h:618
bool moveable() const
Check if the window will be moveable.
Definition: reswindow.h:596