Commits

Paweł Wieczorek  committed 1222047 Draft

minor

  • Participants
  • Parent commits feb1019
  • Branches better_ui

Comments (0)

Files changed (3)

File src/UI/UI_Algebra.ml

  *)
 
 open UI;;
+open ClickMap;;
 
 (**************************************************************************
  * Types
  *)
 
-type 'action ui_widget
-    = Button of string * 'action
-    | HorizontalBox of ('action ui_widget) list
+type 'a ui_widget
+    = Button of string * 'a
+    | HorizontalBox of ('a ui_widget) list
 
-type 'action ui_contener 
-    = Panel of string *  'action ui_widget
-    | Tabs of ('action ui_contener) list
+type 'a ui_contener 
+    = Panel of string *  'a ui_widget
+    | Tabs of ('a ui_contener) list
 
 (**************************************************************************
  * 
       let height0 = List.fold_left (+) 0 heights in
       let spacing = UISettings.box_spacing * pred_nat (List.length widgets) in
       height0 + spacing
-      
-
+    
 let calculate_height_for_ui_contener = function
   | Panel (title, widget) ->
       let height0 = UI_Panel.calculate_height UI_Panel.default_params in
       ()
 
 
+(**************************************************************************
+ * 
+ *)
+
+type 'a ui =
+    { ui_mouse_sensitive : 'a clickMap
+    }
+
+
+
+s

File src/UI/UI_Algebra.mli

 val draw_ui_widget : Video.rect -> Video.image -> 'a ui_widget -> unit
 
 val draw_ui_contener : Video.rect -> Video.image -> 'a ui_contener -> unit
+ 

File src/UI/UI_Label.ml

+(*pp $PP *)
+(**************************************************************************
+ * PixLand
+ *   Copyrights 2012 by Pawel Wieczorek <wieczyk gmail com>
+ *)
+
+open UI;;
+open Video;;
+
+(**************************************************************************
+ * Types
+ *)
+
+type label_params =
+    { text_color  :
+    }
+
+(**************************************************************************
+ * Constants
+ *)
+
+let default_params =
+    { border_size        = UISettings.border_size
+    ; light_border_color = UIColor.border_light
+    ; dark_border_color  = UIColor.border_dark
+    ; background_color   = UIColor.bg_color
+    }
+
+(**************************************************************************
+ * 
+ *)
+
+let draw_frame params (x,y,w,h) surface =
+    let bs       = params.border_size in
+    let rc_bor_l = (x, y, bs, h - bs) in
+    let rc_bor_r = (x + w - 2*bs, y, bs, h - bs) in
+    let rc_bor_t = (x, y, w - bs, bs) in
+    let rc_bor_b = (x, y + h - 2*bs, w - bs, bs) in
+    let rc_in    = (x + bs, y + bs, w - 3*bs, h - 3*bs) in
+    Video.draw_rect params.light_border_color rc_bor_l surface;
+    Video.draw_rect params.light_border_color rc_bor_t surface;
+    Video.draw_rect params.dark_border_color  rc_bor_r surface;
+    Video.draw_rect params.dark_border_color  rc_bor_b surface;
+    Video.draw_rect params.background_color   rc_in   surface;
+
+    rc_in
+
+let calculate_height params =
+  let bs = params.border_size in
+  2*bs