gui_render_subtree   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/gui.xtm

Implementation

;; walks the tree in pre-order
(bind-func gui_render_subtree
  (lambda (widget:Widget* bounds:Rect*)
    (if (null? widget)
        widget
        (if (and (null? (Widget_left_child widget))
                 (null? (Widget_right_child widget)))
            ;; if a leaf node, set the nanovg transform matrix and
            ;; call the render callback
            (let ((winWidth (GUI_width EXTEMPORE_GUI))
                  (winHeight (GUI_height EXTEMPORE_GUI))
                  (vg (GUI_context EXTEMPORE_GUI))
                  (cb (Widget_cb widget)))
              ;; (nvgResetTransform vg)
              ;; (nvgTranslate vg x y)
              ;; (nvgScale vg w h)
              (cb widget bounds)
              null)
            ;; otherwise recurse into the child widgets
            (let ((split (Widget_split widget)))
              ;; recurse into children
              (if (Widget_split_vertical_p widget)
                  ;; split vertically
                  (begin
                    (let ((sub_bounds:Rect* (zalloc)))
                      (tfill! sub_bounds
                              (tref bounds 0)
                              (tref bounds 1)
                              (tref bounds 2)
                              (floor (* split (tref bounds 3))))
                      (gui_render_subtree (Widget_left_child widget)
                                          sub_bounds))
                    (let ((sub_bounds:Rect* (zalloc)))
                      (tfill! sub_bounds
                              (tref bounds 0)
                              (floor (+ (tref bounds 1)
                                 (* split (tref bounds 3))))
                              (tref bounds 2)
                              (ceil (* (- 1. split) (tref bounds 3))))
                      (gui_render_subtree (Widget_right_child widget)
                                          sub_bounds)))
                  ;; split horizontally
                  (begin
                    (let ((sub_bounds:Rect* (zalloc)))
                      (tfill! sub_bounds
                              (tref bounds 0)
                              (tref bounds 1)
                              (floor (* split (tref bounds 2)))
                              (tref bounds 3))
                      (gui_render_subtree (Widget_left_child widget)
                                          sub_bounds))
                    (let ((sub_bounds:Rect* (zalloc)))
                      (tfill! sub_bounds
                              (floor (+ (tref bounds 0)
                                 (* split (tref bounds 2))))
                              (tref bounds 1)
                              (ceil (* (- 1. split) (tref bounds 2)))
                              (tref bounds 3))
                      (gui_render_subtree (Widget_right_child widget)
                                          sub_bounds)))))))))


Back to Index

Similar Entries

  • GUI_context    xtlang
  • GUI_height    xtlang
  • GUI_pixel_ratio    xtlang
  • GUI_root    xtlang
  • GUI_set_root    xtlang
  • GUI_width    xtlang
  • GUI_window    xtlang
  • get_render_handler    xtlang
  • get_render_process_handler    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gl_render    xtlang
  • gui_add_widget    xtlang
  • gui_add_widget    xtlang
  • gui_click_p    xtlang
  • gui_draw_circle    xtlang
  • gui_draw_rect    xtlang
  • gui_draw_text_in_bounds    xtlang
  • gui_enter_p    xtlang
  • gui_find_leaf_inorder    xtlang
  • gui_find_leaf_postorder    xtlang
  • gui_find_leaf_preorder    xtlang
  • gui_find_next_id    xtlang
  • gui_find_parent    xtlang
  • gui_find_widget_with_id    xtlang
  • gui_inbounds_p    xtlang
  • gui_init    xtlang
  • gui_keypress_p    xtlang
  • gui_keyrelease_p    xtlang
  • gui_leave_p    xtlang
  • gui_left_click_p    xtlang
  • gui_mouse_x    xtlang
  • gui_mouse_y    xtlang
  • gui_render    xtlang
  • gui_render_loop    xtlang
  • gui_reset    xtlang
  • gui_right_click_p    xtlang
  • gui_set_default_theme    xtlang
  • gui_set_monokai_color_theme    xtlang
  • gui_set_monokai_opensans_theme    xtlang
  • gui_shutdown    xtlang
  • gui_validate    xtlang
  • gui_window_size_callback    xtlang
  • guint64_alloc    xtlang
  • guint64_halloc    xtlang
  • guint64_zalloc    xtlang
  • guint_alloc    xtlang
  • guint_halloc    xtlang
  • guint_zalloc    xtlang
  • ipc:bind-xtmrender-vars    scheme
  • post:XTMRENDERCB    xtlang
  • post:XTMRENDERCB    xtlang
  • post:XTMRENDERCB    xtlang
  • post:XTMRENDERCB    xtlang
  • postrender:XTMRENDERCB    xtlang
  • prerender:XTMRENDERCB    xtlang
  • prerender:XTMRENDERCB    xtlang
  • prerender:XTMRENDERCB    xtlang
  • prerender:XTMRENDERCB    xtlang
  • prerender:XTMRENDERCB    xtlang
  • render:XTMRENDERCB    xtlang
  • render:XTMRENDERCB    xtlang
  • render:XTMRENDERCB    xtlang
  • render:XTMRENDERCB    xtlang
  • render:XTMRENDERCB    xtlang
  • render:XTMRENDERCB    xtlang
  • trans:XTMRENDERCB    xtlang
  • trans:XTMRENDERCB    xtlang
  • vector_gfx:XTMRENDERCB    xtlang
  • xtm_render    xtlang
  • xtm_render_fbo    xtlang
  • xtm_render_init    xtlang
  • xtm_render_init_dof_shader    xtlang
  • xtm_render_init_light_shader    xtlang
  • xtm_render_init_quad_shader    xtlang
  • xtm_render_init_simple_bone_shader    xtlang
  • xtm_render_init_simple_shader    xtlang
  • xtm_render_init_skybox_shader    xtlang