OpenASIP 2.2
Loading...
Searching...
No Matches
AboutDialog.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 AboutDialog.cc
26 *
27 * Definition of AboutDialog class.
28 *
29 * @author Veli-Pekka Jääskeläinen (vjaaskel-no.spam-cs.tut.fi)
30 */
31
32#include <string>
33#include <boost/format.hpp>
34
35#include "AboutDialog.hh"
36#include "ProDeConstants.hh"
37#include "WxConversion.hh"
38#include "ProDe.hh"
39#include "GUITextGenerator.hh"
40#include "ProDeTextGenerator.hh"
41#include "WidgetTools.hh"
42#include "tce_config.h"
43
44using boost::format;
45using std::string;
46
47/**
48 * The Constructor.
49 *
50 * @param parent Parent window of the dialog.
51 */
52AboutDialog::AboutDialog(wxWindow* parent):
53 wxDialog(parent, -1, _T(""), wxDefaultPosition) {
54
55 createContents(this, true, true);
56
57 // set widget texts
58 setTexts();
59}
60
61/**
62 * The Destructor.
63 */
66
67
68/**
69 * Sets texts for widgets.
70 */
71void
75
76 // Dialog title
77 format fmt = prodeTexts->text(ProDeTextGenerator::TXT_ABOUT_DIALOG_TITLE);
78 string title = fmt.str();
80 SetTitle(WxConversion::toWxString(title));
81
82 // buttons
83 WidgetTools::setLabel(generator, FindWindow(wxID_OK),
85}
86
87
88/**
89 * Creates contents of the dialog window. Initially generated with
90 * wxDesigner, the code will be cleaned up later.
91 *
92 * @param parent Parent dialog of the contents.
93 * @param call_fit If true, fits sizer in dialog window.
94 * @param set_sizer If true, sets sizer as dialog's sizer.
95 * @return Top level sizer of the contents.
96 */
97wxSizer*
99 wxWindow *parent, bool call_fit, bool set_sizer) {
100
101 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
102 wxBitmap logo;
103
104 wxString filename = WxConversion::toWxString(
106
107 logo.LoadFile(filename, wxBITMAP_TYPE_PNG);
108 wxStaticBitmap* dialogLogo = new wxStaticBitmap(parent, -1, logo);
109
110 item0->Add(dialogLogo, 0, wxALIGN_CENTER|wxALL, 5 );
111 wxBoxSizer *item3 = new wxBoxSizer( wxVERTICAL );
112 wxStaticText *item4 =
113 new wxStaticText(parent, -1, ProDeConstants::EDITOR_NAME,
114 wxDefaultPosition, wxDefaultSize, 0);
115 item3->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
116 wxStaticText *item5 =
117 new wxStaticText(parent, -1, _T("OpenASIP ") +
119 wxDefaultPosition, wxDefaultSize, 0);
120 item3->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
121 wxStaticText *item6 =
122 new wxStaticText(parent, -1,
124 wxDefaultPosition, wxDefaultSize, 0);
125 item3->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
126 item0->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );
127 wxStaticLine *item7 =
128 new wxStaticLine(parent, -1, wxDefaultPosition,
129 wxSize(20,-1), wxLI_HORIZONTAL);
130 item0->Add( item7, 0, wxGROW|wxALL, 5 );
131 wxButton *item8 =
132 new wxButton(parent, wxID_OK, wxT("&OK"), wxDefaultPosition,
133 wxDefaultSize, 0);
134 item0->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
135 if (set_sizer) {
136 parent->SetAutoLayout( TRUE );
137 parent->SetSizer( item0 );
138 if (call_fit)
139 {
140 item0->Fit( parent );
141 item0->SetSizeHints( parent );
142 }
143 }
144
145 return item0;
146}
const string TRUE
Value used for true in attribute and element values.
void setTexts()
virtual ~AboutDialog()
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
AboutDialog(wxWindow *parent)
@ TXT_BUTTON_OK
Label for OK button.
static GUITextGenerator * instance()
static const std::string EDITOR_LOGO_PATH
Location of the logo picture of the Editor.
static const wxString EDITOR_NAME
Full name of the Editor.
static const wxString EDITOR_COPYRIGHT_TEXT
Copyright text of the Editor.
static ProDeTextGenerator * instance()
@ TXT_ABOUT_DIALOG_TITLE
About dialog title.
static std::string bitmapsDirPath()
Definition ProDe.cc:427
virtual boost::format text(int textId)
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
static wxString toWxString(const std::string &source)
static std::string toString(const wxString &source)