package vendor:microui

⌘K
Ctrl+K
or
/

    Overview

    ** Original work: Copyright (c) 2020 rxi ** Modified work: Copyright (c) 2020 oskarnp ** Modified work: Copyright (c) 2021 gingerBill ** ** Permission is hereby granted, free of charge, to any person obtaining a copy ** of this software and associated documentation files (the "Software"), to ** deal in the Software without restriction, including without limitation the ** rights to use, copy, modify, merge, publish, distribute, sublicense, and/or ** sell copies of the Software, and to permit persons to whom the Software is ** furnished to do so, subject to the following conditions: ** ** The above copyright notice and this permission notice shall be included in ** all copies or substantial portions of the Software. ** ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS ** IN THE SOFTWARE.

    Index

    Procedures (84)
    Procedure Groups (2)

    Types

    Clip ¶

    Clip :: enum u32 {
    	NONE, 
    	PART, 
    	ALL, 
    }
    Related Procedures With Returns

    Color ¶

    Color :: struct {
    	r: u8,
    	g: u8,
    	b: u8,
    	a: u8,
    }
    Related Procedures With Parameters

    Color_Type ¶

    Color_Type :: enum u32 {
    	TEXT, 
    	SELECTION_BG, 
    	BORDER, 
    	WINDOW_BG, 
    	TITLE_BG, 
    	TITLE_TEXT, 
    	PANEL_BG, 
    	BUTTON, 
    	BUTTON_HOVER = 8, 
    	BUTTON_FOCUS = 9, 
    	BASE, 
    	BASE_HOVER   = 11, 
    	BASE_FOCUS   = 12, 
    	SCROLL_BASE, 
    	SCROLL_THUMB, 
    }
    Related Procedures With Parameters

    Command ¶

    Command :: struct {
    	variant: Command_Variant,
    	size:    i32,
    }

    Command_Clip ¶

    Command_Clip :: struct {
    	using command: Command,
    	rect:    Rect,
    }

    Command_Icon ¶

    Command_Icon :: struct {
    	using command: Command,
    	rect:    Rect,
    	id:      Icon,
    	color:   Color,
    }

    Command_Jump ¶

    Command_Jump :: struct {
    	using command: Command,
    	dst:     rawptr,
    }

    Command_Rect ¶

    Command_Rect :: struct {
    	using command: Command,
    	rect:    Rect,
    	color:   Color,
    }

    Command_Text ¶

    Command_Text :: struct {
    	using command: Command,
    	font:    Font,
    	pos:     Vec2,
    	color:   Color,
    	str:     string,
    }

    Command_Variant ¶

    Command_Variant :: union {
    	^Command_Jump, 
    	^Command_Clip, 
    	^Command_Rect, 
    	^Command_Text, 
    	^Command_Icon, 
    }
    Related Procedures With Returns

    Container ¶

    Container :: struct {
    	head:         ^Command,
    	tail:         ^Command,
    	rect:         Rect,
    	body:         Rect,
    	content_size: Vec2,
    	scroll:       Vec2,
    	zindex:       i32,
    	open:         b32,
    }
    Related Procedures With Parameters
    Related Procedures With Returns

    Context ¶

    Context :: struct {
    	// callbacks 
    	text_width:          proc(font: Font, str: string) -> i32,
    	text_height:         proc(font: Font) -> i32,
    	draw_frame:          proc(ctx: ^Context, rect: Rect, colorid: Color_Type),
    	// core state 
    	_style:              Style,
    	style:               ^Style,
    	hover_id:            Id,
    	focus_id:            Id,
    	last_id:             Id,
    	last_rect:           Rect,
    	last_zindex:         i32,
    	updated_focus:       b32,
    	frame:               Frame_Index,
    	hover_root:          ^Container,
    	next_hover_root:     ^Container,
    	scroll_target:       ^Container,
    	number_edit_buf:     [127]u8,
    	number_edit_len:     int,
    	number_edit_id:      Id,
    	// stacks 
    	command_list:        Stack($T=u8, $N=262144),
    	root_list:           Stack($T=^Container, $N=32),
    	container_stack:     Stack($T=^Container, $N=32),
    	clip_stack:          Stack($T=Rect, $N=32),
    	id_stack:            Stack($T=Id, $N=32),
    	layout_stack:        Stack($T=Layout, $N=16),
    	// retained state pools 
    	container_pool:      [48]Pool_Item,
    	containers:          [48]Container,
    	treenode_pool:       [48]Pool_Item,
    	// input state 
    	mouse_pos:           Vec2,
    	last_mouse_pos:      Vec2,
    	mouse_delta:         Vec2,
    	scroll_delta:        Vec2,
    	mouse_down_bits:     Mouse_Set,
    	mouse_pressed_bits:  Mouse_Set,
    	mouse_released_bits: Mouse_Set,
    	key_down_bits:       Key_Set,
    	key_pressed_bits:    Key_Set,
    	_text_store:         [1024]u8,
    	text_input:          strings.Builder,
    	// uses `_text_store` as backing store with nil_allocator.
    	textbox_state:       text_edit.State,
    	textbox_offset:      i32,
    }
    Related Procedures With Parameters

    Font ¶

    Font :: distinct rawptr
    Related Procedures With Parameters

    Frame_Index ¶

    Frame_Index :: distinct i32

    Icon ¶

    Icon :: enum u32 {
    	NONE, 
    	CLOSE, 
    	CHECK, 
    	COLLAPSED, 
    	EXPANDED, 
    	RESIZE, 
    }
    Related Procedures With Parameters

    Id ¶

    Id :: distinct u32
    Related Procedures With Parameters
    Related Procedures With Returns

    Key ¶

    Key :: enum u32 {
    	SHIFT, 
    	CTRL, 
    	ALT, 
    	BACKSPACE, 
    	DELETE, 
    	RETURN, 
    	LEFT, 
    	RIGHT, 
    	HOME, 
    	END, 
    	A, 
    	X, 
    	C, 
    	V, 
    }
    Related Procedures With Parameters

    Key_Set ¶

    Key_Set :: distinct bit_set[Key; u32]

    Layout ¶

    Layout :: struct {
    	body:       Rect,
    	next:       Rect,
    	position:   Vec2,
    	size:       Vec2,
    	max:        Vec2,
    	widths:     [16]i32,
    	items:      i32,
    	item_index: i32,
    	next_row:   i32,
    	next_type:  Layout_Type,
    	indent:     i32,
    }
    Related Procedures With Returns

    Layout_Type ¶

    Layout_Type :: enum int {
    	NONE     = 0, 
    	RELATIVE = 1, 
    	ABSOLUTE = 2, 
    }

    Mouse ¶

    Mouse :: enum u32 {
    	LEFT, 
    	RIGHT, 
    	MIDDLE, 
    }
    Related Procedures With Parameters

    Mouse_Set ¶

    Mouse_Set :: distinct bit_set[Mouse; u32]

    Opt ¶

    Opt :: enum u32 {
    	ALIGN_CENTER, 
    	ALIGN_RIGHT, 
    	NO_INTERACT, 
    	NO_FRAME, 
    	NO_RESIZE, 
    	NO_SCROLL, 
    	NO_CLOSE, 
    	NO_TITLE, 
    	HOLD_FOCUS, 
    	AUTO_SIZE, 
    	POPUP, 
    	CLOSED, 
    	EXPANDED, 
    }

    Pool_Item ¶

    Pool_Item :: struct {
    	id:          Id,
    	last_update: Frame_Index,
    }
    Related Procedures With Parameters

    Result ¶

    Result :: enum u32 {
    	ACTIVE, 
    	SUBMIT, 
    	CHANGE, 
    }

    Result_Set ¶

    Result_Set :: bit_set[Result; u32]

    Stack ¶

    Stack :: struct($T: typeid, $N: int = ) {}
    Related Procedures With Parameters

    Style ¶

    Style :: struct {
    	font:           Font,
    	size:           Vec2,
    	padding:        i32,
    	spacing:        i32,
    	indent:         i32,
    	title_height:   i32,
    	footer_height:  i32,
    	scrollbar_size: i32,
    	thumb_size:     i32,
    	colors:         [Color_Type]Color,
    }

    Vec2 ¶

    Vec2 :: distinct [2]i32
    Related Procedures With Parameters

    Constants

    CLIP_STACK_SIZE ¶

    CLIP_STACK_SIZE :: #config(MICROUI_CLIP_STACK_SIZE, 32)

    COMMAND_LIST_SIZE ¶

    COMMAND_LIST_SIZE :: #config(MICROUI_COMMAND_LIST_SIZE, 256 * 1024)

    CONTAINER_POOL_SIZE ¶

    CONTAINER_POOL_SIZE :: #config(MICROUI_CONTAINER_POOL_SIZE, 48)

    CONTAINER_STACK_SIZE ¶

    CONTAINER_STACK_SIZE :: #config(MICROUI_CONTAINER_STACK_SIZE, 32)

    DEFAULT_ATLAS_FONT ¶

    DEFAULT_ATLAS_FONT :: int(len(Icon) + 2)

    DEFAULT_ATLAS_HEIGHT ¶

    DEFAULT_ATLAS_HEIGHT :: 128

    DEFAULT_ATLAS_ICON_CHECK ¶

    DEFAULT_ATLAS_ICON_CHECK :: int(Icon.CHECK)

    DEFAULT_ATLAS_ICON_CLOSE ¶

    DEFAULT_ATLAS_ICON_CLOSE :: int(Icon.CLOSE)

    DEFAULT_ATLAS_ICON_COLLAPSED ¶

    DEFAULT_ATLAS_ICON_COLLAPSED :: int(Icon.COLLAPSED)

    DEFAULT_ATLAS_ICON_EXPANDED ¶

    DEFAULT_ATLAS_ICON_EXPANDED :: int(Icon.EXPANDED)

    DEFAULT_ATLAS_ICON_RESIZE ¶

    DEFAULT_ATLAS_ICON_RESIZE :: int(Icon.RESIZE)

    DEFAULT_ATLAS_WHITE ¶

    DEFAULT_ATLAS_WHITE :: int(len(Icon) + 1)

    DEFAULT_ATLAS_WIDTH ¶

    DEFAULT_ATLAS_WIDTH :: 128

    ID_STACK_SIZE ¶

    ID_STACK_SIZE :: #config(MICROUI_ID_STACK_SIZE, 32)

    LAYOUT_STACK_SIZE ¶

    LAYOUT_STACK_SIZE :: #config(MICROUI_LAYOUT_STACK_SIZE, 16)

    MAX_FMT ¶

    MAX_FMT :: #config(MICROUI_MAX_FMT, 127)

    MAX_TEXT_STORE ¶

    MAX_TEXT_STORE :: #config(MICROUI_MAX_TEXT_STORE, 1024)

    MAX_WIDTHS ¶

    MAX_WIDTHS :: #config(MICROUI_MAX_WIDTHS, 16)

    ROOT_LIST_SIZE ¶

    ROOT_LIST_SIZE :: #config(MICROUI_ROOT_LIST_SIZE, 32)

    SLIDER_FMT ¶

    SLIDER_FMT :: #config(MICROUI_SLIDER_FMT, "%.2f")

    TREENODE_POOL_SIZE ¶

    TREENODE_POOL_SIZE :: #config(MICROUI_TREENODE_POOL_SIZE, 48)

    Variables

    default_atlas ¶

    default_atlas: [136]Rect = …

    default_atlas_alpha ¶

    default_atlas_alpha: [16384]u8 = …

    default_style ¶

    default_style: Style = …

    unclipped_rect ¶

    unclipped_rect: Rect = …

    Procedures

    begin ¶

    begin :: proc(ctx: ^Context) {…}

    begin_panel ¶

    begin_panel :: proc(ctx: ^Context, name: string, opt: Options = Options{}) {…}

    begin_popup ¶

    begin_popup :: proc(ctx: ^Context, name: string) -> bool {…}

    begin_treenode ¶

    begin_treenode :: proc(ctx: ^Context, label: string, opt: Options = Options{}) -> bit_set[Result; u32] {…}

    begin_window ¶

    begin_window :: proc(ctx: ^Context, title: string, rect: Rect, opt: Options = Options{}) -> bool {…}

    bring_to_front ¶

    bring_to_front :: proc(ctx: ^Context, cnt: ^Container) {…}

    button ¶

    button :: proc(ctx: ^Context, label: string, icon: Icon = .NONE, opt: Options = {.ALIGN_CENTER}) -> (res: bit_set[Result; u32]) {…}

    check_clip ¶

    check_clip :: proc(ctx: ^Context, r: Rect) -> Clip {…}

    checkbox ¶

    checkbox :: proc(ctx: ^Context, label: string, state: ^bool) -> (res: bit_set[Result; u32]) {…}

    default_atlas_text_height ¶

    default_atlas_text_height :: proc(font: Font) -> i32 {…}

    default_atlas_text_width ¶

    default_atlas_text_width :: proc(font: Font, text: string) -> (width: i32) {…}

    draw_box ¶

    draw_box :: proc(ctx: ^Context, rect: Rect, color: Color) {…}

    draw_control_frame ¶

    draw_control_frame :: proc(ctx: ^Context, id: Id, rect: Rect, colorid: Color_Type, opt: Options = Options{}) {…}

    draw_control_text ¶

    draw_control_text :: proc(ctx: ^Context, str: string, rect: Rect, colorid: Color_Type, opt: Options = Options{}) {…}

    draw_icon ¶

    draw_icon :: proc(ctx: ^Context, id: Icon, rect: Rect, color: Color) {…}

    draw_rect ¶

    draw_rect :: proc(ctx: ^Context, rect: Rect, color: Color) {…}

    draw_text ¶

    draw_text :: proc(ctx: ^Context, font: Font, str: string, pos: Vec2, color: Color) {…}

    end ¶

    end :: proc(ctx: ^Context) {…}

    end_panel ¶

    end_panel :: proc(ctx: ^Context) {…}

    end_popup ¶

    end_popup :: proc(ctx: ^Context) {…}

    end_treenode ¶

    end_treenode :: proc(ctx: ^Context) {…}

    end_window ¶

    end_window :: proc(ctx: ^Context) {…}

    expand_rect ¶

    expand_rect :: proc(rect: Rect, n: i32) -> Rect {…}

    get_clip_rect ¶

    get_clip_rect :: proc(ctx: ^Context) -> Rect {…}

    get_container ¶

    get_container :: proc(ctx: ^Context, name: string, opt: Options = Options{}) -> ^Container {…}

    get_current_container ¶

    get_current_container :: proc(ctx: ^Context) -> ^Container {…}

    get_id_bytes ¶

    get_id_bytes :: proc(ctx: ^Context, bytes: []u8) -> Id {…}

    get_id_rawptr ¶

    get_id_rawptr :: proc(ctx: ^Context, data: rawptr, size: int) -> Id {…}

    get_id_string ¶

    get_id_string :: proc(ctx: ^Context, str: string) -> Id {…}

    get_id_uintptr ¶

    get_id_uintptr :: proc(ctx: ^Context, ptr: uintptr) -> Id {…}

    get_layout ¶

    get_layout :: proc(ctx: ^Context) -> ^Layout {…}
    header :: proc(ctx: ^Context, label: string, opt: Options = Options{}) -> bit_set[Result; u32] {…}

    init ¶

    init :: proc(ctx: ^Context, set_clipboard: proc(user_data: rawptr, text: string) -> (ok: bool) = nil, get_clipboard: proc(user_data: rawptr) -> (text: string, ok: bool) = nil, clipboard_user_data: rawptr = nil) {…}

    input_key_down ¶

    input_key_down :: proc(ctx: ^Context, key: Key) {…}

    input_key_up ¶

    input_key_up :: proc(ctx: ^Context, key: Key) {…}

    input_mouse_down ¶

    input_mouse_down :: proc(ctx: ^Context, x, y: i32, btn: Mouse) {…}

    input_mouse_move ¶

    input_mouse_move :: proc(ctx: ^Context, x, y: i32) {…}

    input_mouse_up ¶

    input_mouse_up :: proc(ctx: ^Context, x, y: i32, btn: Mouse) {…}

    input_scroll ¶

    input_scroll :: proc(ctx: ^Context, x, y: i32) {…}

    input_text ¶

    input_text :: proc(ctx: ^Context, text: string) {…}

    intersect_rects ¶

    intersect_rects :: proc(r1, r2: Rect) -> Rect {…}

    label ¶

    label :: proc(ctx: ^Context, text: string) {…}

    layout_begin_column ¶

    layout_begin_column :: proc(ctx: ^Context) {…}

    layout_column ¶

    layout_column :: proc(ctx: ^Context) -> bool {…}

    layout_end_column ¶

    layout_end_column :: proc(ctx: ^Context) {…}

    layout_height ¶

    layout_height :: proc(ctx: ^Context, height: i32) {…}

    layout_next ¶

    layout_next :: proc(ctx: ^Context) -> (res: Rect) {…}

    layout_row ¶

    layout_row :: proc(ctx: ^Context, widths: []i32, height: i32 = 0) {…}

    layout_row_items ¶

    layout_row_items :: proc(ctx: ^Context, items: i32, height: i32 = 0) {…}

    layout_set_next ¶

    layout_set_next :: proc(ctx: ^Context, r: Rect, relative: bool) {…}

    layout_width ¶

    layout_width :: proc(ctx: ^Context, width: i32) {…}

    mouse_over ¶

    mouse_over :: proc(ctx: ^Context, rect: Rect) -> bool {…}

    next_command ¶

    next_command :: proc "contextless" (ctx: ^Context, pcmd: ^^Command) -> bool {…}

    next_command_iterator ¶

    next_command_iterator :: proc "contextless" (ctx: ^Context, pcm: ^^Command) -> (Command_Variant, bool) {…}

    number ¶

    number :: proc(ctx: ^Context, value: ^f32, step: f32, fmt_string: string = SLIDER_FMT, opt: Options = {.ALIGN_CENTER}) -> (res: bit_set[Result; u32]) {…}

    number_textbox ¶

    number_textbox :: proc(ctx: ^Context, value: ^f32, r: Rect, id: Id, fmt_string: string) -> bool {…}

    open_popup ¶

    open_popup :: proc(ctx: ^Context, name: string) {…}

    pool_get ¶

    pool_get :: proc(ctx: ^Context, items: []Pool_Item, id: Id) -> (int, bool) {…}

    pool_init ¶

    pool_init :: proc(ctx: ^Context, items: []Pool_Item, id: Id) -> int {…}

    pool_update ¶

    pool_update :: proc(ctx: ^Context, item: ^Pool_Item) {…}

    pop ¶

    pop :: proc(stk: ^$T/Stack($T, $N)) {…}

    pop_clip_rect ¶

    pop_clip_rect :: proc(ctx: ^Context) {…}

    pop_id ¶

    pop_id :: proc(ctx: ^Context) {…}
    popup :: proc(ctx: ^Context, name: string) -> bool {…}
     

    This is scoped and is intended to be use in the condition of a if-statement

    push ¶

    push :: proc(stk: ^$T/Stack($T, $N), val: $T) {…}

    push_clip_rect ¶

    push_clip_rect :: proc(ctx: ^Context, rect: Rect) {…}

    push_command ¶

    push_command :: proc(ctx: ^Context, $Type: typeid, extra_size: int = 0) -> ^typeid {…}

    push_id_bytes ¶

    push_id_bytes :: proc(ctx: ^Context, bytes: []u8) {…}

    push_id_rawptr ¶

    push_id_rawptr :: proc(ctx: ^Context, data: rawptr, size: int) {…}

    push_id_string ¶

    push_id_string :: proc(ctx: ^Context, str: string) {…}

    push_id_uintptr ¶

    push_id_uintptr :: proc(ctx: ^Context, ptr: uintptr) {…}

    rect_overlaps_vec2 ¶

    rect_overlaps_vec2 :: proc(r: Rect, p: Vec2) -> bool {…}

    scoped_end_popup ¶

    scoped_end_popup :: proc(ctx: ^Context, _: string, ok: bool) {…}

    scoped_end_treenode ¶

    scoped_end_treenode :: proc(ctx: ^Context, _: string, _: Options, result_set: bit_set[Result; u32]) {…}

    scoped_end_window ¶

    scoped_end_window :: proc(ctx: ^Context, _: string, _: Rect, _: Options, ok: bool) {…}

    set_clip ¶

    set_clip :: proc(ctx: ^Context, rect: Rect) {…}

    set_focus ¶

    set_focus :: proc(ctx: ^Context, id: Id) {…}

    slider ¶

    slider :: proc(
    	ctx:        ^Context, 
    	value:      ^f32, 
    	low, high:  f32, 
    	step:       f32 = 0.0, 
    	fmt_string: string = SLIDER_FMT, 
    	opt:        Options = {.ALIGN_CENTER}, 
    ) -> (res: bit_set[Result; u32]) {…}

    text ¶

    text :: proc(ctx: ^Context, text: string) {…}

    textbox ¶

    textbox :: proc(ctx: ^Context, buf: []u8, textlen: ^int, opt: Options = Options{}) -> bit_set[Result; u32] {…}

    textbox_raw ¶

    textbox_raw :: proc(
    	ctx:     ^Context, 
    	textbuf: []u8, 
    	textlen: ^int, 
    	id:      Id, 
    	r:       Rect, 
    	opt:     Options = Options{}, 
    ) -> (res: bit_set[Result; u32]) {…}

    treenode ¶

    treenode :: proc(ctx: ^Context, label: string, opt: Options = Options{}) -> bit_set[Result; u32] {…}
     

    This is scoped and is intended to be use in the condition of a if-statement

    update_control ¶

    update_control :: proc(ctx: ^Context, id: Id, rect: Rect, opt: Options = Options{}) {…}

    window ¶

    window :: proc(ctx: ^Context, title: string, rect: Rect, opt: Options = Options{}) -> bool {…}
     

    This is scoped and is intended to be use in the condition of a if-statement

    Procedure Groups

    Source Files

    Generation Information

    Generated with odin version dev-2024-11 (vendor "odin") Windows_amd64 @ 2024-11-20 21:11:52.085431100 +0000 UTC