tbx  0.7.3
resadjuster.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_RES_RESADJUSTER_H
26 #define TBX_RES_RESADJUSTER_H
27 
28 #include "resgadget.h"
29 
30 namespace tbx {
31 namespace res {
32 
36 class ResAdjuster : public ResGadget
37 {
38 public:
39  enum {TYPE_ID = 768 };
46  ResAdjuster(const ResGadget &other) : ResGadget(other)
47  {
48  check_type(TYPE_ID);
49  }
50 
56  ResAdjuster(const ResAdjuster &other) : ResGadget(other)
57  {
58  }
59 
60  virtual ~ResAdjuster() {}
61 
69  {
70  other.check_type(TYPE_ID);
71  ResBase::operator=(other);
72  return *this;
73  }
74 
81  {
82  ResBase::operator=(other);
83  return *this;
84  }
85 
92  : ResGadget(768,40)
93  {
94  // seems to have an unused reserved word at 36
95  }
96 
102  bool increment() const {return flag(0,1);}
108  void increment(bool value) {flag(0,1, value);}
109 
116  bool vertical() const {return flag(0,2);}
123  void vertical(bool value) {flag(0,2, value);}
124 };
125 
126 }
127 }
128 
129 #endif // TBX_RES_RESADJUSTER_H
130 
Base class for gadget memory resources.
Definition: resgadget.h:42
bool increment() const
Check if adjustor is increment adjustor.
Definition: resadjuster.h:102
bool vertical() const
Check adjuster orientation.
Definition: resadjuster.h:116
void vertical(bool value)
Set adjuster orientation.
Definition: resadjuster.h:123
bool flag(int offset, int mask) const
Check if any of the bits in a mask are set.
Definition: resbase.h:352
ResAdjuster()
Construct a adjuster gadget resource.
Definition: resadjuster.h:91
ResAdjuster(const ResAdjuster &other)
Construct an adjuster gadget resource.
Definition: resadjuster.h:56
ResAdjuster & operator=(const ResGadget &other)
Assign from a ResGadget.
Definition: resadjuster.h:68
void increment(bool value)
Set if adjustor is increment adjustor.
Definition: resadjuster.h:108
ResAdjuster(const ResGadget &other)
Construct an adjuster gadget resource.
Definition: resadjuster.h:46
Class for Adjuster gadget template.
Definition: resadjuster.h:36
ResBase & operator=(const ResBase &other)
Assignment.
Definition: resbase.cc:1534
void check_type(int type) const
Check if this gadgets type is as specified.
Definition: reswindow.cc:97
ResAdjuster & operator=(const ResAdjuster &other)
Assign from another adjuster gadget resource.
Definition: resadjuster.h:80