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);
115 table = (!table) ? nk_default_color_style: table;
119 text->color = table[NK_COLOR_TEXT];
121 text->color_factor = 1.0f;
122 text->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
125 button = &style->button;
126 nk_zero_struct(*button);
127 button->normal = nk_style_item_color(table[NK_COLOR_BUTTON]);
128 button->hover = nk_style_item_color(table[NK_COLOR_BUTTON_HOVER]);
129 button->active = nk_style_item_color(table[NK_COLOR_BUTTON_ACTIVE]);
130 button->border_color = table[NK_COLOR_BORDER];
131 button->text_background = table[NK_COLOR_BUTTON];
132 button->text_normal = table[NK_COLOR_TEXT];
133 button->text_hover = table[NK_COLOR_TEXT];
134 button->text_active = table[NK_COLOR_TEXT];
135 button->padding =
nk_vec2(2.0f,2.0f);
136 button->image_padding =
nk_vec2(0.0f,0.0f);
137 button->touch_padding =
nk_vec2(0.0f, 0.0f);
138 button->userdata = nk_handle_ptr(0);
139 button->text_alignment = NK_TEXT_CENTERED;
140 button->border = 1.0f;
141 button->rounding = 4.0f;
142 button->color_factor_text = 1.0f;
143 button->color_factor_background = 1.0f;
144 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
145 button->draw_begin = 0;
146 button->draw_end = 0;
149 button = &style->contextual_button;
150 nk_zero_struct(*button);
151 button->normal = nk_style_item_color(table[NK_COLOR_WINDOW]);
152 button->hover = nk_style_item_color(table[NK_COLOR_BUTTON_HOVER]);
153 button->active = nk_style_item_color(table[NK_COLOR_BUTTON_ACTIVE]);
154 button->border_color = table[NK_COLOR_WINDOW];
155 button->text_background = table[NK_COLOR_WINDOW];
156 button->text_normal = table[NK_COLOR_TEXT];
157 button->text_hover = table[NK_COLOR_TEXT];
158 button->text_active = table[NK_COLOR_TEXT];
159 button->padding =
nk_vec2(2.0f,2.0f);
160 button->touch_padding =
nk_vec2(0.0f,0.0f);
161 button->userdata = nk_handle_ptr(0);
162 button->text_alignment = NK_TEXT_CENTERED;
163 button->border = 0.0f;
164 button->rounding = 0.0f;
165 button->color_factor_text = 1.0f;
166 button->color_factor_background = 1.0f;
167 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
168 button->draw_begin = 0;
169 button->draw_end = 0;
172 button = &style->menu_button;
173 nk_zero_struct(*button);
174 button->normal = nk_style_item_color(table[NK_COLOR_WINDOW]);
175 button->hover = nk_style_item_color(table[NK_COLOR_WINDOW]);
176 button->active = nk_style_item_color(table[NK_COLOR_WINDOW]);
177 button->border_color = table[NK_COLOR_WINDOW];
178 button->text_background = table[NK_COLOR_WINDOW];
179 button->text_normal = table[NK_COLOR_TEXT];
180 button->text_hover = table[NK_COLOR_TEXT];
181 button->text_active = table[NK_COLOR_TEXT];
182 button->padding =
nk_vec2(2.0f,2.0f);
183 button->touch_padding =
nk_vec2(0.0f,0.0f);
184 button->userdata = nk_handle_ptr(0);
185 button->text_alignment = NK_TEXT_CENTERED;
186 button->border = 0.0f;
187 button->rounding = 1.0f;
188 button->color_factor_text = 1.0f;
189 button->color_factor_background = 1.0f;
190 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
191 button->draw_begin = 0;
192 button->draw_end = 0;
195 toggle = &style->checkbox;
196 nk_zero_struct(*toggle);
197 toggle->normal = nk_style_item_color(table[NK_COLOR_TOGGLE]);
198 toggle->hover = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
199 toggle->active = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
200 toggle->cursor_normal = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
201 toggle->cursor_hover = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
202 toggle->userdata = nk_handle_ptr(0);
203 toggle->text_background = table[NK_COLOR_WINDOW];
204 toggle->text_normal = table[NK_COLOR_TEXT];
205 toggle->text_hover = table[NK_COLOR_TEXT];
206 toggle->text_active = table[NK_COLOR_TEXT];
207 toggle->padding =
nk_vec2(2.0f, 2.0f);
208 toggle->touch_padding =
nk_vec2(0,0);
209 toggle->border_color = nk_rgba(0,0,0,0);
210 toggle->border = 0.0f;
212 toggle->color_factor = 1.0f;
213 toggle->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
216 toggle = &style->option;
217 nk_zero_struct(*toggle);
218 toggle->normal = nk_style_item_color(table[NK_COLOR_TOGGLE]);
219 toggle->hover = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
220 toggle->active = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
221 toggle->cursor_normal = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
222 toggle->cursor_hover = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
223 toggle->userdata = nk_handle_ptr(0);
224 toggle->text_background = table[NK_COLOR_WINDOW];
225 toggle->text_normal = table[NK_COLOR_TEXT];
226 toggle->text_hover = table[NK_COLOR_TEXT];
227 toggle->text_active = table[NK_COLOR_TEXT];
228 toggle->padding =
nk_vec2(3.0f, 3.0f);
229 toggle->touch_padding =
nk_vec2(0,0);
230 toggle->border_color = nk_rgba(0,0,0,0);
231 toggle->border = 0.0f;
233 toggle->color_factor = 1.0f;
234 toggle->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
237 select = &style->selectable;
238 nk_zero_struct(*select);
239 select->normal = nk_style_item_color(table[NK_COLOR_SELECT]);
240 select->hover = nk_style_item_color(table[NK_COLOR_SELECT]);
241 select->pressed = nk_style_item_color(table[NK_COLOR_SELECT]);
242 select->normal_active = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]);
243 select->hover_active = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]);
244 select->pressed_active = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]);
245 select->text_normal = table[NK_COLOR_TEXT];
246 select->text_hover = table[NK_COLOR_TEXT];
247 select->text_pressed = table[NK_COLOR_TEXT];
248 select->text_normal_active = table[NK_COLOR_TEXT];
249 select->text_hover_active = table[NK_COLOR_TEXT];
250 select->text_pressed_active = table[NK_COLOR_TEXT];
251 select->padding =
nk_vec2(2.0f,2.0f);
252 select->image_padding =
nk_vec2(2.0f,2.0f);
253 select->touch_padding =
nk_vec2(0,0);
254 select->userdata = nk_handle_ptr(0);
255 select->rounding = 0.0f;
256 select->color_factor = 1.0f;
257 select->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
258 select->draw_begin = 0;
259 select->draw_end = 0;
262 slider = &style->slider;
263 nk_zero_struct(*slider);
264 slider->normal = nk_style_item_hide();
265 slider->hover = nk_style_item_hide();
266 slider->active = nk_style_item_hide();
267 slider->bar_normal = table[NK_COLOR_SLIDER];
268 slider->bar_hover = table[NK_COLOR_SLIDER];
269 slider->bar_active = table[NK_COLOR_SLIDER];
270 slider->bar_filled = table[NK_COLOR_SLIDER_CURSOR];
271 slider->cursor_normal = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR]);
272 slider->cursor_hover = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_HOVER]);
273 slider->cursor_active = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_ACTIVE]);
274 slider->inc_symbol = NK_SYMBOL_TRIANGLE_RIGHT;
275 slider->dec_symbol = NK_SYMBOL_TRIANGLE_LEFT;
276 slider->cursor_size =
nk_vec2(16,16);
277 slider->padding =
nk_vec2(2,2);
278 slider->spacing =
nk_vec2(2,2);
279 slider->userdata = nk_handle_ptr(0);
280 slider->show_buttons = nk_false;
281 slider->bar_height = 8;
282 slider->rounding = 0;
283 slider->color_factor = 1.0f;
284 slider->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
285 slider->draw_begin = 0;
286 slider->draw_end = 0;
289 button = &style->slider.inc_button;
290 button->normal = nk_style_item_color(nk_rgb(40,40,40));
291 button->hover = nk_style_item_color(nk_rgb(42,42,42));
292 button->active = nk_style_item_color(nk_rgb(44,44,44));
293 button->border_color = nk_rgb(65,65,65);
294 button->text_background = nk_rgb(40,40,40);
295 button->text_normal = nk_rgb(175,175,175);
296 button->text_hover = nk_rgb(175,175,175);
297 button->text_active = nk_rgb(175,175,175);
298 button->padding =
nk_vec2(8.0f,8.0f);
299 button->touch_padding =
nk_vec2(0.0f,0.0f);
300 button->userdata = nk_handle_ptr(0);
301 button->text_alignment = NK_TEXT_CENTERED;
302 button->border = 1.0f;
303 button->rounding = 0.0f;
304 button->color_factor_text = 1.0f;
305 button->color_factor_background = 1.0f;
306 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
307 button->draw_begin = 0;
308 button->draw_end = 0;
309 style->slider.dec_button = style->slider.inc_button;
313 nk_zero_struct(*knob);
314 knob->normal = nk_style_item_hide();
315 knob->hover = nk_style_item_hide();
316 knob->active = nk_style_item_hide();
317 knob->knob_normal = table[NK_COLOR_KNOB];
318 knob->knob_hover = table[NK_COLOR_KNOB];
319 knob->knob_active = table[NK_COLOR_KNOB];
320 knob->cursor_normal = table[NK_COLOR_KNOB_CURSOR];
321 knob->cursor_hover = table[NK_COLOR_KNOB_CURSOR_HOVER];
322 knob->cursor_active = table[NK_COLOR_KNOB_CURSOR_ACTIVE];
324 knob->knob_border_color = table[NK_COLOR_BORDER];
325 knob->knob_border = 1.0f;
329 knob->cursor_width = 2;
330 knob->color_factor = 1.0f;
331 knob->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
333 knob->userdata = nk_handle_ptr(0);
334 knob->draw_begin = 0;
338 prog = &style->progress;
339 nk_zero_struct(*prog);
340 prog->normal = nk_style_item_color(table[NK_COLOR_SLIDER]);
341 prog->hover = nk_style_item_color(table[NK_COLOR_SLIDER]);
342 prog->active = nk_style_item_color(table[NK_COLOR_SLIDER]);
343 prog->cursor_normal = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR]);
344 prog->cursor_hover = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_HOVER]);
345 prog->cursor_active = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_ACTIVE]);
346 prog->border_color = nk_rgba(0,0,0,0);
347 prog->cursor_border_color = nk_rgba(0,0,0,0);
348 prog->userdata = nk_handle_ptr(0);
352 prog->cursor_rounding = 0;
353 prog->cursor_border = 0;
354 prog->color_factor = 1.0f;
355 prog->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
356 prog->draw_begin = 0;
360 scroll = &style->scrollh;
361 nk_zero_struct(*scroll);
362 scroll->normal = nk_style_item_color(table[NK_COLOR_SCROLLBAR]);
363 scroll->hover = nk_style_item_color(table[NK_COLOR_SCROLLBAR]);
364 scroll->active = nk_style_item_color(table[NK_COLOR_SCROLLBAR]);
365 scroll->cursor_normal = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR]);
366 scroll->cursor_hover = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR_HOVER]);
367 scroll->cursor_active = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE]);
368 scroll->dec_symbol = NK_SYMBOL_CIRCLE_SOLID;
369 scroll->inc_symbol = NK_SYMBOL_CIRCLE_SOLID;
370 scroll->userdata = nk_handle_ptr(0);
371 scroll->border_color = table[NK_COLOR_SCROLLBAR];
372 scroll->cursor_border_color = table[NK_COLOR_SCROLLBAR];
373 scroll->padding =
nk_vec2(0,0);
374 scroll->show_buttons = nk_false;
376 scroll->rounding = 0;
377 scroll->border_cursor = 0;
378 scroll->rounding_cursor = 0;
379 scroll->color_factor = 1.0f;
380 scroll->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
381 scroll->draw_begin = 0;
382 scroll->draw_end = 0;
383 style->scrollv = style->scrollh;
386 button = &style->scrollh.inc_button;
387 button->normal = nk_style_item_color(nk_rgb(40,40,40));
388 button->hover = nk_style_item_color(nk_rgb(42,42,42));
389 button->active = nk_style_item_color(nk_rgb(44,44,44));
390 button->border_color = nk_rgb(65,65,65);
391 button->text_background = nk_rgb(40,40,40);
392 button->text_normal = nk_rgb(175,175,175);
393 button->text_hover = nk_rgb(175,175,175);
394 button->text_active = nk_rgb(175,175,175);
395 button->padding =
nk_vec2(4.0f,4.0f);
396 button->touch_padding =
nk_vec2(0.0f,0.0f);
397 button->userdata = nk_handle_ptr(0);
398 button->text_alignment = NK_TEXT_CENTERED;
399 button->border = 1.0f;
400 button->rounding = 0.0f;
401 button->color_factor_text = 1.0f;
402 button->color_factor_background = 1.0f;
403 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
404 button->draw_begin = 0;
405 button->draw_end = 0;
406 style->scrollh.dec_button = style->scrollh.inc_button;
407 style->scrollv.inc_button = style->scrollh.inc_button;
408 style->scrollv.dec_button = style->scrollh.inc_button;
412 nk_zero_struct(*edit);
413 edit->normal = nk_style_item_color(table[NK_COLOR_EDIT]);
414 edit->hover = nk_style_item_color(table[NK_COLOR_EDIT]);
415 edit->active = nk_style_item_color(table[NK_COLOR_EDIT]);
416 edit->cursor_normal = table[NK_COLOR_TEXT];
417 edit->cursor_hover = table[NK_COLOR_TEXT];
418 edit->cursor_text_normal= table[NK_COLOR_EDIT];
419 edit->cursor_text_hover = table[NK_COLOR_EDIT];
420 edit->border_color = table[NK_COLOR_BORDER];
421 edit->text_normal = table[NK_COLOR_TEXT];
422 edit->text_hover = table[NK_COLOR_TEXT];
423 edit->text_active = table[NK_COLOR_TEXT];
424 edit->selected_normal = table[NK_COLOR_TEXT];
425 edit->selected_hover = table[NK_COLOR_TEXT];
426 edit->selected_text_normal = table[NK_COLOR_EDIT];
427 edit->selected_text_hover = table[NK_COLOR_EDIT];
428 edit->scrollbar_size =
nk_vec2(10,10);
429 edit->scrollbar = style->scrollv;
431 edit->row_padding = 2;
432 edit->cursor_size = 4;
435 edit->color_factor = 1.0f;
436 edit->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
439 property = &style->property;
440 nk_zero_struct(*property);
441 property->normal = nk_style_item_color(table[NK_COLOR_PROPERTY]);
442 property->hover = nk_style_item_color(table[NK_COLOR_PROPERTY]);
443 property->active = nk_style_item_color(table[NK_COLOR_PROPERTY]);
444 property->border_color = table[NK_COLOR_BORDER];
445 property->label_normal = table[NK_COLOR_TEXT];
446 property->label_hover = table[NK_COLOR_TEXT];
447 property->label_active = table[NK_COLOR_TEXT];
448 property->sym_left = NK_SYMBOL_TRIANGLE_LEFT;
449 property->sym_right = NK_SYMBOL_TRIANGLE_RIGHT;
450 property->userdata = nk_handle_ptr(0);
451 property->padding =
nk_vec2(4,4);
452 property->border = 1;
453 property->rounding = 10;
454 property->draw_begin = 0;
455 property->draw_end = 0;
456 property->color_factor = 1.0f;
457 property->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
460 button = &style->property.dec_button;
461 nk_zero_struct(*button);
462 button->normal = nk_style_item_color(table[NK_COLOR_PROPERTY]);
463 button->hover = nk_style_item_color(table[NK_COLOR_PROPERTY]);
464 button->active = nk_style_item_color(table[NK_COLOR_PROPERTY]);
465 button->border_color = nk_rgba(0,0,0,0);
466 button->text_background = table[NK_COLOR_PROPERTY];
467 button->text_normal = table[NK_COLOR_TEXT];
468 button->text_hover = table[NK_COLOR_TEXT];
469 button->text_active = table[NK_COLOR_TEXT];
470 button->padding =
nk_vec2(0.0f,0.0f);
471 button->touch_padding =
nk_vec2(0.0f,0.0f);
472 button->userdata = nk_handle_ptr(0);
473 button->text_alignment = NK_TEXT_CENTERED;
474 button->border = 0.0f;
475 button->rounding = 0.0f;
476 button->color_factor_text = 1.0f;
477 button->color_factor_background = 1.0f;
478 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
479 button->draw_begin = 0;
480 button->draw_end = 0;
481 style->property.inc_button = style->property.dec_button;
484 edit = &style->property.edit;
485 nk_zero_struct(*edit);
486 edit->normal = nk_style_item_color(table[NK_COLOR_PROPERTY]);
487 edit->hover = nk_style_item_color(table[NK_COLOR_PROPERTY]);
488 edit->active = nk_style_item_color(table[NK_COLOR_PROPERTY]);
489 edit->border_color = nk_rgba(0,0,0,0);
490 edit->cursor_normal = table[NK_COLOR_TEXT];
491 edit->cursor_hover = table[NK_COLOR_TEXT];
492 edit->cursor_text_normal= table[NK_COLOR_EDIT];
493 edit->cursor_text_hover = table[NK_COLOR_EDIT];
494 edit->text_normal = table[NK_COLOR_TEXT];
495 edit->text_hover = table[NK_COLOR_TEXT];
496 edit->text_active = table[NK_COLOR_TEXT];
497 edit->selected_normal = table[NK_COLOR_TEXT];
498 edit->selected_hover = table[NK_COLOR_TEXT];
499 edit->selected_text_normal = table[NK_COLOR_EDIT];
500 edit->selected_text_hover = table[NK_COLOR_EDIT];
502 edit->cursor_size = 8;
505 edit->color_factor = 1.0f;
506 edit->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
509 chart = &style->chart;
510 nk_zero_struct(*chart);
511 chart->background = nk_style_item_color(table[NK_COLOR_CHART]);
512 chart->border_color = table[NK_COLOR_BORDER];
513 chart->selected_color = table[NK_COLOR_CHART_COLOR_HIGHLIGHT];
514 chart->color = table[NK_COLOR_CHART_COLOR];
518 chart->color_factor = 1.0f;
519 chart->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
520 chart->show_markers = nk_true;
523 combo = &style->combo;
524 combo->normal = nk_style_item_color(table[NK_COLOR_COMBO]);
525 combo->hover = nk_style_item_color(table[NK_COLOR_COMBO]);
526 combo->active = nk_style_item_color(table[NK_COLOR_COMBO]);
527 combo->border_color = table[NK_COLOR_BORDER];
528 combo->label_normal = table[NK_COLOR_TEXT];
529 combo->label_hover = table[NK_COLOR_TEXT];
530 combo->label_active = table[NK_COLOR_TEXT];
531 combo->sym_normal = NK_SYMBOL_TRIANGLE_DOWN;
532 combo->sym_hover = NK_SYMBOL_TRIANGLE_DOWN;
533 combo->sym_active = NK_SYMBOL_TRIANGLE_DOWN;
534 combo->content_padding =
nk_vec2(4,4);
535 combo->button_padding =
nk_vec2(0,4);
539 combo->color_factor = 1.0f;
540 combo->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
543 button = &style->combo.button;
544 nk_zero_struct(*button);
545 button->normal = nk_style_item_color(table[NK_COLOR_COMBO]);
546 button->hover = nk_style_item_color(table[NK_COLOR_COMBO]);
547 button->active = nk_style_item_color(table[NK_COLOR_COMBO]);
548 button->border_color = nk_rgba(0,0,0,0);
549 button->text_background = table[NK_COLOR_COMBO];
550 button->text_normal = table[NK_COLOR_TEXT];
551 button->text_hover = table[NK_COLOR_TEXT];
552 button->text_active = table[NK_COLOR_TEXT];
553 button->padding =
nk_vec2(2.0f,2.0f);
554 button->touch_padding =
nk_vec2(0.0f,0.0f);
555 button->userdata = nk_handle_ptr(0);
556 button->text_alignment = NK_TEXT_CENTERED;
557 button->border = 0.0f;
558 button->rounding = 0.0f;
559 button->color_factor_text = 1.0f;
560 button->color_factor_background = 1.0f;
561 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
562 button->draw_begin = 0;
563 button->draw_end = 0;
567 tab->background = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
568 tab->border_color = table[NK_COLOR_BORDER];
569 tab->text = table[NK_COLOR_TEXT];
570 tab->sym_minimize = NK_SYMBOL_TRIANGLE_RIGHT;
571 tab->sym_maximize = NK_SYMBOL_TRIANGLE_DOWN;
577 tab->color_factor = 1.0f;
578 tab->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
581 button = &style->tab.tab_minimize_button;
582 nk_zero_struct(*button);
583 button->normal = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
584 button->hover = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
585 button->active = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
586 button->border_color = nk_rgba(0,0,0,0);
587 button->text_background = table[NK_COLOR_TAB_HEADER];
588 button->text_normal = table[NK_COLOR_TEXT];
589 button->text_hover = table[NK_COLOR_TEXT];
590 button->text_active = table[NK_COLOR_TEXT];
591 button->padding =
nk_vec2(2.0f,2.0f);
592 button->touch_padding =
nk_vec2(0.0f,0.0f);
593 button->userdata = nk_handle_ptr(0);
594 button->text_alignment = NK_TEXT_CENTERED;
595 button->border = 0.0f;
596 button->rounding = 0.0f;
597 button->color_factor_text = 1.0f;
598 button->color_factor_background = 1.0f;
599 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
600 button->draw_begin = 0;
601 button->draw_end = 0;
602 style->tab.tab_maximize_button =*button;
605 button = &style->tab.node_minimize_button;
606 nk_zero_struct(*button);
607 button->normal = nk_style_item_color(table[NK_COLOR_WINDOW]);
608 button->hover = nk_style_item_color(table[NK_COLOR_WINDOW]);
609 button->active = nk_style_item_color(table[NK_COLOR_WINDOW]);
610 button->border_color = nk_rgba(0,0,0,0);
611 button->text_background = table[NK_COLOR_TAB_HEADER];
612 button->text_normal = table[NK_COLOR_TEXT];
613 button->text_hover = table[NK_COLOR_TEXT];
614 button->text_active = table[NK_COLOR_TEXT];
615 button->padding =
nk_vec2(2.0f,2.0f);
616 button->touch_padding =
nk_vec2(0.0f,0.0f);
617 button->userdata = nk_handle_ptr(0);
618 button->text_alignment = NK_TEXT_CENTERED;
619 button->border = 0.0f;
620 button->rounding = 0.0f;
621 button->color_factor_text = 1.0f;
622 button->color_factor_background = 1.0f;
623 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
624 button->draw_begin = 0;
625 button->draw_end = 0;
626 style->tab.node_maximize_button =*button;
629 win = &style->window;
630 win->header.align = NK_HEADER_RIGHT;
631 win->header.close_symbol = NK_SYMBOL_X;
632 win->header.minimize_symbol = NK_SYMBOL_MINUS;
633 win->header.maximize_symbol = NK_SYMBOL_PLUS;
634 win->header.normal = nk_style_item_color(table[NK_COLOR_HEADER]);
635 win->header.hover = nk_style_item_color(table[NK_COLOR_HEADER]);
636 win->header.active = nk_style_item_color(table[NK_COLOR_HEADER]);
637 win->header.label_normal = table[NK_COLOR_TEXT];
638 win->header.label_hover = table[NK_COLOR_TEXT];
639 win->header.label_active = table[NK_COLOR_TEXT];
640 win->header.label_padding =
nk_vec2(4,4);
641 win->header.padding =
nk_vec2(4,4);
642 win->header.spacing =
nk_vec2(0,0);
645 button = &style->window.header.close_button;
646 nk_zero_struct(*button);
647 button->normal = nk_style_item_color(table[NK_COLOR_HEADER]);
648 button->hover = nk_style_item_color(table[NK_COLOR_HEADER]);
649 button->active = nk_style_item_color(table[NK_COLOR_HEADER]);
650 button->border_color = nk_rgba(0,0,0,0);
651 button->text_background = table[NK_COLOR_HEADER];
652 button->text_normal = table[NK_COLOR_TEXT];
653 button->text_hover = table[NK_COLOR_TEXT];
654 button->text_active = table[NK_COLOR_TEXT];
655 button->padding =
nk_vec2(0.0f,0.0f);
656 button->touch_padding =
nk_vec2(0.0f,0.0f);
657 button->userdata = nk_handle_ptr(0);
658 button->text_alignment = NK_TEXT_CENTERED;
659 button->border = 0.0f;
660 button->rounding = 0.0f;
661 button->color_factor_text = 1.0f;
662 button->color_factor_background = 1.0f;
663 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
664 button->draw_begin = 0;
665 button->draw_end = 0;
668 button = &style->window.header.minimize_button;
669 nk_zero_struct(*button);
670 button->normal = nk_style_item_color(table[NK_COLOR_HEADER]);
671 button->hover = nk_style_item_color(table[NK_COLOR_HEADER]);
672 button->active = nk_style_item_color(table[NK_COLOR_HEADER]);
673 button->border_color = nk_rgba(0,0,0,0);
674 button->text_background = table[NK_COLOR_HEADER];
675 button->text_normal = table[NK_COLOR_TEXT];
676 button->text_hover = table[NK_COLOR_TEXT];
677 button->text_active = table[NK_COLOR_TEXT];
678 button->padding =
nk_vec2(0.0f,0.0f);
679 button->touch_padding =
nk_vec2(0.0f,0.0f);
680 button->userdata = nk_handle_ptr(0);
681 button->text_alignment = NK_TEXT_CENTERED;
682 button->border = 0.0f;
683 button->rounding = 0.0f;
684 button->color_factor_text = 1.0f;
685 button->color_factor_background = 1.0f;
686 button->disabled_factor = NK_WIDGET_DISABLED_FACTOR;
687 button->draw_begin = 0;
688 button->draw_end = 0;
691 win->background = table[NK_COLOR_WINDOW];
692 win->fixed_background = nk_style_item_color(table[NK_COLOR_WINDOW]);
693 win->border_color = table[NK_COLOR_BORDER];
694 win->popup_border_color = table[NK_COLOR_BORDER];
695 win->combo_border_color = table[NK_COLOR_BORDER];
696 win->contextual_border_color = table[NK_COLOR_BORDER];
697 win->menu_border_color = table[NK_COLOR_BORDER];
698 win->group_border_color = table[NK_COLOR_BORDER];
699 win->tooltip_border_color = table[NK_COLOR_BORDER];
700 win->scaler = nk_style_item_color(table[NK_COLOR_TEXT]);
702 win->rounding = 0.0f;
704 win->scrollbar_size =
nk_vec2(10,10);
705 win->min_size =
nk_vec2(64,64);
707 win->combo_border = 1.0f;
708 win->contextual_border = 1.0f;
709 win->menu_border = 1.0f;
710 win->group_border = 1.0f;
711 win->tooltip_border = 1.0f;
712 win->popup_border = 1.0f;
714 win->min_row_height_padding = 8;
717 win->group_padding =
nk_vec2(4,4);
718 win->popup_padding =
nk_vec2(4,4);
719 win->combo_padding =
nk_vec2(4,4);
720 win->contextual_padding =
nk_vec2(4,4);
721 win->menu_padding =
nk_vec2(4,4);
722 win->tooltip_padding =
nk_vec2(4,4);
733 ctx->stacks.fonts.head = 0;
740 struct nk_config_stack_user_font *font_stack;
741 struct nk_config_stack_user_font_element *element;
746 font_stack = &ctx->stacks.fonts;
747 NK_ASSERT(font_stack->head < (
int)NK_LEN(font_stack->elements));
748 if (font_stack->head >= (
int)NK_LEN(font_stack->elements))
751 element = &font_stack->elements[font_stack->head++];
752 element->address = &ctx->style.font;
753 element->old_value = ctx->style.font;
754 ctx->style.font = font;
760 struct nk_config_stack_user_font *font_stack;
761 struct nk_config_stack_user_font_element *element;
766 font_stack = &ctx->stacks.fonts;
767 NK_ASSERT(font_stack->head > 0);
768 if (font_stack->head < 1)
771 element = &font_stack->elements[--font_stack->head];
772 *element->address = element->old_value;
775#define NK_STYLE_PUSH_IMPLEMENATION(prefix, type, stack) \
776nk_style_push_##type(struct nk_context *ctx, prefix##_##type *address, prefix##_##type value)\
778 struct nk_config_stack_##type * type_stack;\
779 struct nk_config_stack_##type##_element *element;\
782 type_stack = &ctx->stacks.stack;\
783 NK_ASSERT(type_stack->head < (int)NK_LEN(type_stack->elements));\
784 if (type_stack->head >= (int)NK_LEN(type_stack->elements))\
786 element = &type_stack->elements[type_stack->head++];\
787 element->address = address;\
788 element->old_value = *address;\
792#define NK_STYLE_POP_IMPLEMENATION(type, stack) \
793nk_style_pop_##type(struct nk_context *ctx)\
795 struct nk_config_stack_##type *type_stack;\
796 struct nk_config_stack_##type##_element *element;\
799 type_stack = &ctx->stacks.stack;\
800 NK_ASSERT(type_stack->head > 0);\
801 if (type_stack->head < 1)\
803 element = &type_stack->elements[--type_stack->head];\
804 *element->address = element->old_value;\
807NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(
struct nk, style_item, style_items)
808NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(nk,
float, floats)
809NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(
struct nk, vec2, vectors)
810NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(nk,flags, flags)
811NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(
struct nk,color, colors)
813NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(style_item, style_items)
814NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(
float,floats)
815NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(vec2, vectors)
816NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(flags,flags)
817NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(color,colors)
820nk_style_set_cursor(
struct nk_context *ctx,
enum nk_style_cursor c)
826 if (style->cursors[c]) {
827 style->cursor_active = style->cursors[c];
835 ctx->style.cursor_visible = nk_true;
840 ctx->style.cursor_visible = nk_false;
843nk_style_load_cursor(
struct nk_context *ctx,
enum nk_style_cursor cursor,
850 style->cursors[cursor] = c;
860 for (i = 0; i < NK_CURSOR_COUNT; ++i)
861 style->cursors[i] = &cursors[i];
862 style->cursor_visible = nk_true;
main API and documentation file
NK_API void nk_layout_reset_min_row_height(struct nk_context *)
Reset the currently used minimum row height back to font_height + text_padding + padding