Debian Codegraph @

git/gitLogDlg.cpp

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : gitLogDlg.cpp
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #include "gitLogDlg.h"
27 #include "windowattrmanager.h"
28
29 #ifndef __WXMSW__
30 #include "icons/icon_git.xpm"
31 #endif
32
33 GitLogDlg::GitLogDlg(wxWindow* parent, const wxString title)
34 : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
35 {
36 SetIcon(wxICON(icon_git));
37 m_editor = new wxTextCtrl(
38 this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_RICH2 | wxTE_READONLY);
39
40 wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
41 wxStdDialogButtonSizer* sizer_3 = CreateStdDialogButtonSizer(wxOK);
42 wxStaticBoxSizer* sizer_1 = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Log output"));
43 sizer_1->Add(m_editor, 1, wxALL | wxEXPAND, 5);
44 sizer->Add(sizer_1, 1, wxALL | wxEXPAND, 5);
45 sizer->Add(sizer_3, 0, wxALL | wxEXPAND, 5);
46 SetSizer(sizer);
47 sizer->Fit(this);
48 Layout();
49
50 SetSize(1024, 560);
51 SetName("GitLogDlg");
52 WindowAttrManager::Load(this);
53 }
54
55 GitLogDlg::~GitLogDlg() {}
56
57 void GitLogDlg::SetLog(const wxString& log)
58 {
59 wxFont font(10, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
60 wxTextAttr atr = m_editor->GetDefaultStyle();
61 atr.SetFont(font);
62 m_editor->SetDefaultStyle(atr);
63 m_editor->AppendText(log);
64 }