tbx  0.7.3
abouttobeshownlistener.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_ABOUTTOBESHOWNLISTENER_H
26 #define TBX_ABOUTTOBESHOWNLISTENER_H
27 
28 #include "listener.h"
29 #include "showfullspec.h"
30 #include "eventinfo.h"
31 
32 namespace tbx
33 {
38  {
39  public:
47  EventInfo(id_block, data)
48  {
49  }
50 
52  enum ShowType {SHOW_DEFAULT = 0, SHOW_FULL_SPEC = 1, SHOW_TOP_LEFT = 2};
54  ShowType show_type() const {return ShowType(_data.word[4]);}
55 
57  Point &top_left() const {return reinterpret_cast<Point &>(_data.word[5]);}
59  Point &top_left() {return reinterpret_cast<Point &>(_data.word[5]);}
60 
67  ShowFullSpec &full_spec() {return reinterpret_cast<ShowFullSpec &>(_data.word[5]);}
68  };
69 
77  {
78  public:
80  virtual ~AboutToBeShownListener() {}
81 
85  virtual void about_to_be_shown(AboutToBeShownEvent &event) = 0;
86  };
87 
89  void about_to_be_shown_router(IdBlock &id_block, PollBlock &data, Listener *listener);
91 }
92 
93 #endif
94 
Point & top_left()
Return a reference to the top left coordinate.
Definition: abouttobeshownlistener.h:59
void about_to_be_shown_router(IdBlock &id_block, PollBlock &data, Listener *listener)
Static function to route about to be shown event.
Definition: abouttobeshownlistener.cc:39
Listener for about to be shown event.
Definition: abouttobeshownlistener.h:76
PollBlock & _data
raw data from the event
Definition: eventinfo.h:53
Structure holding the raw data from a call to Wimp_Poll.
Definition: pollinfo.h:71
AboutToBeShownEvent(IdBlock &id_block, PollBlock &data)
Construct from information returned from the toolbox poll.
Definition: abouttobeshownlistener.h:46
Structure used to specify exact position and size for an object derived from tbx::ShowFullObject.
Definition: showfullspec.h:45
Class to represent a position in two dimensional space.
Definition: point.h:36
ShowFullSpec & full_spec()
Return a reference to the Full specification of where the object has been shown.
Definition: abouttobeshownlistener.h:67
ShowType show_type() const
Return how the object has been shown.
Definition: abouttobeshownlistener.h:54
Point & top_left() const
Return the top left coordinate where the object will be shown.
Definition: abouttobeshownlistener.h:57
ShowType
How the object has been shown.
Definition: abouttobeshownlistener.h:52
Class to provide information on a toolbox event.
Definition: eventinfo.h:48
Base class for all toolbox event listeners.
Definition: listener.h:33
int word[64]
Array containing information return from Wimp_Poll.
Definition: pollinfo.h:76
const IdBlock & id_block() const
IdBlock for the current event.
Definition: eventinfo.h:71
virtual void about_to_be_shown(AboutToBeShownEvent &event)=0
Called when an object is about to be shown.
Event information for AboutToBeShown event.
Definition: abouttobeshownlistener.h:37
Information passed back by the Toolbox with each toolbox event providing information on where the eve...
Definition: pollinfo.h:41