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

Last change on this file since 1081 was 1080, checked in by tbretz, 25 years ago
*** empty log message ***
File size: 5.4 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 = kVerticalFrame,
57 GContext_t norm=GetDefaultGC()(),
58 FontStruct_t font=GetDefaultFontStruct(),
59 ULong_t back=GetDefaultFrameBackground())
60 : TGGroupFrame(p, title, options, norm, font, back), TGWidget(-1)
61{
62 fWidgetFlags = 0;
63 fMsgWindow = p;
64 fTask = task;
65
66 fList = new MGList;
67}
68
69// --------------------------------------------------------------------------
70//
71// For a detailed description check TGGroupFrame::TGGroupFrame.
72// All messages from associated GUI elements are redirected to the given
73// task.
74// Creates a MGList object to store Widgets. Use AddToList to Add
75// objects.
76//
77MGGroupFrame::MGGroupFrame(MGTask *task,
78 const TGWindow *p, const char *title,
79 UInt_t options = kVerticalFrame,
80 GContext_t norm=GetDefaultGC()(),
81 FontStruct_t font=GetDefaultFontStruct(),
82 ULong_t back=GetDefaultFrameBackground())
83: TGGroupFrame(p, title, options, norm, font, back), TGWidget(-1)
84{
85 fWidgetFlags = 0;
86 fMsgWindow = p;
87 fTask = task;
88
89 fList = new MGList;
90}
91
92// --------------------------------------------------------------------------
93//
94// Deleted the MGList object and all its members.
95//
96MGGroupFrame::~MGGroupFrame()
97{
98 fList->SetOwner();
99 delete fList;
100}
101
102// --------------------------------------------------------------------------
103//
104// Add an object to the MGList. All the objects in MGList are deleted
105// in the destructor MGGroupFrame automatically.
106// You can add all object which have to exist until the Group Frame is
107// destroyed (eg. TGLayoutElements)
108// If an object is also derived from TGWidget you can get a pointer
109// to it by its widget Id (use FindWidget)
110//
111void MGGroupFrame::AddToList(TObject *obj)
112{
113 fList->Add(obj);
114}
115
116// --------------------------------------------------------------------------
117//
118// To get an object which has a widget id (is derived from TGWidget) by
119// its widget id use FindWidget with the widget id of the object you
120// are searching for. If no object with this widget id exists NULL
121// is returned. See also MGList::FindWidget(Int_t)
122//
123TObject *MGGroupFrame::FindWidget(Int_t id) const
124{
125 return fList->FindWidget(id);
126}
127
128// --------------------------------------------------------------------------
129//
130// If you associate an object with this MGGroupFrame object, like in the
131// following example:
132//
133// MGGroupFrame *f = new MGGroupFrame(...);
134// TGTextEntry *entry = new TGTextEntry(...);
135// entry->Associate(f);
136//
137// All messages send to the group frame by the GUI elent are redirected
138// to the task corresponing to the MGGroupFrame.
139//
140Bool_t MGGroupFrame::ProcessMessage(Long_t msg, Long_t param1, Long_t param2)
141{
142 return fTask->ProcessMessage(GET_MSG(msg), GET_SUBMSG(msg), param1, param2);
143}
Note: See TracBrowser for help on using the repository browser.