public void WindowSetFocus(string name)
 {
     fixed(char *name_ptr = name)
     {
         Nk.nk_window_set_focus(_ctx, name_ptr);
     }
 }
 public uint CheckFlagsText(string text, uint flags, uint value)
 {
     fixed(char *text_ptr = text)
     {
         return(Nk.nk_check_flags_text(_ctx, text_ptr, text.Length, flags, value));
     }
 }
 public uint CheckFlagsLabel(string label, uint flags, uint value)
 {
     fixed(char *label_ptr = label)
     {
         return(Nk.nk_check_flags_label(_ctx, label_ptr, flags, value));
     }
 }
 public bool SelectLabel(string str, Alignment align, int value)
 {
     fixed(char *str_ptr = str)
     {
         return(Nk.nk_select_label(_ctx, str_ptr, align, value) != 0);
     }
 }
 public bool SelectImageText(NkImage img, string str, Alignment align, int value)
 {
     fixed(char *str_ptr = str)
     {
         return(Nk.nk_select_image_text(_ctx, img, str_ptr, str.Length, align, value) != 0);
     }
 }
 public bool ButtonSymbolLabelStyled(nk_style_button style, NkSymbolType symbol, string title, Alignment align)
 {
     fixed(char *title_ptr = title)
     {
         return(Nk.nk_button_symbol_label_styled(_ctx, style, symbol, title_ptr, align) != 0);
     }
 }
 public bool ButtonImageLabel(NkImage img, string label, Alignment align)
 {
     fixed(char *label_ptr = label)
     {
         return(Nk.nk_button_image_label(_ctx, img, label_ptr, align) != 0);
     }
 }
 public void TextWrap(string str)
 {
     fixed(char *str_ptr = str)
     {
         Nk.nk_text_wrap(_ctx, str_ptr, str.Length);
     }
 }
 public void Label(string str, Alignment alignment)
 {
     fixed(char *str_ptr = str)
     {
         Nk.nk_label(_ctx, str_ptr, alignment);
     }
 }
 public void TextWrapColored(string str, NkColor color)
 {
     fixed(char *str_ptr = str)
     {
         Nk.nk_text_wrap_colored(_ctx, str_ptr, str.Length, color);
     }
 }
 public void Text(string str, Alignment alignment)
 {
     fixed(char *str_ptr = str)
     {
         Nk.nk_text_(_ctx, str_ptr, str.Length, alignment);
     }
 }
 public void TextColored(string str, Alignment alignment, NkColor color)
 {
     fixed(char *str_ptr = str)
     {
         Nk.nk_text_colored(_ctx, str_ptr, str.Length, alignment, color);
     }
 }
 public void LayoutRow(NkLayoutFormat fmt, float height, int cols, float[] ratio)
 {
     fixed(float *ptr = ratio)
     {
         Nk.nk_layout_row(_ctx, fmt, height, cols, ptr);
     }
 }
 public void InputGlyph(string glyph)
 {
     fixed(char *glyph_ptr = glyph)
     {
         Nk.nk_input_glyph(_ctx, glyph_ptr);
     }
 }
 public bool ButtonSymbolText(NkSymbolType symbol, string text, Alignment align)
 {
     fixed(char *text_ptr = text)
     {
         return(Nk.nk_button_symbol_text(_ctx, symbol, text_ptr, text.Length, align) != 0);
     }
 }
 public void LabelColored(string str, Alignment align, NkColor color)
 {
     fixed(char *str_ptr = str)
     {
         Nk.nk_label_colored(_ctx, str_ptr, align, color);
     }
 }
 public bool ButtonSymbolLabel(NkSymbolType symbol, string label, Alignment align)
 {
     fixed(char *label_ptr = label)
     {
         return(Nk.nk_button_symbol_label(_ctx, symbol, label_ptr, align) != 0);
     }
 }
 public void LabelWrap(string str)
 {
     fixed(char *str_ptr = str)
     {
         Nk.nk_label_wrap(_ctx, str_ptr);
     }
 }
 public bool ButtonImageText(NkImage img, string text, Alignment align)
 {
     fixed(char *text_ptr = text)
     {
         return(Nk.nk_button_image_text(_ctx, img, text_ptr, text.Length, align) != 0);
     }
 }
 public void LabelColoredWrap(string str, NkColor color)
 {
     fixed(char *str_ptr = str)
     {
         Nk.nk_label_colored_wrap(_ctx, str_ptr, color);
     }
 }
 public bool SelectableText(string str, Alignment align, ref int value)
 {
     fixed(char *str_ptr = str)
     {
         return(Nk.nk_selectable_text(_ctx, str_ptr, str.Length, align, ref value) != 0);
     }
 }
 public bool ButtonTextStyled(nk_style_button style, string title)
 {
     fixed(char *title_ptr = title)
     {
         return(Nk.nk_button_text_styled(_ctx, style, title_ptr, title.Length) != 0);
     }
 }
 public bool SelectImageLabel(NkImage img, string str, Alignment align, int value)
 {
     fixed(char *str_ptr = str)
     {
         return(Nk.nk_select_image_label(_ctx, img, str_ptr, align, value) != 0);
     }
 }
 public bool ButtonText(string title)
 {
     fixed(char *title_ptr = title)
     {
         return(Nk.nk_button_text(_ctx, title_ptr, title.Length) != 0);
     }
 }
 public bool CheckText(string text, bool active)
 {
     fixed(char *text_ptr = text)
     {
         return(Nk.nk_check_text(_ctx, text_ptr, text.Length, active ? 1 : 0) != 0);
     }
 }
 public bool ButtonLabelStyled(nk_style_button style, string title)
 {
     fixed(char *title_ptr = title)
     {
         return(Nk.nk_button_label_styled(_ctx, style, title_ptr) != 0);
     }
 }
 public bool CheckLabel(string label, bool active)
 {
     fixed(char *label_ptr = label)
     {
         return(Nk.nk_check_label(_ctx, label_ptr, active ? 1 : 0) != 0);
     }
 }
 public bool ButtonLabel(string title)
 {
     fixed(char *title_ptr = title)
     {
         return(Nk.nk_button_label(_ctx, title_ptr) != 0);
     }
 }
Example #29
0
        public float text_width(NkHandle h, float height, char *s, int length)
        {
            char  unicode;
            int   textLen;
            float textWidth = 0;

            if (s == null || length == 0)
            {
                return(0);
            }
            var scale    = height / Info.height;
            var glyphLen = textLen = Nk.nk_utf_decode(s, &unicode, length);

            if (glyphLen == 0)
            {
                return(0);
            }
            while (textLen <= length && glyphLen != 0)
            {
                if (unicode == 0xFFFD)
                {
                    break;
                }
                var g = Nk.nk_font_find_glyph(this, unicode);
                textWidth += g->xadvance * scale;
                glyphLen   = Nk.nk_utf_decode(s + textLen, &unicode, length - textLen);
                textLen   += glyphLen;
            }
            return(textWidth);
        }
 public void WindowShowIf(string name, NkShowStates s, int cond)
 {
     fixed(char *name_ptr = name)
     {
         Nk.nk_window_show_if(_ctx, name_ptr, s, cond);
     }
 }