~ubuntu-branches/ubuntu/saucy/3depict/saucy

« back to all changes in this revision

Viewing changes to src/gui/dialogs/filterErrorDialog.cpp

  • Committer: Package Import Robot
  • Author(s): D Haley
  • Date: 2013-05-17 00:52:39 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20130517005239-7bl4mnhkvrhc2ba6
Tags: 0.0.13-1
Upload to unstable 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *      filterErrorDialog.cpp - Dialog for displaying error notices computed from filter tree
 
3
 *      Copyright (C) 2013, D Haley 
 
4
 
 
5
 *      This program is free software: you can redistribute it and/or modify
 
6
 *      it under the terms of the GNU General Public License as published by
 
7
 *      the Free Software Foundation, either version 3 of the License, or
 
8
 *      (at your option) any later version.
 
9
 
 
10
 *      This program is distributed in the hope that it will be useful,
 
11
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *      GNU General Public License for more details.
 
14
 
 
15
 *      You should have received a copy of the GNU General Public License
 
16
 *      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
*/
 
18
// -*- C++ -*- generated by wxGlade 0.6.3 on Sun Jun 24 00:03:00 2012
 
19
 
 
20
#include "filterErrorDialog.h"
 
21
#include "wxcommon.h"
 
22
#include "common/translation.h"
 
23
//Art for buttons
 
24
#include <wx/artprov.h>
 
25
// begin wxGlade: ::extracode
 
26
// end wxGlade
 
27
 
 
28
using std::string;
 
29
 
 
30
 
 
31
FilterErrorDialog::FilterErrorDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
 
32
    wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
 
33
{
 
34
    // begin wxGlade: FilterErrorDialog::FilterErrorDialog
 
35
    textErrorMessage = new wxTextCtrl(this, wxID_ANY, wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY);
 
36
    bitmapError = new wxStaticBitmap(this, wxID_ANY, wxArtProvider::GetBitmap(wxART_ERROR));
 
37
    labelError = new wxStaticText(this, wxID_ANY, wxTRANS("Error"));
 
38
    bitmapWarning = new wxStaticBitmap(this, wxID_ANY,wxArtProvider::GetBitmap(wxART_WARNING));
 
39
    labelWarning = new wxStaticText(this, wxID_ANY, wxTRANS("Warning"));
 
40
    btnOK = new wxButton(this, wxID_OK, wxEmptyString);
 
41
 
 
42
    SetTitle(wxTRANS("Filter Errors"));
 
43
    set_properties();
 
44
    do_layout();
 
45
    // end wxGlade
 
46
}
 
47
 
 
48
 
 
49
void FilterErrorDialog::set_properties()
 
50
{
 
51
    // begin wxGlade: FilterErrorDialog::set_properties
 
52
    SetTitle(wxTRANS("Filter Errors"));
 
53
    SetSize(wxSize(551, 414));
 
54
    // end wxGlade
 
55
}
 
56
 
 
57
void FilterErrorDialog::SetText(const std::vector<string> &text)
 
58
{
 
59
        std::string bigMessage;
 
60
        for(unsigned int ui=0;ui<text.size();ui++)
 
61
        {
 
62
                bigMessage+= text[ui];
 
63
                if(ui<text.size()-1)
 
64
                      bigMessage+= "\n-------------------\n\n";
 
65
        }
 
66
 
 
67
        textErrorMessage->Clear();
 
68
        textErrorMessage->AppendText(wxStr(bigMessage));
 
69
}
 
70
 
 
71
void FilterErrorDialog::do_layout()
 
72
{
 
73
    // begin wxGlade: FilterErrorDialog::do_layout
 
74
    wxBoxSizer* sizerMain = new wxBoxSizer(wxVERTICAL);
 
75
    wxBoxSizer* sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
76
    wxBoxSizer* sizerKey = new wxBoxSizer(wxVERTICAL);
 
77
    wxBoxSizer* sizerWarn = new wxBoxSizer(wxHORIZONTAL);
 
78
    wxBoxSizer* sizerError = new wxBoxSizer(wxHORIZONTAL);
 
79
    sizerTop->Add(textErrorMessage, 4, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 6);
 
80
    sizerKey->Add(10, 10, 0, 0, 0);
 
81
    sizerError->Add(bitmapError, 0, 0, 0);
 
82
    sizerError->Add(labelError, 0, wxALIGN_CENTER_VERTICAL, 0);
 
83
    sizerKey->Add(sizerError, 0, wxTOP|wxEXPAND, 5);
 
84
    sizerWarn->Add(bitmapWarning, 0, 0, 0);
 
85
    sizerWarn->Add(labelWarning, 0, wxALIGN_CENTER_VERTICAL, 0);
 
86
    sizerKey->Add(sizerWarn, 0, wxTOP|wxEXPAND, 6);
 
87
    sizerKey->Add(20, 20, 0, 0, 0);
 
88
    sizerTop->Add(sizerKey, 1, wxEXPAND, 0);
 
89
    sizerMain->Add(sizerTop, 1, wxEXPAND, 0);
 
90
    sizerMain->Add(btnOK, 0, wxALL|wxALIGN_RIGHT, 5);
 
91
    SetSizer(sizerMain);
 
92
    Layout();
 
93
    // end wxGlade
 
94
}
 
95