tbx  0.7.6
respopup.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_RESPOPUP_H
26 #define TBX_RES_RESPOPUP_H
27 
28 #include "resgadget.h"
29 
30 namespace tbx {
31 namespace res {
32 
36 class ResPopUp : public ResGadget
37 {
38 
39 public:
40  enum {TYPE_ID = 704 };
41 
48  ResPopUp(const ResGadget &other) : ResGadget(other)
49  {
50  check_type(TYPE_ID);
51  }
52 
58  ResPopUp(const ResPopUp &other) : ResGadget(other)
59  {
60  }
61 
62  virtual ~ResPopUp() {}
63 
70  ResPopUp &operator=(const ResGadget &other)
71  {
72  other.check_type(TYPE_ID);
73  ResBase::operator=(other);
74  return *this;
75  }
76 
82  ResPopUp &operator=(const ResPopUp &other)
83  {
84  ResBase::operator=(other);
85  return *this;
86  }
87 
94  : ResGadget(704,40)
95  {
96  init_string(36,0); // menu
97  }
98 
105  bool generate_about_to_be_shown() const {return flag(0, 1<<0);}
112  void generate_about_to_be_shown(bool value) {flag(0,1<<0,value);}
113 
119  const char *menu() const {return string(36);}
125  void menu(const char *value) {string(36, value);}
131  void menu(const std::string &value) {string(36, value);}
132 };
133 
134 }
135 }
136 
137 #endif // TBX_RES_RESPOPUP_H
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::res::ResPopUp::generate_about_to_be_shown
void generate_about_to_be_shown(bool value)
Set if the about to be shown event should be generated when the menu is popped up from this gadget.
Definition: respopup.h:112
tbx::res::ResPopUp::ResPopUp
ResPopUp(const ResPopUp &other)
Construct an pop up gadget resource.
Definition: respopup.h:58
tbx::res::ResPopUp::ResPopUp
ResPopUp()
Construct a pop up gadget resource.
Definition: respopup.h:93
tbx::res::ResPopUp::menu
void menu(const std::string &value)
Set the name of the menu object to show.
Definition: respopup.h:131
tbx::res::ResGadget
Base class for gadget memory resources.
Definition: resgadget.h:43
tbx::res::ResPopUp::menu
const char * menu() const
Get the name of the menu object to show.
Definition: respopup.h:119
tbx::res::ResPopUp::ResPopUp
ResPopUp(const ResGadget &other)
Construct an pop up gadget resource.
Definition: respopup.h:48
tbx::res::ResPopUp::operator=
ResPopUp & operator=(const ResPopUp &other)
Assign from another pop up gadget resource.
Definition: respopup.h:82
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::res::ResPopUp::generate_about_to_be_shown
bool generate_about_to_be_shown() const
Check if the about to be shown event should be generated when the menu is popped up from this gadget.
Definition: respopup.h:105
tbx::res::ResPopUp
Class for PopUp gadget template.
Definition: respopup.h:37
tbx::res::ResPopUp::menu
void menu(const char *value)
Set the name of the menu object to show.
Definition: respopup.h:125
tbx::res::ResPopUp::operator=
ResPopUp & operator=(const ResGadget &other)
Assign from a ResGadget.
Definition: respopup.h:70
tbx::res::ResBase::string
const char * string(int offset) const
Return a string at the given offset.
Definition: resbase.cc:1555
tbx::res::ResBase::init_string
void init_string(int offset, const char *value)
Initialise a string in a constructor helper.
Definition: resbase.cc:1725
tbx::res::ResGadget::check_type
void check_type(int type) const
Check if this gadgets type is as specified.
Definition: reswindow.cc:97