tbx  0.7.6
restabs.h
1 /*
2  * tbx RISC OS toolbox library
3  *
4  * Copyright (C) 2020 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_RESTABS_H
26 #define TBX_RES_RESTABS_H
27 
28 #include "tbx/res/resgadget.h"
29 
30 namespace tbx {
31 namespace ext {
32 namespace res {
33 
38 {
39 
40 public:
41  enum {TYPE_ID = 0x402c };
42 
49  ResTabs(const tbx::res::ResGadget &other) : tbx::res::ResGadget(other)
50  {
51  check_type(TYPE_ID);
52  }
53 
59  ResTabs(const ResTabs &other) : tbx::res::ResGadget(other)
60  {
61  }
62 
63  virtual ~ResTabs() {}
64 
72  {
73  other.check_type(TYPE_ID);
75  return *this;
76  }
77 
83  ResTabs &operator=(const ResTabs &other)
84  {
86  return *this;
87  }
88 
95  : tbx::res::ResGadget(0x402c,48)
96  {
97  init_message(44,0); // text
98  foreground(7); // Black
99  background(1); // grey
100  flags(0);
101  }
102 
108  bool allow_scroll_arrows() const {return flag(0, 1<<0);}
114  void allow_scroll_arrows(bool value) {flag(0,1<<0,value);}
120  const char *nested_windows() const {return message(44);}
126  void nested_windows(const char *value) {message(44, value);}
132  int foreground() const {return int_value(36);}
138  void foreground(int value) {int_value(36,value);}
144  int background() const {return int_value(40);}
150  void background(int value) {int_value(40,value);}
151 
152 };
153 
154 }
155 }
156 }
157 
158 #endif // TBX_RES_RESTABS_H
159 
tbx::res::ResBase::operator=
ResBase & operator=(const ResBase &other)
Assignment.
Definition: resbase.cc:1534
tbx
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
tbx::ext::res::ResTabs::ResTabs
ResTabs(const tbx::res::ResGadget &other)
Construct a Tabs gadget resource.
Definition: restabs.h:49
tbx::ext::res::ResTabs::operator=
ResTabs & operator=(const ResTabs &other)
Assign from another Tabs gadget resource.
Definition: restabs.h:83
tbx::ext::res::ResTabs::nested_windows
void nested_windows(const char *value)
Set the names of the windows nested in the tabs gagdet.
Definition: restabs.h:126
tbx::res::ResGadget
Base class for gadget memory resources.
Definition: resgadget.h:43
tbx::res::ResBase::int_value
int int_value(int offset) const
Get an integer value.
Definition: resbase.h:316
tbx::res::ResGadget::flags
unsigned int flags() const
Get all flags as a word raw access.
Definition: resgadget.h:102
tbx::ext::res::ResTabs
Class for Tabs gadget template.
Definition: restabs.h:38
tbx::res::ResGadget::ResGadget
ResGadget(const ResGadget &other)
Construct a resource gadget as a copy of another.
Definition: resgadget.h:59
tbx::ext::res::ResTabs::foreground
void foreground(int value)
Set foreground/text colour for the Tabs.
Definition: restabs.h:138
tbx::res::ResBase::init_message
void init_message(int offset, const char *value)
Initialise a message in a constructor helper.
Definition: resbase.cc:1736
tbx::res::ResBase::flag
bool flag(int offset, int mask) const
Check if any of the bits in a mask are set.
Definition: resbase.h:352
tbx::ext::res::ResTabs::operator=
ResTabs & operator=(const tbx::res::ResGadget &other)
Assign from a ResGadget.
Definition: restabs.h:71
tbx::ext::res::ResTabs::ResTabs
ResTabs(const ResTabs &other)
Construct a Tabs gadget resource.
Definition: restabs.h:59
tbx::ext::res::ResTabs::allow_scroll_arrows
void allow_scroll_arrows(bool value)
Set if Tabs allows scroll arrows.
Definition: restabs.h:114
tbx::ext::res::ResTabs::ResTabs
ResTabs()
Construct a Tabs gadget resource.
Definition: restabs.h:94
tbx::ext::res::ResTabs::nested_windows
const char * nested_windows() const
Get the names of the windows nested in the tabs gagdet.
Definition: restabs.h:120
tbx::ext::res::ResTabs::foreground
int foreground() const
Get foreground/text colour for the Tabs.
Definition: restabs.h:132
tbx::ext::res::ResTabs::allow_scroll_arrows
bool allow_scroll_arrows() const
Check if Tabs allows scroll arrows.
Definition: restabs.h:108
tbx::ext::res::ResTabs::background
void background(int value)
Set background colour for the Tabs.
Definition: restabs.h:150
tbx::res::ResGadget::check_type
void check_type(int type) const
Check if this gadgets type is as specified.
Definition: reswindow.cc:97
tbx::ext::res::ResTabs::background
int background() const
Get background colour for the Tabs.
Definition: restabs.h:144
tbx::res::ResBase::message
const char * message(int offset) const
Get the message string at the given offset.
Definition: resbase.cc:1602