ui/winui/icons.cpp

Sun, 10 Nov 2024 15:30:46 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 10 Nov 2024 15:30:46 +0100
changeset 76
641dcc79e0ef
parent 0
2483f517c562
permissions
-rw-r--r--

update toolkit

0
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2017 Olaf Wintermann. All rights reserved.
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #include "pch.h"
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 #include "icons.h"
76
641dcc79e0ef update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
32 #include "../ui/icons.h"
0
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 #include <stdlib.h>
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 #include <string.h>
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 #include "util.h"
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 #include <Windows.h>
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 #include <Shellapi.h>
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 using namespace winrt;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 using namespace Microsoft::UI::Xaml;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 using namespace Microsoft::UI::Xaml::Controls;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 using namespace Windows::UI::Xaml::Interop;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 using namespace winrt::Windows::Foundation;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 using namespace winrt::Microsoft::UI::Xaml::Controls::Primitives;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 using namespace winrt::Microsoft::UI::Xaml::Media::Imaging;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 //using namespace Windows::Storage::Streams;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 static UiIcon* sys_folder_icon16;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 static UiIcon* sys_file_icon16;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 static UiIcon* sys_folder_icon32;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 static UiIcon* sys_file_icon32;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 std::unordered_map<std::string, Symbol> ui_symbol_icons = {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 {"Accept", Symbol::Accept },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 {"Account", Symbol::Account },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 {"Add", Symbol::Add },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 {"AddFriend", Symbol::AddFriend },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 {"Admin", Symbol::Admin },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 {"AlignCenter", Symbol::AlignCenter },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 {"AlignLeft", Symbol::AlignLeft },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 {"AlignRight", Symbol::AlignRight },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 {"AllApps", Symbol::AllApps },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 {"Attach", Symbol::Attach },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 {"AttachCamera", Symbol::AttachCamera },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 {"Audio", Symbol::Audio },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 {"Back", Symbol::Back },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 {"BackToWindow", Symbol::BackToWindow },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 {"BlockContact", Symbol::BlockContact },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 {"Bold", Symbol::Bold },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 {"Bookmarks", Symbol::Bookmarks },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 {"BrowsePhotos", Symbol::BrowsePhotos },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 {"Bullets", Symbol::Bullets },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 {"Calculator", Symbol::Calculator },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 {"Calendar", Symbol::Calendar },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 {"CalendarDay", Symbol::CalendarDay },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 {"CalendarReply", Symbol::CalendarReply },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 {"CalendarWeek", Symbol::CalendarWeek },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 {"Camera", Symbol::Camera },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84 {"Cancel", Symbol::Cancel },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 {"Caption", Symbol::Caption },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 {"CellPhone", Symbol::CellPhone },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87 {"Character", Symbol::Character },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 {"Clear", Symbol::Clear },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 {"ClearSelection", Symbol::ClearSelection },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 {"Clock", Symbol::Clock },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 {"ClosedCaption", Symbol::ClosedCaption },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 {"ClosePane", Symbol::ClosePane },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93 {"Comment", Symbol::Comment },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94 {"Contact", Symbol::Contact },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 {"Contact2", Symbol::Contact2 },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96 {"ContactInfo", Symbol::ContactInfo },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 {"ContactPresence", Symbol::ContactPresence },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 {"Copy", Symbol::Copy },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 {"Crop", Symbol::Crop },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100 {"Cut", Symbol::Cut },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 {"Delete", Symbol::Delete },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 {"Directions", Symbol::Directions },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 {"DisableUpdates", Symbol::DisableUpdates },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 {"DisconnectDrive", Symbol::DisconnectDrive },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105 {"Dislike", Symbol::Dislike },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106 {"DockBottom", Symbol::DockBottom },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 {"DockLeft", Symbol::DockLeft },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 {"DockRight", Symbol::DockRight },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 {"Document", Symbol::Document },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110 {"Download", Symbol::Download },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111 {"Edit", Symbol::Edit },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112 {"Emoji", Symbol::Emoji },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 {"Emoji2", Symbol::Emoji2 },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 {"Favorite", Symbol::Favorite },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 {"Filter", Symbol::Filter },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 {"Find", Symbol::Find },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117 {"Flag", Symbol::Flag },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118 {"Folder", Symbol::Folder },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119 {"Font", Symbol::Font },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120 {"FontColor", Symbol::FontColor },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121 {"FontDecrease", Symbol::FontDecrease },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 {"FontIncrease", Symbol::FontIncrease },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 {"FontSize", Symbol::FontSize },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 {"Forward", Symbol::Forward },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 {"FourBars", Symbol::FourBars },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 {"FullScreen", Symbol::FullScreen },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 {"GlobalNavigationButton", Symbol::GlobalNavigationButton },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 {"Globe", Symbol::Globe },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129 {"Go", Symbol::Go },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130 {"GoToStart", Symbol::GoToStart },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131 {"GoToToday", Symbol::GoToToday },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 {"HangUp", Symbol::HangUp },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133 {"Help", Symbol::Help },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134 {"HideBcc", Symbol::HideBcc },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135 {"Highlight", Symbol::Highlight },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 {"Home", Symbol::Home },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137 {"Import", Symbol::Import },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138 {"ImportAll", Symbol::ImportAll },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139 {"Important", Symbol::Important },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140 {"Italic", Symbol::Italic },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 {"Keyboard", Symbol::Keyboard },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 {"LeaveChat", Symbol::LeaveChat },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 {"Library", Symbol::Library },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144 {"Like", Symbol::Like },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145 {"LikeDislike", Symbol::LikeDislike },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146 {"Link", Symbol::Link },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 {"List", Symbol::List },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 {"Mail", Symbol::Mail },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 {"MailFilled", Symbol::MailFilled },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150 {"MailForward", Symbol::MailForward },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151 {"MailReply", Symbol::MailReply },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152 {"MailReplyAll", Symbol::MailReplyAll },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153 {"Manage", Symbol::Manage },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 {"Map", Symbol::Map },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 {"MapDrive", Symbol::MapDrive },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
156 {"MapPin", Symbol::MapPin },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 {"Memo", Symbol::Memo },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158 {"Message", Symbol::Message },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159 {"Microphone", Symbol::Microphone },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160 {"More", Symbol::More },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 {"MoveToFolder", Symbol::MoveToFolder },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 {"MusicInfo", Symbol::MusicInfo },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163 {"Mute", Symbol::Mute },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 {"NewFolder", Symbol::NewFolder },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 {"NewWindow", Symbol::NewWindow },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 {"Next", Symbol::Next },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 {"OneBar", Symbol::OneBar },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168 {"OpenFile", Symbol::OpenFile },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169 {"OpenLocal", Symbol::OpenLocal },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 {"OpenPane", Symbol::OpenPane },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171 {"OpenWith", Symbol::OpenWith },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172 {"Orientation", Symbol::Orientation },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
173 {"OtherUser", Symbol::OtherUser },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 {"OutlineStar", Symbol::OutlineStar },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175 {"Page", Symbol::Page },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176 {"Page2", Symbol::Page2 },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177 {"Paste", Symbol::Paste },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178 {"Pause", Symbol::Pause },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179 {"People", Symbol::People },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180 {"Permissions", Symbol::Permissions },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 {"Phone", Symbol::Phone },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182 {"PhoneBook", Symbol::PhoneBook },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183 {"Pictures", Symbol::Pictures },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 {"Pin", Symbol::Pin },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 {"Placeholder", Symbol::Placeholder },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 {"Play", Symbol::Play },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187 {"PostUpdate", Symbol::PostUpdate },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
188 {"Preview", Symbol::Preview },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 {"PreviewLink", Symbol::PreviewLink },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190 {"Previous", Symbol::Previous },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191 {"Print", Symbol::Print },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 {"Priority", Symbol::Priority },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193 {"ProtectedDocument", Symbol::ProtectedDocument },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
194 {"Read", Symbol::Read },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
195 {"Redo", Symbol::Redo },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
196 {"Refresh", Symbol::Refresh },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
197 {"Remote", Symbol::Remote },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
198 {"Remove", Symbol::Remove },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
199 {"Rename", Symbol::Rename },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
200 {"Repair", Symbol::Repair },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
201 {"RepeatAll", Symbol::RepeatAll },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202 {"RepeatOne", Symbol::RepeatOne },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
203 {"ReportHacked", Symbol::ReportHacked },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204 {"ReShare", Symbol::ReShare },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 {"Rotate", Symbol::Rotate },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206 {"RotateCamera", Symbol::RotateCamera },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
207 {"Save", Symbol::Save },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
208 {"SaveLocal", Symbol::SaveLocal },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209 {"Scan", Symbol::Scan },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
210 {"SelectAll", Symbol::SelectAll },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
211 {"Send", Symbol::Send },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
212 {"SetLockScreen", Symbol::SetLockScreen },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
213 {"SetTile", Symbol::SetTile },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214 {"Setting", Symbol::Setting },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215 {"Share", Symbol::Share },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
216 {"Shop", Symbol::Shop },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
217 {"ShowBcc", Symbol::ShowBcc },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
218 {"ShowResults", Symbol::ShowResults },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
219 {"Shuffle", Symbol::Shuffle },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
220 {"SlideShow", Symbol::SlideShow },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
221 {"SolidStar", Symbol::SolidStar },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
222 {"Sort", Symbol::Sort },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
223 {"Stop", Symbol::Stop },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
224 {"StopSlideShow", Symbol::StopSlideShow },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
225 {"Street", Symbol::Street },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
226 {"Switch", Symbol::Switch },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
227 {"SwitchApps", Symbol::SwitchApps },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
228 {"Sync", Symbol::Sync },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
229 {"SyncFolder", Symbol::SyncFolder },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
230 {"Tag", Symbol::Tag },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
231 {"Target", Symbol::Target },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
232 {"ThreeBars", Symbol::ThreeBars },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
233 {"TouchPointer", Symbol::TouchPointer },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
234 {"Trim", Symbol::Trim },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
235 {"TwoBars", Symbol::TwoBars },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
236 {"TwoPage", Symbol::TwoPage },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
237 {"Underline", Symbol::Underline },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
238 {"Undo", Symbol::Undo },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
239 {"UnFavorite", Symbol::UnFavorite },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
240 {"UnPin", Symbol::UnPin },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241 {"UnSyncFolder", Symbol::UnSyncFolder },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
242 {"Up", Symbol::Up },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243 {"Upload", Symbol::Upload },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
244 {"Video", Symbol::Video },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
245 {"VideoChat", Symbol::VideoChat },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
246 {"View", Symbol::View },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
247 {"ViewAll", Symbol::ViewAll },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
248 {"Volume", Symbol::Volume },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
249 {"WebCam", Symbol::WebCam },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
250 {"World", Symbol::World },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
251 {"XboxOneConsole", Symbol::XboxOneConsole },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
252 {"ZeroBars", Symbol::ZeroBars },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
253 {"Zoom", Symbol::Zoom },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
254 {"ZoomIn", Symbol::ZoomIn },
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
255 {"ZoomOut", Symbol::ZoomOut }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
256 };
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
257
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
258 winrt::Microsoft::UI::Xaml::Controls::IconElement ui_get_icon(const char* name) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
259 if (ui_symbol_icons.find(name) == ui_symbol_icons.end()) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
260 SymbolIcon no_icon = { nullptr };
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
261 return no_icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
262 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
263
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
264 Symbol symbol = ui_symbol_icons[name];
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
265 SymbolIcon icon = SymbolIcon(symbol);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
266 return icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
267 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
268
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
269
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
270 // symbol icon implementation
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
271 UiSymbolIcon::UiSymbolIcon(winrt::Microsoft::UI::Xaml::Controls::Symbol sym) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
272 symbol = sym;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
273 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
274
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
275 UiSymbolIcon::~UiSymbolIcon() {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
276
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
277 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
278
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
279 winrt::Microsoft::UI::Xaml::Controls::IconElement UiSymbolIcon::getIcon() {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
280 return SymbolIcon(symbol);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
281 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
282
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
283 // image icon implementation
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
284 UiImageIcon::UiImageIcon(const char* uristr) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
285 wchar_t* wuri = str2wstr(uristr, nullptr);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
286 Windows::Foundation::Uri uri{ wuri };
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
287 this->uri = uri;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
288 free(wuri);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
289 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
290
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
291 UiImageIcon::~UiImageIcon() {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
292
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
293 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
294
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
295 winrt::Microsoft::UI::Xaml::Controls::IconElement UiImageIcon::getIcon() {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
296 BitmapIcon icon = BitmapIcon();
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
297 icon.UriSource(uri);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
298 ImageIcon img = ImageIcon();
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
299 img.Source();
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
300 return icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
301 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
302
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
303 // bitmap icon implementation
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
304 UiBitmapIcon::UiBitmapIcon(winrt::Microsoft::UI::Xaml::Media::Imaging::BitmapSource bitmap) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
305 this->bitmap = bitmap;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
306 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
307
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
308 UiBitmapIcon::~UiBitmapIcon() {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
309
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
310 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
311
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
312 winrt::Microsoft::UI::Xaml::Controls::IconElement UiBitmapIcon::getIcon() {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
313 ImageIcon icon = ImageIcon();
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
314 icon.Source(bitmap);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
315 return icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
316 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
317
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
318 UIEXPORT UiIcon* ui_icon(const char* name, size_t size) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
319 Symbol symbol = ui_symbol_icons[name];
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
320 UiSymbolIcon* icon = new UiSymbolIcon(symbol);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
321 return icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
322 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
323
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
324
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
325 UIEXPORT UiIcon* ui_imageicon(const char* file) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
326 return new UiImageIcon(file);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
327 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
328
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
329 UIEXPORT void ui_icon_free(UiIcon* icon) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
330 delete icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
331 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
332
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
333
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
334 struct __declspec(uuid("905a0fef-bc53-11df-8c49-001e4fc686da")) IBufferByteAccess : ::IUnknown
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
335 {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
336 virtual HRESULT __stdcall Buffer(uint8_t** value) = 0;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
337 };
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
338
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
339
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
340
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
341 winrt::Microsoft::UI::Xaml::Media::Imaging::WriteableBitmap ui_dllicon2bitmap(const char* dll, int iconindex, bool large) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
342 WriteableBitmap wbitmap = { nullptr };
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
343
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
344 // get the icon from the dll
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
345 HICON hicon_small;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
346 HICON hicon_large;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
347 if (ExtractIconExA(dll, iconindex, &hicon_large, &hicon_small, 1) > 0) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
348 HICON hicon = large ? hicon_large : hicon_small;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
349
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
350 // convert icon to (gdi) bitmap
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
351 ICONINFO info;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
352 info.hbmColor = nullptr;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
353 info.hbmMask = nullptr;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
354 if (GetIconInfo(hicon, &info)) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
355 BITMAP bitmap;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
356 if (GetObjectW(info.hbmColor, sizeof(BITMAP), &bitmap) != 0) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
357 size_t bitmap_size = bitmap.bmWidthBytes * bitmap.bmHeight;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
358 char *bitmap_data = (char*)malloc(bitmap_size);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
359
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
360 // get the pixel data
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
361 if (GetBitmapBits(info.hbmColor, bitmap_size, bitmap_data) != 0) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
362 WriteableBitmap wb = WriteableBitmap(bitmap.bmWidth, bitmap.bmHeight);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
363 void *wb_data = wb.PixelBuffer().data();
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
364 memcpy(wb_data, bitmap_data, bitmap_size);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
365 wbitmap = wb;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
366 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
367 free(bitmap_data);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
368 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
369 if (info.hbmMask) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
370 DeleteObject(info.hbmMask);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
371 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
372 if (info.hbmColor) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
373 DeleteObject(info.hbmColor);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
374 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
375 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
376
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
377 DestroyIcon(hicon_small);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
378 DestroyIcon(hicon_large);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
379 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
380
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
381 return wbitmap;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
382 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
383
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
384 UiIcon* ui_dllicon(const char* dll, int iconindex, bool large) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
385 WriteableBitmap wbitmap = ui_dllicon2bitmap(dll, iconindex, large);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
386 return new UiBitmapIcon(wbitmap);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
387 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
388
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
389 UIEXPORT UiIcon* ui_foldericon(size_t size) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
390 bool large = true;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
391 UiIcon** sys_folder_icon = &sys_folder_icon32;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
392 if (size <= 24) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
393 large = false;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
394 sys_folder_icon = &sys_folder_icon16;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
395 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
396
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
397 if (*sys_folder_icon) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
398 return *sys_folder_icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
399 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
400
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
401 UiIcon* icon = ui_dllicon("shell32.dll", 3, large);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
402 *sys_folder_icon = icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
403 return icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
404 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
405
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
406 UIEXPORT UiIcon* ui_fileicon(size_t size) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
407 bool large = true;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
408 UiIcon** sys_folder_icon = &sys_file_icon32;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
409 if (size <= 24) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
410 large = false;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
411 sys_folder_icon = &sys_file_icon16;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
412 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
413
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
414 if (*sys_folder_icon) {
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
415 return *sys_folder_icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
416 }
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
417
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
418 UiIcon* icon = ui_dllicon("shell32.dll", 0, large);
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
419 *sys_folder_icon = icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
420 return icon;
2483f517c562 add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
421 }

mercurial