-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUITheme.cs
More file actions
394 lines (350 loc) · 18 KB
/
Copy pathUITheme.cs
File metadata and controls
394 lines (350 loc) · 18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
using System;
using System.Drawing;
using System.Windows.Forms;
namespace AutisAnalytics.NavisworksAtributos
{
/// <summary>
/// Adaptação WinForms do Autis 4D Design System v2.
/// Light-first, cobalt com parcimônia, cool slate, bordas de 1 px e
/// tipografia IBM Plex com fallback seguro para instalações offline.
/// </summary>
public static class UITheme
{
// ═══════════════════════════════════════════════════════════════════════════
// PALETA DE CORES — Semântica clara
// ═══════════════════════════════════════════════════════════════════════════
public static class Color
{
// Fundos
public static readonly System.Drawing.Color Background = System.Drawing.Color.FromArgb(244, 246, 249); // slate-50
public static readonly System.Drawing.Color BackgroundSecondary = System.Drawing.Color.FromArgb(236, 239, 244); // slate-100
public static readonly System.Drawing.Color Surface = System.Drawing.Color.White;
public static readonly System.Drawing.Color SurfaceHover = System.Drawing.Color.FromArgb(244, 246, 249);
public static readonly System.Drawing.Color SurfaceInverse = System.Drawing.Color.FromArgb(22, 28, 36);
// Brand / ação — cobalt do Autis 4D
public static readonly System.Drawing.Color Brand = System.Drawing.Color.FromArgb(49, 88, 255); // cobalt-500
public static readonly System.Drawing.Color Primary = System.Drawing.Color.FromArgb(31, 67, 235); // cobalt-600
public static readonly System.Drawing.Color PrimaryHover = System.Drawing.Color.FromArgb(24, 51, 194); // cobalt-700
public static readonly System.Drawing.Color PrimaryActive = System.Drawing.Color.FromArgb(26, 47, 155); // cobalt-800
public static readonly System.Drawing.Color PrimaryLight = System.Drawing.Color.FromArgb(94, 128, 255); // cobalt-400
public static readonly System.Drawing.Color PrimaryVeryLight = System.Drawing.Color.FromArgb(238, 243, 255); // cobalt-50
public static readonly System.Drawing.Color Secondary = System.Drawing.Color.FromArgb(125, 28, 203); // violet-600
// Status AWP
public static readonly System.Drawing.Color Success = System.Drawing.Color.FromArgb(15, 138, 76); // green-600
public static readonly System.Drawing.Color SuccessHover = System.Drawing.Color.FromArgb(11, 110, 61); // green-700
public static readonly System.Drawing.Color SuccessLight = System.Drawing.Color.FromArgb(233, 248, 239); // green-50
public static readonly System.Drawing.Color Warning = System.Drawing.Color.FromArgb(196, 115, 10); // amber-600
public static readonly System.Drawing.Color WarningLight = System.Drawing.Color.FromArgb(254, 246, 231); // amber-50
public static readonly System.Drawing.Color Error = System.Drawing.Color.FromArgb(193, 38, 38); // red-600
public static readonly System.Drawing.Color ErrorHover = System.Drawing.Color.FromArgb(156, 28, 28); // red-700
public static readonly System.Drawing.Color ErrorLight = System.Drawing.Color.FromArgb(253, 236, 236); // red-50
public static readonly System.Drawing.Color TextPrimary = System.Drawing.Color.FromArgb(22, 28, 36); // slate-900
public static readonly System.Drawing.Color TextSecondary = System.Drawing.Color.FromArgb(77, 86, 102); // slate-600
public static readonly System.Drawing.Color TextTertiary = System.Drawing.Color.FromArgb(107, 117, 135); // slate-500
public static readonly System.Drawing.Color TextDisabled = System.Drawing.Color.FromArgb(154, 164, 180); // slate-400
public static readonly System.Drawing.Color BorderLight = System.Drawing.Color.FromArgb(221, 226, 234); // slate-200
public static readonly System.Drawing.Color BorderMedium = System.Drawing.Color.FromArgb(197, 205, 217); // slate-300
public static readonly System.Drawing.Color BorderDark = System.Drawing.Color.FromArgb(154, 164, 180); // slate-400
// Especiais
public static readonly System.Drawing.Color Divider = BorderLight;
public static readonly System.Drawing.Color InfoBg = PrimaryVeryLight;
public static readonly System.Drawing.Color InfoText = System.Drawing.Color.FromArgb(24, 51, 194);
}
// ═══════════════════════════════════════════════════════════════════════════
// TIPOGRAFIA — Hierarquia clara
// ═══════════════════════════════════════════════════════════════════════════
public static class Typography
{
private const string FontFamily = "IBM Plex Sans";
private const string DataFontFamily = "IBM Plex Mono";
// Display — Títulos grandes (relativamente raro)
public static readonly Font Display = CreateFont(FontFamily, 21f, FontStyle.Bold);
// Heading 1 — Títulos principais
public static readonly Font H1 = CreateFont(FontFamily, 16.5f, FontStyle.Bold);
// Heading 2 — Subtítulos
public static readonly Font H2 = CreateFont(FontFamily, 13.5f, FontStyle.Bold);
// Heading 3 — Section headers
public static readonly Font H3 = CreateFont(FontFamily, 11.5f, FontStyle.Bold);
// Body Large — Texto corpo principal
public static readonly Font BodyLarge = CreateFont(FontFamily, 11f, FontStyle.Regular);
// Body Regular — Padrão
public static readonly Font Body = CreateFont(FontFamily, 10f, FontStyle.Regular);
// Body Small — Informação secundária
public static readonly Font BodySmall = CreateFont(FontFamily, 9f, FontStyle.Regular);
// Label — Rótulos de campo
public static readonly Font Label = CreateFont(FontFamily, 9.5f, FontStyle.Bold);
// Monospace — Para código/IDs
public static readonly Font Monospace = CreateFont(DataFontFamily, 9.5f, FontStyle.Regular, "Consolas");
public static readonly Font MonospaceBold = CreateFont(DataFontFamily, 10f, FontStyle.Bold, "Consolas");
private static Font CreateFont(string family, float size, FontStyle style, string fallback = "Segoe UI")
{
var font = new Font(family, size, style, GraphicsUnit.Point);
if (string.Equals(font.Name, family, StringComparison.OrdinalIgnoreCase)) return font;
font.Dispose();
return new Font(fallback, size, style, GraphicsUnit.Point);
}
}
// ═══════════════════════════════════════════════════════════════════════════
// ESPAÇAMENTO — Grid 8px (design system padrão)
// ═══════════════════════════════════════════════════════════════════════════
public static class Spacing
{
public const int XS = 4; // 4px
public const int SM = 8; // 8px
public const int MD = 12; // 12px
public const int LG = 16; // 16px
public const int XL = 24; // 24px
public const int XXL = 32; // 32px
}
// ═══════════════════════════════════════════════════════════════════════════
// SOMBRAS — Elevation (depth)
// ═══════════════════════════════════════════════════════════════════════════
public static class Elevation
{
public const int None = 0;
public const int Level1 = 1; // Subtle shadow
public const int Level2 = 2; // Hover state
public const int Level3 = 4; // Modal/Dialog
}
// ═══════════════════════════════════════════════════════════════════════════
// COMPONENTES REUTILIZÁVEIS
// ═══════════════════════════════════════════════════════════════════════════
/// <summary>
/// Cria um botão PRIMÁRIO com estilo moderno
/// Uso: Ações principais (Salvar, Ativar, Enviar)
/// </summary>
public static Button CreatePrimaryButton(string text)
{
var btn = new Button
{
Text = text,
Font = Typography.Label,
ForeColor = System.Drawing.Color.White,
BackColor = Color.Primary,
FlatStyle = FlatStyle.Flat,
Height = 34,
AutoSize = false,
Cursor = Cursors.Hand,
TextAlign = ContentAlignment.MiddleCenter
};
btn.FlatAppearance.BorderSize = 0;
btn.MouseEnter += (s, e) => btn.BackColor = Color.PrimaryHover;
btn.MouseLeave += (s, e) => btn.BackColor = Color.Primary;
return btn;
}
/// <summary>
/// Cria um botão SECUNDÁRIO com estilo moderno
/// Uso: Ações secundárias (Cancelar, Limpar, Fechar)
/// </summary>
public static Button CreateSecondaryButton(string text)
{
var btn = new Button
{
Text = text,
Font = Typography.Label,
ForeColor = Color.TextPrimary,
BackColor = Color.Surface,
FlatStyle = FlatStyle.Flat,
Height = 34,
AutoSize = false,
Cursor = Cursors.Hand,
TextAlign = ContentAlignment.MiddleCenter
};
btn.FlatAppearance.BorderSize = 1;
btn.FlatAppearance.BorderColor = Color.BorderMedium;
btn.MouseEnter += (s, e) =>
{
btn.BackColor = Color.SurfaceHover;
btn.FlatAppearance.BorderColor = Color.Primary;
};
btn.MouseLeave += (s, e) =>
{
btn.BackColor = Color.Surface;
btn.FlatAppearance.BorderColor = Color.BorderMedium;
};
return btn;
}
/// <summary>
/// Cria um botão SUCESSO com estilo moderno
/// Uso: Ações de confirmação (Gravar, Ativar, Confirmar)
/// </summary>
public static Button CreateSuccessButton(string text)
{
var btn = new Button
{
Text = text,
Font = Typography.Label,
ForeColor = System.Drawing.Color.White,
BackColor = Color.Success,
FlatStyle = FlatStyle.Flat,
Height = 34,
AutoSize = false,
Cursor = Cursors.Hand,
TextAlign = ContentAlignment.MiddleCenter
};
btn.FlatAppearance.BorderSize = 0;
btn.MouseEnter += (s, e) => btn.BackColor = Color.SuccessHover;
btn.MouseLeave += (s, e) => btn.BackColor = Color.Success;
return btn;
}
/// <summary>
/// Aplica a identidade do produto à janela nativa.
/// </summary>
public static void ApplyForm(Form form, string screenTitle)
{
if (form == null) return;
form.Text = string.IsNullOrWhiteSpace(screenTitle)
? "Autis 4D"
: "Autis 4D — " + screenTitle;
form.Icon = AutisBrand.ApplicationIcon;
form.BackColor = Color.Background;
form.Font = Typography.Body;
}
/// <summary>
/// Cria o cabeçalho oficial com marca, título, subtítulo e divisor.
/// </summary>
public static Panel CreateHeader(string title, string subtitle = "")
{
return new AutisHeaderPanel(title, subtitle);
}
/// <summary>
/// Cria um painel de FOOTER com info e botões
/// </summary>
public static Panel CreateFooter()
{
var panel = new Panel
{
BackColor = Color.Surface,
Height = 52,
Dock = DockStyle.Bottom
};
panel.Paint += (s, e) =>
{
e.Graphics.DrawLine(
new Pen(Color.BorderLight),
new Point(0, 0),
new Point(panel.Width, 0)
);
};
return panel;
}
/// <summary>
/// Cria um painel "CARD" com borda sutil
/// </summary>
public static Panel CreateCard()
{
var panel = new Panel
{
BackColor = Color.Surface
};
panel.Paint += (s, e) =>
{
using (var pen = new Pen(Color.BorderLight, 1))
{
e.Graphics.DrawRectangle(pen, 0, 0, panel.Width - 1, panel.Height - 1);
}
};
return panel;
}
/// <summary>
/// Cria um label informativo com ícone e cor
/// </summary>
public static Label CreateInfoLabel(string text)
{
return new Label
{
Text = text,
Font = Typography.BodySmall,
ForeColor = Color.InfoText,
AutoSize = true,
BackColor = System.Drawing.Color.Transparent
};
}
/// <summary>
/// Cria um label de erro com ícone
/// </summary>
public static Label CreateErrorLabel(string text)
{
return new Label
{
Text = "⚠ " + text,
Font = Typography.BodySmall,
ForeColor = Color.Error,
AutoSize = true,
BackColor = System.Drawing.Color.Transparent
};
}
/// <summary>
/// Cria um label de sucesso
/// </summary>
public static Label CreateSuccessLabel(string text)
{
return new Label
{
Text = "✓ " + text,
Font = Typography.BodySmall,
ForeColor = Color.Success,
AutoSize = true,
BackColor = System.Drawing.Color.Transparent
};
}
/// <summary>
/// Cria um separador visual (linha)
/// </summary>
public static Panel CreateDivider()
{
var divider = new Panel
{
Height = 1,
BackColor = Color.Divider,
Dock = DockStyle.Top
};
return divider;
}
/// <summary>
/// Estilizar um TextBox com design moderno
/// </summary>
public static void StyleTextBox(TextBox textBox)
{
textBox.Font = Typography.Body;
textBox.BorderStyle = BorderStyle.FixedSingle;
textBox.ForeColor = Color.TextPrimary;
textBox.BackColor = Color.Surface;
textBox.Height = 32;
}
/// <summary>
/// Estilizar um DataGridView com design moderno
/// </summary>
public static void StyleDataGridView(DataGridView grid)
{
grid.Font = Typography.Body;
grid.BackgroundColor = Color.Background;
grid.GridColor = Color.BorderLight;
grid.ColumnHeadersDefaultCellStyle.BackColor = Color.BackgroundSecondary;
grid.ColumnHeadersDefaultCellStyle.ForeColor = Color.TextPrimary;
grid.ColumnHeadersDefaultCellStyle.Font = Typography.Label;
grid.ColumnHeadersDefaultCellStyle.SelectionBackColor = Color.BackgroundSecondary;
grid.ColumnHeadersDefaultCellStyle.SelectionForeColor = Color.TextPrimary;
grid.DefaultCellStyle.BackColor = Color.Surface;
grid.DefaultCellStyle.ForeColor = Color.TextPrimary;
grid.DefaultCellStyle.SelectionBackColor = Color.Primary;
grid.DefaultCellStyle.SelectionForeColor = System.Drawing.Color.White;
grid.AlternatingRowsDefaultCellStyle.BackColor = Color.SurfaceHover;
grid.AllowUserToAddRows = false;
grid.AllowUserToDeleteRows = false;
}
/// <summary>
/// Estilizar um ListView com design moderno
/// </summary>
public static void StyleListView(ListView listView)
{
listView.Font = Typography.Body;
listView.BackColor = Color.Surface;
listView.ForeColor = Color.TextPrimary;
listView.View = View.Details;
listView.FullRowSelect = true;
listView.GridLines = false;
listView.BorderStyle = BorderStyle.FixedSingle;
}
}
}