OpenASIP  2.0
ChildFrame.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
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 in
14  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
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file ChildFrame.cc
26  *
27  * Definition of ChildFrame class.
28  *
29  * @author Veli-Pekka Jääskeläinen (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include <string>
34 
35 #include "ChildFrame.hh"
36 #include "MDFDocument.hh"
37 #include "MDFView.hh"
38 
39 using std::string;
40 
41 BEGIN_EVENT_TABLE(ChildFrame, wxDocMDIChildFrame)
42  EVT_SET_FOCUS(ChildFrame::onFocus)
44 
45 /**
46  * The Constructor.
47  *
48  * @param doc Document which is displayed in the ChildFrame.
49  * @param view View of the document to display.
50  * @param parent MDI parent frame of the child frame.
51  */
53  wxDocument* doc,
54  wxView* view,
55  wxDocMDIParentFrame* parent):
56  wxDocMDIChildFrame(doc, view, parent, -1, _T("ChildFrame")),
57  view_(view), parent_(parent) {
58 
59 }
60 
61 
62 /**
63  * The Destructor.
64  */
66 }
67 
68 
69 /**
70  * Sets the statusbar text.
71  *
72  * @param text New text for the statusbar.
73  * @param field Field of status bar to set text for.
74  */
75 void
76 ChildFrame::setStatus(const wxString text, int field) {
77  wxStatusBar* statusbar = parent_->GetStatusBar();
78  if (statusbar != NULL && statusbar->GetFieldsCount() > field) {
79  statusbar->SetStatusText(text, field);
80  }
81 }
82 
83 /**
84  * Activates the associated view when a ChildFrame instance gains focus.
85  *
86  * Correct views are not always activated by the wxWidgets document/view
87  * framework when documents are closed. This function makes sure that the
88  * view associated with the focused ChildFrame is activated.
89  */
90 void
91 ChildFrame::onFocus(wxFocusEvent& event) {
92  view_->Activate(true);
93  event.Skip();
94 }
ChildFrame::setStatus
void setStatus(const wxString text, int field=0)
Definition: ChildFrame.cc:76
ChildFrame.hh
ChildFrame::onFocus
void onFocus(wxFocusEvent &event)
Definition: ChildFrame.cc:91
MDFDocument.hh
ChildFrame::~ChildFrame
~ChildFrame()
Definition: ChildFrame.cc:65
ChildFrame
Definition: ChildFrame.hh:42
ChildFrame::view_
wxView * view_
View of the document which is displayed in the frame.
Definition: ChildFrame.hh:53
MDFView.hh
ChildFrame::parent_
wxDocMDIParentFrame * parent_
MDI parent frame of the ChildFrame.
Definition: ChildFrame.hh:55
END_EVENT_TABLE
END_EVENT_TABLE() using namespace IDF