2#include "nuklear_internal.h"
9NK_API
void nk_style_default(
struct nk_context *ctx){nk_style_from_table(ctx, 0);}
10#define NK_COLOR_MAP(NK_COLOR)\
11 NK_COLOR(NK_COLOR_TEXT, 175,175,175,255) \
12 NK_COLOR(NK_COLOR_WINDOW, 45, 45, 45, 255) \
13 NK_COLOR(NK_COLOR_HEADER, 40, 40, 40, 255) \
14 NK_COLOR(NK_COLOR_BORDER, 65, 65, 65, 255) \
15 NK_COLOR(NK_COLOR_BUTTON, 50, 50, 50, 255) \
16 NK_COLOR(NK_COLOR_BUTTON_HOVER, 40, 40, 40, 255) \
17 NK_COLOR(NK_COLOR_BUTTON_ACTIVE, 35, 35, 35, 255) \
18 NK_COLOR(NK_COLOR_TOGGLE, 100,100,100,255) \
19 NK_COLOR(NK_COLOR_TOGGLE_HOVER, 120,120,120,255) \
20 NK_COLOR(NK_COLOR_TOGGLE_CURSOR, 45, 45, 45, 255) \
21 NK_COLOR(NK_COLOR_SELECT, 45, 45, 45, 255) \
22 NK_COLOR(NK_COLOR_SELECT_ACTIVE, 35, 35, 35,255) \
23 NK_COLOR(NK_COLOR_SLIDER, 38, 38, 38, 255) \
24 NK_COLOR(NK_COLOR_SLIDER_CURSOR, 100,100,100,255) \
25 NK_COLOR(NK_COLOR_SLIDER_CURSOR_HOVER, 120,120,120,255) \
26 NK_COLOR(NK_COLOR_SLIDER_CURSOR_ACTIVE, 150,150,150,255) \
27 NK_COLOR(NK_COLOR_PROPERTY, 38, 38, 38, 255) \
28 NK_COLOR(NK_COLOR_EDIT, 38, 38, 38, 255) \
29 NK_COLOR(NK_COLOR_EDIT_CURSOR, 175,175,175,255) \
30 NK_COLOR(NK_COLOR_COMBO, 45, 45, 45, 255) \
31 NK_COLOR(NK_COLOR_CHART, 120,120,120,255) \
32 NK_COLOR(NK_COLOR_CHART_COLOR, 45, 45, 45, 255) \
33 NK_COLOR(NK_COLOR_CHART_COLOR_HIGHLIGHT, 255, 0, 0, 255) \
34 NK_COLOR(NK_COLOR_SCROLLBAR, 40, 40, 40, 255) \
35 NK_COLOR(NK_COLOR_SCROLLBAR_CURSOR, 100,100,100,255) \
36 NK_COLOR(NK_COLOR_SCROLLBAR_CURSOR_HOVER, 120,120,120,255) \
37 NK_COLOR(NK_COLOR_SCROLLBAR_CURSOR_ACTIVE, 150,150,150,255) \
38 NK_COLOR(NK_COLOR_TAB_HEADER, 40, 40, 40,255) \
39 NK_COLOR(NK_COLOR_KNOB, 38, 38, 38, 255) \
40 NK_COLOR(NK_COLOR_KNOB_CURSOR, 100,100,100,255) \
41 NK_COLOR(NK_COLOR_KNOB_CURSOR_HOVER, 120,120,120,255) \
42 NK_COLOR(NK_COLOR_KNOB_CURSOR_ACTIVE, 150,150,150,255)
45nk_default_color_style[NK_COLOR_COUNT] = {
46#define NK_COLOR(a,b,c,d,e) {b,c,d,e},
47 NK_COLOR_MAP(NK_COLOR)
50NK_GLOBAL
const char *nk_color_names[NK_COLOR_COUNT] = {
51#define NK_COLOR(a,b,c,d,e) #a,
52 NK_COLOR_MAP(NK_COLOR)
57nk_style_get_color_by_name(
enum nk_style_colors c)
59 return nk_color_names[c];
62nk_style_item_color(struct
nk_color col)
65 i.type = NK_STYLE_ITEM_COLOR;
70nk_style_item_image(struct
nk_image img)
73 i.type = NK_STYLE_ITEM_IMAGE;
81 i.type = NK_STYLE_ITEM_NINE_SLICE;
86nk_style_item_hide(void)
89 i.type = NK_STYLE_ITEM_COLOR;
90 i.data.color = nk_rgba(0,0,0,0);
116 table = (!table) ? nk_default_color_style: table;
120 text->color = table[NK_COLOR_TEXT];
122 text->color_factor = 1.0f;
123 text->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
127 nk_zero_struct(*link);
128 link->text_normal = table[NK_COLOR_TEXT];
129 link->text_hover = table[NK_COLOR_TEXT];
130 link->text_active = table[NK_COLOR_TEXT];
131 link->underline = NK_LINK_UNDERLINE_ALWAYS;
132 link->underline_thickness = 1.0f;
134 link->touch_padding =
nk_vec2(0,0);
135 link->color_factor = 1.0f;
136 link->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
139 button = &style->button;
140 nk_zero_struct(*button);
141 button->normal = nk_style_item_color(table[NK_COLOR_BUTTON]);
142 button->hover = nk_style_item_color(table[NK_COLOR_BUTTON_HOVER]);
143 button->active = nk_style_item_color(table[NK_COLOR_BUTTON_ACTIVE]);
144 button->border_color = table[NK_COLOR_BORDER];
145 button->text_background = table[NK_COLOR_BUTTON];
146 button->text_normal = table[NK_COLOR_TEXT];
147 button->text_hover = table[NK_COLOR_TEXT];
148 button->text_active = table[NK_COLOR_TEXT];
149 button->padding =
nk_vec2(2.0f,2.0f);
150 button->image_padding =
nk_vec2(0.0f,0.0f);
151 button->touch_padding =
nk_vec2(0.0f, 0.0f);
152 button->userdata = nk_handle_ptr(0);
153 button->text_alignment = NK_TEXT_CENTERED;
154 button->border = 1.0f;
155 button->rounding = 4.0f;
156 button->color_factor_text = 1.0f;
157 button->color_factor_background = 1.0f;
158 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
159 button->draw_begin = 0;
160 button->draw_end = 0;
163 button = &style->contextual_button;
164 nk_zero_struct(*button);
165 button->normal = nk_style_item_color(table[NK_COLOR_WINDOW]);
166 button->hover = nk_style_item_color(table[NK_COLOR_BUTTON_HOVER]);
167 button->active = nk_style_item_color(table[NK_COLOR_BUTTON_ACTIVE]);
168 button->border_color = table[NK_COLOR_WINDOW];
169 button->text_background = table[NK_COLOR_WINDOW];
170 button->text_normal = table[NK_COLOR_TEXT];
171 button->text_hover = table[NK_COLOR_TEXT];
172 button->text_active = table[NK_COLOR_TEXT];
173 button->padding =
nk_vec2(2.0f,2.0f);
174 button->touch_padding =
nk_vec2(0.0f,0.0f);
175 button->userdata = nk_handle_ptr(0);
176 button->text_alignment = NK_TEXT_CENTERED;
177 button->border = 0.0f;
178 button->rounding = 0.0f;
179 button->color_factor_text = 1.0f;
180 button->color_factor_background = 1.0f;
181 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
182 button->draw_begin = 0;
183 button->draw_end = 0;
186 button = &style->menu_button;
187 nk_zero_struct(*button);
188 button->normal = nk_style_item_color(table[NK_COLOR_WINDOW]);
189 button->hover = nk_style_item_color(table[NK_COLOR_WINDOW]);
190 button->active = nk_style_item_color(table[NK_COLOR_WINDOW]);
191 button->border_color = table[NK_COLOR_WINDOW];
192 button->text_background = table[NK_COLOR_WINDOW];
193 button->text_normal = table[NK_COLOR_TEXT];
194 button->text_hover = table[NK_COLOR_TEXT];
195 button->text_active = table[NK_COLOR_TEXT];
196 button->padding =
nk_vec2(2.0f,2.0f);
197 button->touch_padding =
nk_vec2(0.0f,0.0f);
198 button->userdata = nk_handle_ptr(0);
199 button->text_alignment = NK_TEXT_CENTERED;
200 button->border = 0.0f;
201 button->rounding = 1.0f;
202 button->color_factor_text = 1.0f;
203 button->color_factor_background = 1.0f;
204 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
205 button->draw_begin = 0;
206 button->draw_end = 0;
209 toggle = &style->checkbox;
210 nk_zero_struct(*toggle);
211 toggle->normal = nk_style_item_color(table[NK_COLOR_TOGGLE]);
212 toggle->hover = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
213 toggle->active = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
214 toggle->cursor_normal = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
215 toggle->cursor_hover = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
216 toggle->userdata = nk_handle_ptr(0);
217 toggle->text_background = table[NK_COLOR_WINDOW];
218 toggle->text_normal = table[NK_COLOR_TEXT];
219 toggle->text_hover = table[NK_COLOR_TEXT];
220 toggle->text_active = table[NK_COLOR_TEXT];
221 toggle->padding =
nk_vec2(2.0f, 2.0f);
222 toggle->touch_padding =
nk_vec2(0,0);
223 toggle->border_color = nk_rgba(0,0,0,0);
224 toggle->border = 0.0f;
226 toggle->color_factor = 1.0f;
227 toggle->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
230 toggle = &style->option;
231 nk_zero_struct(*toggle);
232 toggle->normal = nk_style_item_color(table[NK_COLOR_TOGGLE]);
233 toggle->hover = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
234 toggle->active = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
235 toggle->cursor_normal = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
236 toggle->cursor_hover = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
237 toggle->userdata = nk_handle_ptr(0);
238 toggle->text_background = table[NK_COLOR_WINDOW];
239 toggle->text_normal = table[NK_COLOR_TEXT];
240 toggle->text_hover = table[NK_COLOR_TEXT];
241 toggle->text_active = table[NK_COLOR_TEXT];
242 toggle->padding =
nk_vec2(3.0f, 3.0f);
243 toggle->touch_padding =
nk_vec2(0,0);
244 toggle->border_color = nk_rgba(0,0,0,0);
245 toggle->border = 0.0f;
247 toggle->color_factor = 1.0f;
248 toggle->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
251 select = &style->selectable;
252 nk_zero_struct(*select);
253 select->normal = nk_style_item_color(table[NK_COLOR_SELECT]);
254 select->hover = nk_style_item_color(table[NK_COLOR_SELECT]);
255 select->pressed = nk_style_item_color(table[NK_COLOR_SELECT]);
256 select->normal_active = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]);
257 select->hover_active = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]);
258 select->pressed_active = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]);
259 select->text_normal = table[NK_COLOR_TEXT];
260 select->text_hover = table[NK_COLOR_TEXT];
261 select->text_pressed = table[NK_COLOR_TEXT];
262 select->text_normal_active = table[NK_COLOR_TEXT];
263 select->text_hover_active = table[NK_COLOR_TEXT];
264 select->text_pressed_active = table[NK_COLOR_TEXT];
265 select->padding =
nk_vec2(2.0f,2.0f);
266 select->image_padding =
nk_vec2(2.0f,2.0f);
267 select->touch_padding =
nk_vec2(0,0);
268 select->userdata = nk_handle_ptr(0);
269 select->rounding = 0.0f;
270 select->color_factor = 1.0f;
271 select->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
272 select->draw_begin = 0;
273 select->draw_end = 0;
276 slider = &style->slider;
277 nk_zero_struct(*slider);
278 slider->normal = nk_style_item_hide();
279 slider->hover = nk_style_item_hide();
280 slider->active = nk_style_item_hide();
281 slider->bar_normal = table[NK_COLOR_SLIDER];
282 slider->bar_hover = table[NK_COLOR_SLIDER];
283 slider->bar_active = table[NK_COLOR_SLIDER];
284 slider->bar_filled = table[NK_COLOR_SLIDER_CURSOR];
285 slider->cursor_normal = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR]);
286 slider->cursor_hover = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_HOVER]);
287 slider->cursor_active = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_ACTIVE]);
288 slider->inc_symbol = NK_SYMBOL_TRIANGLE_RIGHT;
289 slider->dec_symbol = NK_SYMBOL_TRIANGLE_LEFT;
290 slider->cursor_size =
nk_vec2(16,16);
291 slider->padding =
nk_vec2(2,2);
292 slider->spacing =
nk_vec2(2,2);
293 slider->userdata = nk_handle_ptr(0);
294 slider->show_buttons = nk_false;
295 slider->bar_height = 4;
296 slider->rounding = 0;
297 slider->color_factor = 1.0f;
298 slider->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
299 slider->draw_begin = 0;
300 slider->draw_end = 0;
303 button = &style->slider.inc_button;
304 button->normal = nk_style_item_color(nk_rgb(40,40,40));
305 button->hover = nk_style_item_color(nk_rgb(42,42,42));
306 button->active = nk_style_item_color(nk_rgb(44,44,44));
307 button->border_color = nk_rgb(65,65,65);
308 button->text_background = nk_rgb(40,40,40);
309 button->text_normal = nk_rgb(175,175,175);
310 button->text_hover = nk_rgb(175,175,175);
311 button->text_active = nk_rgb(175,175,175);
312 button->padding =
nk_vec2(8.0f,8.0f);
313 button->touch_padding =
nk_vec2(0.0f,0.0f);
314 button->userdata = nk_handle_ptr(0);
315 button->text_alignment = NK_TEXT_CENTERED;
316 button->border = 1.0f;
317 button->rounding = 0.0f;
318 button->color_factor_text = 1.0f;
319 button->color_factor_background = 1.0f;
320 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
321 button->draw_begin = 0;
322 button->draw_end = 0;
323 style->slider.dec_button = style->slider.inc_button;
327 nk_zero_struct(*knob);
328 knob->normal = nk_style_item_hide();
329 knob->hover = nk_style_item_hide();
330 knob->active = nk_style_item_hide();
331 knob->knob_normal = table[NK_COLOR_KNOB];
332 knob->knob_hover = table[NK_COLOR_KNOB];
333 knob->knob_active = table[NK_COLOR_KNOB];
334 knob->cursor_normal = table[NK_COLOR_KNOB_CURSOR];
335 knob->cursor_hover = table[NK_COLOR_KNOB_CURSOR_HOVER];
336 knob->cursor_active = table[NK_COLOR_KNOB_CURSOR_ACTIVE];
338 knob->knob_border_color = table[NK_COLOR_BORDER];
339 knob->knob_border = 1.0f;
343 knob->cursor_width = 2;
344 knob->color_factor = 1.0f;
345 knob->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
347 knob->userdata = nk_handle_ptr(0);
348 knob->draw_begin = 0;
352 prog = &style->progress;
353 nk_zero_struct(*prog);
354 prog->normal = nk_style_item_color(table[NK_COLOR_SLIDER]);
355 prog->hover = nk_style_item_color(table[NK_COLOR_SLIDER]);
356 prog->active = nk_style_item_color(table[NK_COLOR_SLIDER]);
357 prog->cursor_normal = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR]);
358 prog->cursor_hover = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_HOVER]);
359 prog->cursor_active = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_ACTIVE]);
360 prog->border_color = nk_rgba(0,0,0,0);
361 prog->cursor_border_color = nk_rgba(0,0,0,0);
362 prog->userdata = nk_handle_ptr(0);
366 prog->cursor_rounding = 0;
367 prog->cursor_border = 0;
368 prog->color_factor = 1.0f;
369 prog->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
370 prog->draw_begin = 0;
374 scroll = &style->scrollh;
375 nk_zero_struct(*scroll);
376 scroll->normal = nk_style_item_color(table[NK_COLOR_SCROLLBAR]);
377 scroll->hover = nk_style_item_color(table[NK_COLOR_SCROLLBAR]);
378 scroll->active = nk_style_item_color(table[NK_COLOR_SCROLLBAR]);
379 scroll->cursor_normal = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR]);
380 scroll->cursor_hover = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR_HOVER]);
381 scroll->cursor_active = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE]);
382 scroll->dec_symbol = NK_SYMBOL_CIRCLE_SOLID;
383 scroll->inc_symbol = NK_SYMBOL_CIRCLE_SOLID;
384 scroll->userdata = nk_handle_ptr(0);
385 scroll->border_color = table[NK_COLOR_SCROLLBAR];
386 scroll->cursor_border_color = table[NK_COLOR_SCROLLBAR];
387 scroll->padding =
nk_vec2(0,0);
388 scroll->show_buttons = nk_false;
390 scroll->rounding = 0;
391 scroll->border_cursor = 0;
392 scroll->rounding_cursor = 0;
393 scroll->color_factor = 1.0f;
394 scroll->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
395 scroll->draw_begin = 0;
396 scroll->draw_end = 0;
397 style->scrollv = style->scrollh;
400 button = &style->scrollh.inc_button;
401 button->normal = nk_style_item_color(nk_rgb(40,40,40));
402 button->hover = nk_style_item_color(nk_rgb(42,42,42));
403 button->active = nk_style_item_color(nk_rgb(44,44,44));
404 button->border_color = nk_rgb(65,65,65);
405 button->text_background = nk_rgb(40,40,40);
406 button->text_normal = nk_rgb(175,175,175);
407 button->text_hover = nk_rgb(175,175,175);
408 button->text_active = nk_rgb(175,175,175);
409 button->padding =
nk_vec2(4.0f,4.0f);
410 button->touch_padding =
nk_vec2(0.0f,0.0f);
411 button->userdata = nk_handle_ptr(0);
412 button->text_alignment = NK_TEXT_CENTERED;
413 button->border = 1.0f;
414 button->rounding = 0.0f;
415 button->color_factor_text = 1.0f;
416 button->color_factor_background = 1.0f;
417 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
418 button->draw_begin = 0;
419 button->draw_end = 0;
420 style->scrollh.dec_button = style->scrollh.inc_button;
421 style->scrollv.inc_button = style->scrollh.inc_button;
422 style->scrollv.dec_button = style->scrollh.inc_button;
426 nk_zero_struct(*edit);
427 edit->normal = nk_style_item_color(table[NK_COLOR_EDIT]);
428 edit->hover = nk_style_item_color(table[NK_COLOR_EDIT]);
429 edit->active = nk_style_item_color(table[NK_COLOR_EDIT]);
430 edit->cursor_normal = table[NK_COLOR_TEXT];
431 edit->cursor_hover = table[NK_COLOR_TEXT];
432 edit->cursor_text_normal= table[NK_COLOR_EDIT];
433 edit->cursor_text_hover = table[NK_COLOR_EDIT];
434 edit->border_color = table[NK_COLOR_BORDER];
435 edit->text_normal = table[NK_COLOR_TEXT];
436 edit->text_hover = table[NK_COLOR_TEXT];
437 edit->text_active = table[NK_COLOR_TEXT];
438 edit->selected_normal = table[NK_COLOR_TEXT];
439 edit->selected_hover = table[NK_COLOR_TEXT];
440 edit->selected_text_normal = table[NK_COLOR_EDIT];
441 edit->selected_text_hover = table[NK_COLOR_EDIT];
442 edit->scrollbar_size =
nk_vec2(10,10);
443 edit->scrollbar = style->scrollv;
445 edit->row_padding = 2;
446 edit->cursor_size = 4;
449 edit->color_factor = 1.0f;
450 edit->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
453 property = &style->property;
454 nk_zero_struct(*property);
455 property->normal = nk_style_item_color(table[NK_COLOR_PROPERTY]);
456 property->hover = nk_style_item_color(table[NK_COLOR_PROPERTY]);
457 property->active = nk_style_item_color(table[NK_COLOR_PROPERTY]);
458 property->border_color = table[NK_COLOR_BORDER];
459 property->label_normal = table[NK_COLOR_TEXT];
460 property->label_hover = table[NK_COLOR_TEXT];
461 property->label_active = table[NK_COLOR_TEXT];
462 property->sym_left = NK_SYMBOL_TRIANGLE_LEFT;
463 property->sym_right = NK_SYMBOL_TRIANGLE_RIGHT;
464 property->userdata = nk_handle_ptr(0);
465 property->padding =
nk_vec2(4,4);
466 property->border = 1;
467 property->rounding = 10;
468 property->draw_begin = 0;
469 property->draw_end = 0;
470 property->color_factor = 1.0f;
471 property->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
474 button = &style->property.dec_button;
475 nk_zero_struct(*button);
476 button->normal = nk_style_item_color(table[NK_COLOR_PROPERTY]);
477 button->hover = nk_style_item_color(table[NK_COLOR_PROPERTY]);
478 button->active = nk_style_item_color(table[NK_COLOR_PROPERTY]);
479 button->border_color = nk_rgba(0,0,0,0);
480 button->text_background = table[NK_COLOR_PROPERTY];
481 button->text_normal = table[NK_COLOR_TEXT];
482 button->text_hover = table[NK_COLOR_TEXT];
483 button->text_active = table[NK_COLOR_TEXT];
484 button->padding =
nk_vec2(0.0f,0.0f);
485 button->touch_padding =
nk_vec2(0.0f,0.0f);
486 button->userdata = nk_handle_ptr(0);
487 button->text_alignment = NK_TEXT_CENTERED;
488 button->border = 0.0f;
489 button->rounding = 0.0f;
490 button->color_factor_text = 1.0f;
491 button->color_factor_background = 1.0f;
492 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
493 button->draw_begin = 0;
494 button->draw_end = 0;
495 style->property.inc_button = style->property.dec_button;
498 edit = &style->property.edit;
499 nk_zero_struct(*edit);
500 edit->normal = nk_style_item_color(table[NK_COLOR_PROPERTY]);
501 edit->hover = nk_style_item_color(table[NK_COLOR_PROPERTY]);
502 edit->active = nk_style_item_color(table[NK_COLOR_PROPERTY]);
503 edit->border_color = nk_rgba(0,0,0,0);
504 edit->cursor_normal = table[NK_COLOR_TEXT];
505 edit->cursor_hover = table[NK_COLOR_TEXT];
506 edit->cursor_text_normal= table[NK_COLOR_EDIT];
507 edit->cursor_text_hover = table[NK_COLOR_EDIT];
508 edit->text_normal = table[NK_COLOR_TEXT];
509 edit->text_hover = table[NK_COLOR_TEXT];
510 edit->text_active = table[NK_COLOR_TEXT];
511 edit->selected_normal = table[NK_COLOR_TEXT];
512 edit->selected_hover = table[NK_COLOR_TEXT];
513 edit->selected_text_normal = table[NK_COLOR_EDIT];
514 edit->selected_text_hover = table[NK_COLOR_EDIT];
516 edit->cursor_size = 8;
519 edit->color_factor = 1.0f;
520 edit->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
523 chart = &style->chart;
524 nk_zero_struct(*chart);
525 chart->background = nk_style_item_color(table[NK_COLOR_CHART]);
526 chart->border_color = table[NK_COLOR_BORDER];
527 chart->selected_color = table[NK_COLOR_CHART_COLOR_HIGHLIGHT];
528 chart->color = table[NK_COLOR_CHART_COLOR];
532 chart->color_factor = 1.0f;
533 chart->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
534 chart->show_markers = nk_true;
537 combo = &style->combo;
538 combo->normal = nk_style_item_color(table[NK_COLOR_COMBO]);
539 combo->hover = nk_style_item_color(table[NK_COLOR_COMBO]);
540 combo->active = nk_style_item_color(table[NK_COLOR_COMBO]);
541 combo->border_color = table[NK_COLOR_BORDER];
542 combo->label_normal = table[NK_COLOR_TEXT];
543 combo->label_hover = table[NK_COLOR_TEXT];
544 combo->label_active = table[NK_COLOR_TEXT];
545 combo->sym_normal = NK_SYMBOL_TRIANGLE_DOWN;
546 combo->sym_hover = NK_SYMBOL_TRIANGLE_DOWN;
547 combo->sym_active = NK_SYMBOL_TRIANGLE_DOWN;
548 combo->content_padding =
nk_vec2(4,4);
549 combo->button_padding =
nk_vec2(0,4);
553 combo->color_factor = 1.0f;
554 combo->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
557 button = &style->combo.button;
558 nk_zero_struct(*button);
559 button->normal = nk_style_item_color(table[NK_COLOR_COMBO]);
560 button->hover = nk_style_item_color(table[NK_COLOR_COMBO]);
561 button->active = nk_style_item_color(table[NK_COLOR_COMBO]);
562 button->border_color = nk_rgba(0,0,0,0);
563 button->text_background = table[NK_COLOR_COMBO];
564 button->text_normal = table[NK_COLOR_TEXT];
565 button->text_hover = table[NK_COLOR_TEXT];
566 button->text_active = table[NK_COLOR_TEXT];
567 button->padding =
nk_vec2(2.0f,2.0f);
568 button->touch_padding =
nk_vec2(0.0f,0.0f);
569 button->userdata = nk_handle_ptr(0);
570 button->text_alignment = NK_TEXT_CENTERED;
571 button->border = 0.0f;
572 button->rounding = 0.0f;
573 button->color_factor_text = 1.0f;
574 button->color_factor_background = 1.0f;
575 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
576 button->draw_begin = 0;
577 button->draw_end = 0;
581 tab->background = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
582 tab->border_color = table[NK_COLOR_BORDER];
583 tab->text = table[NK_COLOR_TEXT];
584 tab->sym_minimize = NK_SYMBOL_TRIANGLE_RIGHT;
585 tab->sym_maximize = NK_SYMBOL_TRIANGLE_DOWN;
591 tab->color_factor = 1.0f;
592 tab->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
595 button = &style->tab.tab_minimize_button;
596 nk_zero_struct(*button);
597 button->normal = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
598 button->hover = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
599 button->active = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
600 button->border_color = nk_rgba(0,0,0,0);
601 button->text_background = table[NK_COLOR_TAB_HEADER];
602 button->text_normal = table[NK_COLOR_TEXT];
603 button->text_hover = table[NK_COLOR_TEXT];
604 button->text_active = table[NK_COLOR_TEXT];
605 button->padding =
nk_vec2(2.0f,2.0f);
606 button->touch_padding =
nk_vec2(0.0f,0.0f);
607 button->userdata = nk_handle_ptr(0);
608 button->text_alignment = NK_TEXT_CENTERED;
609 button->border = 0.0f;
610 button->rounding = 0.0f;
611 button->color_factor_text = 1.0f;
612 button->color_factor_background = 1.0f;
613 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
614 button->draw_begin = 0;
615 button->draw_end = 0;
616 style->tab.tab_maximize_button =*button;
619 button = &style->tab.node_minimize_button;
620 nk_zero_struct(*button);
621 button->normal = nk_style_item_color(table[NK_COLOR_WINDOW]);
622 button->hover = nk_style_item_color(table[NK_COLOR_WINDOW]);
623 button->active = nk_style_item_color(table[NK_COLOR_WINDOW]);
624 button->border_color = nk_rgba(0,0,0,0);
625 button->text_background = table[NK_COLOR_TAB_HEADER];
626 button->text_normal = table[NK_COLOR_TEXT];
627 button->text_hover = table[NK_COLOR_TEXT];
628 button->text_active = table[NK_COLOR_TEXT];
629 button->padding =
nk_vec2(2.0f,2.0f);
630 button->touch_padding =
nk_vec2(0.0f,0.0f);
631 button->userdata = nk_handle_ptr(0);
632 button->text_alignment = NK_TEXT_CENTERED;
633 button->border = 0.0f;
634 button->rounding = 0.0f;
635 button->color_factor_text = 1.0f;
636 button->color_factor_background = 1.0f;
637 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
638 button->draw_begin = 0;
639 button->draw_end = 0;
640 style->tab.node_maximize_button =*button;
643 win = &style->window;
644 win->header.align = NK_HEADER_RIGHT;
645 win->header.close_symbol = NK_SYMBOL_X;
646 win->header.minimize_symbol = NK_SYMBOL_MINUS;
647 win->header.maximize_symbol = NK_SYMBOL_PLUS;
648 win->header.normal = nk_style_item_color(table[NK_COLOR_HEADER]);
649 win->header.hover = nk_style_item_color(table[NK_COLOR_HEADER]);
650 win->header.active = nk_style_item_color(table[NK_COLOR_HEADER]);
651 win->header.label_normal = table[NK_COLOR_TEXT];
652 win->header.label_hover = table[NK_COLOR_TEXT];
653 win->header.label_active = table[NK_COLOR_TEXT];
654 win->header.label_padding =
nk_vec2(4,4);
655 win->header.padding =
nk_vec2(4,4);
656 win->header.spacing =
nk_vec2(0,0);
659 button = &style->window.header.close_button;
660 nk_zero_struct(*button);
661 button->normal = nk_style_item_color(table[NK_COLOR_HEADER]);
662 button->hover = nk_style_item_color(table[NK_COLOR_HEADER]);
663 button->active = nk_style_item_color(table[NK_COLOR_HEADER]);
664 button->border_color = nk_rgba(0,0,0,0);
665 button->text_background = table[NK_COLOR_HEADER];
666 button->text_normal = table[NK_COLOR_TEXT];
667 button->text_hover = table[NK_COLOR_TEXT];
668 button->text_active = table[NK_COLOR_TEXT];
669 button->padding =
nk_vec2(0.0f,0.0f);
670 button->touch_padding =
nk_vec2(0.0f,0.0f);
671 button->userdata = nk_handle_ptr(0);
672 button->text_alignment = NK_TEXT_CENTERED;
673 button->border = 0.0f;
674 button->rounding = 0.0f;
675 button->color_factor_text = 1.0f;
676 button->color_factor_background = 1.0f;
677 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
678 button->draw_begin = 0;
679 button->draw_end = 0;
682 button = &style->window.header.minimize_button;
683 nk_zero_struct(*button);
684 button->normal = nk_style_item_color(table[NK_COLOR_HEADER]);
685 button->hover = nk_style_item_color(table[NK_COLOR_HEADER]);
686 button->active = nk_style_item_color(table[NK_COLOR_HEADER]);
687 button->border_color = nk_rgba(0,0,0,0);
688 button->text_background = table[NK_COLOR_HEADER];
689 button->text_normal = table[NK_COLOR_TEXT];
690 button->text_hover = table[NK_COLOR_TEXT];
691 button->text_active = table[NK_COLOR_TEXT];
692 button->padding =
nk_vec2(0.0f,0.0f);
693 button->touch_padding =
nk_vec2(0.0f,0.0f);
694 button->userdata = nk_handle_ptr(0);
695 button->text_alignment = NK_TEXT_CENTERED;
696 button->border = 0.0f;
697 button->rounding = 0.0f;
698 button->color_factor_text = 1.0f;
699 button->color_factor_background = 1.0f;
700 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
701 button->draw_begin = 0;
702 button->draw_end = 0;
705 win->background = table[NK_COLOR_WINDOW];
706 win->fixed_background = nk_style_item_color(table[NK_COLOR_WINDOW]);
707 win->border_color = table[NK_COLOR_BORDER];
708 win->popup_border_color = table[NK_COLOR_BORDER];
709 win->combo_border_color = table[NK_COLOR_BORDER];
710 win->contextual_border_color = table[NK_COLOR_BORDER];
711 win->menu_border_color = table[NK_COLOR_BORDER];
712 win->group_border_color = table[NK_COLOR_BORDER];
713 win->tooltip_border_color = table[NK_COLOR_BORDER];
714 win->scaler = nk_style_item_color(table[NK_COLOR_TEXT]);
716 win->rounding = 0.0f;
718 win->scrollbar_size =
nk_vec2(10,10);
719 win->min_size =
nk_vec2(64,64);
721 win->combo_border = 1.0f;
722 win->contextual_border = 1.0f;
723 win->menu_border = 1.0f;
724 win->group_border = 1.0f;
725 win->tooltip_border = 1.0f;
726 win->popup_border = 1.0f;
728 win->min_row_height_padding = 8;
731 win->group_padding =
nk_vec2(4,4);
732 win->popup_padding =
nk_vec2(4,4);
733 win->combo_padding =
nk_vec2(4,4);
734 win->contextual_padding =
nk_vec2(4,4);
735 win->menu_padding =
nk_vec2(4,4);
736 win->tooltip_padding =
nk_vec2(4,4);
744 win->tooltip_origin = NK_TOP_LEFT;
745 win->tooltip_offset =
nk_vec2(12, 12);
746 win->tooltip_delay = 0.5f;
757 ctx->stacks.fonts.head = 0;
759 nk_layout_reset_min_row_height(ctx);
764 struct nk_config_stack_user_font *font_stack;
765 struct nk_config_stack_user_font_element *element;
770 font_stack = &ctx->stacks.fonts;
771 NK_ASSERT(font_stack->head < (
int)NK_LEN(font_stack->elements));
772 if (font_stack->head >= (
int)NK_LEN(font_stack->elements))
775 element = &font_stack->elements[font_stack->head++];
776 element->address = &ctx->style.font;
777 element->old_value = ctx->style.font;
778 ctx->style.font = font;
784 struct nk_config_stack_user_font *font_stack;
785 struct nk_config_stack_user_font_element *element;
790 font_stack = &ctx->stacks.fonts;
791 NK_ASSERT(font_stack->head > 0);
792 if (font_stack->head < 1)
795 element = &font_stack->elements[--font_stack->head];
796 *element->address = element->old_value;
799#define NK_STYLE_PUSH_IMPLEMENATION(prefix, type, stack) \
800nk_style_push_##type(struct nk_context *ctx, prefix##_##type *address, prefix##_##type value)\
802 struct nk_config_stack_##type * type_stack;\
803 struct nk_config_stack_##type##_element *element;\
806 type_stack = &ctx->stacks.stack;\
807 NK_ASSERT(type_stack->head < (int)NK_LEN(type_stack->elements));\
808 if (type_stack->head >= (int)NK_LEN(type_stack->elements))\
810 element = &type_stack->elements[type_stack->head++];\
811 element->address = address;\
812 element->old_value = *address;\
816#define NK_STYLE_POP_IMPLEMENATION(type, stack) \
817nk_style_pop_##type(struct nk_context *ctx)\
819 struct nk_config_stack_##type *type_stack;\
820 struct nk_config_stack_##type##_element *element;\
823 type_stack = &ctx->stacks.stack;\
824 NK_ASSERT(type_stack->head > 0);\
825 if (type_stack->head < 1)\
827 element = &type_stack->elements[--type_stack->head];\
828 *element->address = element->old_value;\
831NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(
struct nk, style_item, style_items)
832NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(nk,
float, floats)
833NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(
struct nk, vec2, vectors)
834NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(nk,flags, flags)
835NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(
struct nk,color, colors)
837NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(style_item, style_items)
838NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(
float,floats)
839NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(vec2, vectors)
840NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(flags,flags)
841NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(color,colors)
844nk_style_set_cursor(
struct nk_context *ctx,
enum nk_style_cursor c)
850 if (style->cursors[c]) {
851 style->cursor_active = style->cursors[c];
859 ctx->style.cursor_visible = nk_true;
864 ctx->style.cursor_visible = nk_false;
867nk_style_load_cursor(
struct nk_context *ctx,
enum nk_style_cursor cursor,
874 style->cursors[cursor] = c;
884 for (i = 0; i < NK_CURSOR_COUNT; ++i)
885 style->cursors[i] = &cursors[i];
886 style->cursor_visible = nk_true;