source: trunk/MagicSoft/Mars/mbase/MGGroupFrame.cc@ 6380

Last change on this file since 6380 was 1105, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 5.1 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Thomas Bretz 11/2001 <mailto:tbretz@uni-sw.gwdg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26// //
27// MGGroupFrame //
28// //
29// This is a group frame derived from TGGroupFrame with some //
30// enhancements: //
31// - It holds a list which deletes all it's members in ~MGGroupFrame //
32// (use AddToList to add an object. //
33// - You can access the members of the list by their widget id (if they //
34// have one) //
35// - All messages from associated GUI elemets are redirectd to a given //
36// task. //
37// //
38/////////////////////////////////////////////////////////////////////////////
39#include "MGGroupFrame.h"
40
41#include "MGList.h"
42#include "MGTask.h"
43
44ClassImp(MGGroupFrame);
45
46// --------------------------------------------------------------------------
47//
48// For a detailed description check TGGroupFrame::TGGroupFrame.
49// All messages from associated GUI elements are redirected to the given
50// task.
51// Creates a MGList object to store Widgets. Use AddToList to Add
52// objects.
53//
54MGGroupFrame::MGGroupFrame(MGTask *task,
55 const TGWindow *p, TGString *title,
56 UInt_t options, GContext_t norm,
57 FontStruct_t font, ULong_t back)
58 : TGGroupFrame(p, title, options, norm, font, back), TGWidget(-1)
59{
60 fWidgetFlags = 0;
61 fMsgWindow = p;
62 fTask = task;
63
64 fList = new MGList;
65}
66
67// --------------------------------------------------------------------------
68//
69// For a detailed description check TGGroupFrame::TGGroupFrame.
70// All messages from associated GUI elements are redirected to the given
71// task.
72// Creates a MGList object to store Widgets. Use AddToList to Add
73// objects.
74//
75MGGroupFrame::MGGroupFrame(MGTask *task,
76 const TGWindow *p, const char *title,
77 UInt_t options, GContext_t norm,
78 FontStruct_t font, ULong_t back)
79: TGGroupFrame(p, title, options, norm, font, back), TGWidget(-1)
80{
81 fWidgetFlags = 0;
82 fMsgWindow = p;
83 fTask = task;
84
85 fList = new MGList;
86}
87
88// --------------------------------------------------------------------------
89//
90// Deleted the MGList object and all its members.
91//
92MGGroupFrame::~MGGroupFrame()
93{
94 fList->SetOwner();
95 delete fList;
96}
97
98// --------------------------------------------------------------------------
99//
100// Add an object to the MGList. All the objects in MGList are deleted
101// in the destructor MGGroupFrame automatically.
102// You can add all object which have to exist until the Group Frame is
103// destroyed (eg. TGLayoutElements)
104// If an object is also derived from TGWidget you can get a pointer
105// to it by its widget Id (use FindWidget)
106//
107void MGGroupFrame::AddToList(TObject *obj)
108{
109 fList->Add(obj);
110}
111
112// --------------------------------------------------------------------------
113//
114// To get an object which has a widget id (is derived from TGWidget) by
115// its widget id use FindWidget with the widget id of the object you
116// are searching for. If no object with this widget id exists NULL
117// is returned. See also MGList::FindWidget(Int_t)
118//
119TObject *MGGroupFrame::FindWidget(Int_t id) const
120{
121 return fList->FindWidget(id);
122}
123
124// --------------------------------------------------------------------------
125//
126// If you associate an object with this MGGroupFrame object, like in the
127// following example:
128//
129// MGGroupFrame *f = new MGGroupFrame(...);
130// TGTextEntry *entry = new TGTextEntry(...);
131// entry->Associate(f);
132//
133// All messages send to the group frame by the GUI elent are redirected
134// to the task corresponing to the MGGroupFrame.
135//
136Bool_t MGGroupFrame::ProcessMessage(Long_t msg, Long_t param1, Long_t param2)
137{
138 return fTask->ProcessMessage(GET_MSG(msg), GET_SUBMSG(msg), param1, param2);
139}
Note: See TracBrowser for help on using the repository browser.