vfmt: keep the source fn type alias names, instead of the expanded fn declarations
parent
26c2654632
commit
d34c5b767b
|
@ -31,7 +31,8 @@ pub mut:
|
|||
pub fn new_builder(pref &pref.Preferences) Builder {
|
||||
rdir := os.real_path(pref.path)
|
||||
compiled_dir := if os.is_dir(rdir) { rdir } else { os.dir(rdir) }
|
||||
table := table.new_table()
|
||||
mut table := table.new_table()
|
||||
table.is_fmt = false
|
||||
if pref.use_color == .always {
|
||||
util.emanager.set_support_color(true)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
module ui
|
||||
|
||||
import gg
|
||||
import gx
|
||||
import eventbus
|
||||
|
||||
pub type DrawFn = fn (ctx &gg.Context, state voidptr)
|
||||
|
||||
pub type ClickFn = fn (e MouseEvent, func voidptr)
|
||||
|
||||
pub type KeyFn = fn (e KeyEvent, func voidptr)
|
||||
|
||||
pub type ScrollFn = fn (e ScrollEvent, func voidptr)
|
||||
|
||||
pub type MouseMoveFn = fn (e MouseMoveEvent, func voidptr)
|
||||
|
||||
[ref_only]
|
||||
pub struct Window {
|
||||
pub mut:
|
||||
ui &UI = voidptr(0)
|
||||
children []Widget
|
||||
child_window &Window = voidptr(0)
|
||||
parent_window &Window = voidptr(0)
|
||||
has_textbox bool // for initial focus
|
||||
tab_index int
|
||||
just_tabbed bool
|
||||
state voidptr
|
||||
draw_fn DrawFn
|
||||
title string
|
||||
mx f64
|
||||
my f64
|
||||
width int
|
||||
height int
|
||||
bg_color gx.Color
|
||||
click_fn ClickFn
|
||||
mouse_down_fn ClickFn
|
||||
mouse_up_fn ClickFn
|
||||
scroll_fn ScrollFn
|
||||
key_down_fn KeyFn
|
||||
char_fn KeyFn
|
||||
mouse_move_fn MouseMoveFn
|
||||
eventbus &eventbus.EventBus = eventbus.new()
|
||||
}
|
||||
|
||||
pub struct WindowConfig {
|
||||
pub:
|
||||
width int
|
||||
height int
|
||||
resizable bool
|
||||
title string
|
||||
always_on_top bool
|
||||
state voidptr
|
||||
draw_fn DrawFn
|
||||
bg_color gx.Color = default_window_color
|
||||
on_click ClickFn
|
||||
on_mouse_down ClickFn
|
||||
on_mouse_up ClickFn
|
||||
on_key_down KeyFn
|
||||
on_scroll ScrollFn
|
||||
on_mouse_move MouseMoveFn
|
||||
children []Widget
|
||||
font_path string
|
||||
// pub mut:
|
||||
// parent_window &Window
|
||||
}
|
|
@ -839,11 +839,13 @@ pub fn (table &Table) type_to_str(t Type) string {
|
|||
}
|
||||
}
|
||||
.function {
|
||||
if !table.is_fmt {
|
||||
info := sym.info as FnType
|
||||
res = table.fn_signature(info.func, {
|
||||
type_only: true
|
||||
})
|
||||
}
|
||||
}
|
||||
.map {
|
||||
if int(t) == map_type_idx {
|
||||
return 'map'
|
||||
|
|
|
@ -18,6 +18,7 @@ pub mut:
|
|||
redefined_fns []string
|
||||
fn_gen_types map[string][]Type // for generic functions
|
||||
cmod_prefix string // needed for table.type_to_str(Type) while vfmt; contains `os.`
|
||||
is_fmt bool
|
||||
}
|
||||
|
||||
pub struct Fn {
|
||||
|
@ -83,6 +84,7 @@ mut:
|
|||
pub fn new_table() &Table {
|
||||
mut t := &Table{}
|
||||
t.register_builtin_type_symbols()
|
||||
t.is_fmt = true
|
||||
return t
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue