Beispiel #1
0
 public static unsafe bool Selectable(string label, bool isSelected, SelectableFlags flags, Vector2 size)
 {
     fixed(byte *bytes = System.Text.Encoding.UTF8.GetBytes(label))
     {
         return(ImGuiNative.igSelectable(bytes, isSelected, flags, size));
     }
 }
 public static extern bool igSelectableEx(string label, ref bool p_selected, SelectableFlags flags, Vector2 size);
 public static extern bool igSelectable(string label, bool selected, SelectableFlags flags, Vector2 size);
Beispiel #4
0
 public static bool SelectableEx(string label, ref bool isSelected, SelectableFlags flags, Vector2 size)
 {
     return(ImGuiNative.igSelectableEx(label, ref isSelected, flags, size));
 }
Beispiel #5
0
 public static bool Selectable(string label, bool isSelected, SelectableFlags flags)
 {
     return(Selectable(label, isSelected, flags, new Vector2()));
 }
Beispiel #6
0
 public static bool SelectableEx(string label, ref bool isSelected, SelectableFlags flags, Vector2 size)
 {
     return ImGuiNative.igSelectableEx(label, ref isSelected, flags, size);
 }
Beispiel #7
0
 public static bool Selectable(string label, bool isSelected, SelectableFlags flags)
 {
     return Selectable(label, isSelected, flags, new Vector2());
 }
Beispiel #8
0
 public static extern bool igSelectableEx(string label, ref bool p_selected, SelectableFlags flags, Vector2 size);
Beispiel #9
0
 public static extern bool igSelectable(string label, bool selected, SelectableFlags flags, Vector2 size);
Beispiel #10
0
 public static bool Selectable(string label, bool isSelected, SelectableFlags flags, Vector2 size)
 {
     return(ImGuiNative.igSelectable(utf8String(label), isSelected, flags, size));
 }
Beispiel #11
0
        public static bool selectable(String label, Vector2 sizeArg, SelectableFlags flags = 0)
        {
            bool temp = false;

            return(selectable(label, ref temp, sizeArg, flags));
        }
Beispiel #12
0
        public static bool selectable(String label, ref bool selected, Vector2 sizeArg, SelectableFlags flags = 0)
        {
            Window win = currentWindow;

            if (win.skipItems == true)
            {
                return(false);
            }

            win.addItem(style.selectable.padding);

            UInt32  id        = win.getChildId(label);
            Vector2 labelSize = style.font.size(label);
            Vector2 size      = new Vector2(sizeArg.X != 0 ? sizeArg.X : labelSize.X, sizeArg.Y != 0 ? sizeArg.Y : labelSize.Y);
            Rect    r         = Rect.fromPosSize(win.cursorScreenPosition, size);

            bool        hovered;
            bool        held;
            ButtonFlags buttonFlags = 0;

            if (flags.HasFlag(SelectableFlags.Menu))
            {
                buttonFlags |= ButtonFlags.PressedOnClick;
            }
            if (flags.HasFlag(SelectableFlags.MenuItem))
            {
                buttonFlags |= ButtonFlags.PressedOnClick | ButtonFlags.PressedOnRelease;
            }
            if (flags.HasFlag(SelectableFlags.Disabled))
            {
                buttonFlags |= ButtonFlags.Disabled;
            }

            bool pressed = buttonBehavior(r, id, out hovered, out held, buttonFlags);

            if (hovered)
            {
                Color4 col = style.selectable.textHoverActive;
                win.canvas.addRectFilled(r, col);
            }

            win.canvas.addText(r, style.selectable.textNormal, label, style.selectable.textAlignment);

            //close popups
            if (pressed && flags.HasFlag(SelectableFlags.DontClosePopups) == false && win.flags.HasFlag(Window.Flags.Popup))
            {
                closeCurrentPopup();
            }

            if (pressed)
            {
                selected = !selected;
            }


            win.addItem(size);

            return(pressed);
        }
Beispiel #13
0
        public bool Selectable(string label, bool selected, SelectableFlags flags)
        {
            bool ret = EffekseerNativePINVOKE.GUIManager_Selectable__SWIG_0(swigCPtr, label, selected, (int)flags);

            return(ret);
        }
Beispiel #14
0
 public static bool Selectable(string label, bool isSelected, SelectableFlags flags, Vector2 size)
 {
     return(ImGuiNative.igSelectable(label, isSelected, flags, size.ToNumericsVector2()));
 }
Beispiel #15
0
        public static bool selectable(String label, ref bool selected, Vector2 sizeArg, SelectableFlags flags = 0)
        {
            Window win = currentWindow;

            if (win.skipItems == true)
            {
                return(false);
            }

            UInt32  id        = win.getChildId(label);
            Vector2 labelSize = style.textSize(label);
            Vector2 size      = new Vector2(sizeArg.X != 0 ? sizeArg.X : labelSize.X, sizeArg.Y != 0 ? sizeArg.Y : labelSize.Y);
            Vector2 rectPos   = win.cursorScreenPosition + style.framePadding;
            Rect    r         = Rect.fromPosSize(rectPos, size);

            if (flags.HasFlag(SelectableFlags.HasToggle) == false) //only move the draw cursor after the toggle is drawn
            {
                win.addItem(size);
            }

            bool        hovered;
            bool        held;
            ButtonFlags buttonFlags = 0;

            if (flags.HasFlag(SelectableFlags.Menu))
            {
                buttonFlags |= ButtonFlags.PressedOnClick;
            }
            if (flags.HasFlag(SelectableFlags.MenuItem))
            {
                buttonFlags |= ButtonFlags.PressedOnClick | ButtonFlags.PressedOnRelease;
            }
            if (flags.HasFlag(SelectableFlags.Disabled))
            {
                buttonFlags |= ButtonFlags.Disabled;
            }

            bool pressed = buttonBehavior(r, id, out hovered, out held, buttonFlags);

            if (hovered)
            {
                Color4 col = style.getColor((hovered == true ? ElementColor.HeaderHovered : ElementColor.Header));
                win.canvas.addRectFilled(r, col);
            }

            win.canvas.addText(r, style.getColor(ElementColor.Text), label, Alignment.Default);

            //close popups
            if (pressed && flags.HasFlag(SelectableFlags.DontClosePopups) == false && win.flags.HasFlag(Window.Flags.Popup))
            {
                closeCurrentPopup();
            }

            if (pressed)
            {
                selected = !selected;
            }

            return(pressed);
        }