annotate src/ui_utils.cpp @ 1:1ae666fdf9e2

*: initial commit
author Paper <mrpapersonic@gmail.com>
date Tue, 08 Aug 2023 19:49:15 -0400
parents
children 23d0d9319a00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "window.h"
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include "ui_utils.h"
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 void UiUtils::CreateTextHeader(wxWindow* parent, const wchar_t* title, int width, int x, int y) {
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 wxStaticText* static_text_title = new wxStaticText(parent, wxID_ANY, title, wxPoint(x, y), wxSize(width, 15), wxALIGN_LEFT);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 wxFont font = static_text_title->GetFont();
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 font.SetWeight(wxFONTWEIGHT_BOLD);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 static_text_title->SetFont(font);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9 //wxStaticLine* line = new wxStaticLine(parent, wxID_ANY, wxPoint(x,y+15), wxSize(width, 2), wxLI_HORIZONTAL);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 wxClientDC dc(parent);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 dc.DrawRectangle(x, y+15, width, 2);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 }
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 wxStaticText* UiUtils::CreateTextParagraph(wxWindow* parent, const wchar_t* title, const wchar_t* data, int width, int height, int x, int y) {
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 CreateTextHeader(parent, title, width, x, y);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 return new wxStaticText(parent, wxID_ANY, data, wxPoint(x+23, y+30), wxSize(width-23, height), wxALIGN_LEFT);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 }
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 wxStaticText* UiUtils::CreateTextParagraphWithLabels(wxWindow* parent, const wchar_t* title, const wchar_t* label, const wchar_t* data, int width, int height, int x, int y) {
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 CreateTextHeader(parent, title, width, x, y);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 new wxStaticText(parent, wxID_ANY, label, wxPoint(x+23, y+30), wxSize(width-23, height), wxALIGN_LEFT);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 return new wxStaticText(parent, wxID_ANY, data, wxPoint(x+157, y+30), wxSize(width-157, height), wxALIGN_LEFT);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 }
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 /* As far as I can tell, this is identical to the way Taiga implements it.
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26 Kind of cool, I didn't even look into the source code for it :p */
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 wxTextCtrl* UiUtils::CreateSelectableTextParagraph(wxWindow* parent, const wchar_t* title, const wchar_t* data, int width, int height, int x, int y) {
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 CreateTextHeader(parent, title, width, x, y);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29 wxTextCtrl* textctrl = new wxTextCtrl(parent, wxID_ANY, "", wxPoint(x+23, y+30), wxSize(width-23, height), wxTE_LEFT | wxBORDER_NONE | wxTE_BESTWRAP | wxTE_READONLY | wxTE_MULTILINE | wxTE_NO_VSCROLL);
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30 (*textctrl) << data;
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
31 return textctrl;
1ae666fdf9e2 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32 }