Commits

Anonymous committed 1003f8f

Minor changes

Comments (0)

Files changed (6)

 {
 	if (closure_DrawTabs)
 	{
-		return caml_callback(closure_DrawTabs, Val_unit);
+		return *((BRect*)caml_callback(closure_DrawTabs, Val_unit));
 	} else
 	{
 		BTabView::DrawTabs();
 CAMLprim value btabview_constructor_1(value v_frame, value v_name, value v_width, value v_resizingMode, value v_flags)
 {
 	CAMLparam5(v_frame, v_name, v_width, v_resizingMode, v_flags);
-	BTabViewML *res = new BTabViewML(*((BRect*)v_frame), String_val(v_name), (button_width)v_width, Int_val(v_resizingMode), Int_val(v_flags));
+	BTabViewML *res = new BTabViewML(*((BRect*)v_frame), String_val(v_name), button_width_of_val(v_width), resizingMode_of_val(v_resizingMode), view_flags_of_val(v_flags));
 	CAMLreturn((value)res);
 }
 /*CAMLprim value btabview_constructor_2(value v_tabView)
 CAMLprim value btabview_SetTabWidth(value v_self, value v_width)
 {
 	CAMLparam2(v_self, v_width);
-	((BTabView*)v_self)->SetTabWidth((button_width)v_width);
+	((BTabView*)v_self)->SetTabWidth(button_width_of_val(v_width));
 	CAMLreturn(Val_unit);
 }
 CAMLprim value btabview_TabWidth(value v_self)
 {
 	CAMLparam1(v_self);
 	button_width res = ((BTabView*)v_self)->TabWidth();
-	CAMLreturn((value)res);
+	CAMLreturn(val_of_button_width(res));
 }
 CAMLprim value btabview_TabAt(value v_self, value v_tab_index)
 {
 #ifndef BTABVIEWML_H
 #define BTABVIEWML_H
 #include "interface/TabView.h"
+#include "BeapiML.hpp"
 extern "C" {
 #include "HaikuML.h"
 }
 			return B_FOLLOW_NONE;
 	}
 }
+button_width button_width_of_val(value v_width)
+{
+	return B_WIDTH_FROM_LABEL;
+}
+value val_of_button_width(button_width v_width)
+{
+	return Val_int(0);
+}
 
 uint32 resizingMode_of_val(value rm);
 uint32 view_flags_of_val(value f);
+button_width button_width_of_val(value v_width);
+value val_of_button_width(button_width width);
 
 #endif
 type bview
 type bwindow
 
+type alignment =
+	| B_ALIGN_LEFT
+	| B_ALIGN_RIGHT
+	| B_ALIGN_CENTER
 type app_info
 type bigtime_t
+type boreder_style =
+	| B_PLAIN_BORDER
+	| B_FANCY_BORDER
+	| B_NO_BORDER
 type button_width =
+	| B_WIDTH_FROM_WIDEST
 	| B_WIDTH_AS_USUAL
-type color_space
+	| B_WIDTH_FROM_LABEL
+type color_space =
+	| B_NO_COLOR_SPACE
+	| B_RGB32
+	| B_RGBA32
+	| B_RGB16
+	| B_RGB15
+	| B_RGBA15
+	| B_CMAP8
+	| B_GRAY8
+	| B_GRAY1
+	| B_RGB32_BIG
+	| B_RGBA32_BIG
+	| B_RGB16_BIG
+	| B_RGB15_BIG
+	| B_RGBA15_BIG
+	| B_HSI24
+	| B_HSI32
+	| B_HSIA32
+	| B_HSV24
+	| B_HSV32
+	| B_HSVA32
+	| B_HLS24
+	| B_HLS32
+	| B_HLSA32
+	| B_CMY24
+	| B_CMY32
+	| B_CMYA32
+	| B_CMYK32
 type entry_ref
 type status_t
 type ssize_t
 type type_code
 
 type window_alignment
-type window_feel
+type window_feel =
+	| B_NORMAL_WINDOW_FEEL
+	| B_MODAL_SUBSET_WINDOW_FEEL
+	| B_MODAL_APP_WINDOW_FEEL
+	| B_MODAL_ALL_WINDOW_FEEL
+	| B_FLOATING_SUBSET_WINDOW_FEEL
+	| B_FLOATING_APP_WINDOW_FEEL
+	| B_FLOATING_ALL_WINDOW_FEEL
 type window_look =
 	| B_DOCUMENT_WINDOW_LOOK
 	| B_TITLED_WINDOW_LOOK
 let hello_haiku = "Hello"
 
+class ribbon_tabs ~frame =
+  object (self)
+    inherit BTabView.btabview ~frame:frame ~name:"Ribbon Tabs"
+                              ~width:Beapi.B_WIDTH_FROM_LABEL
+                              ~resizingMode:Beapi.b_FOLLOW_ALL
+                              ~flags:(Beapi.b_WILL_DRAW) ()
+    initializer
+      let home_tab_view =
+        BView.bview ~frame:frame ~name:"Home"
+                    ~resizingMode:Beapi.b_FOLLOW_ALL_SIDES
+                    ~flags:Beapi.b_WILL_DRAW () in
+      self#add_tab ~target:home_tab_view ~tab:(BTab.null ()) () ;
+      let file_tab_view =
+        BView.bview ~frame:frame ~name:"File"
+                    ~resizingMode:Beapi.b_FOLLOW_ALL_SIDES
+                    ~flags:Beapi.b_WILL_DRAW () in
+      self#add_tab ~target:file_tab_view ~tab:(BTab.null ()) () ;
+      let insert_tab_view =
+        BView.bview ~frame:frame ~name:"Insert"
+                    ~resizingMode:Beapi.b_FOLLOW_ALL_SIDES
+                    ~flags:Beapi.b_WILL_DRAW () in
+      self#add_tab ~target:insert_tab_view ~tab:(BTab.null ()) () ;
+        
+      let button =
+        BButton.bbutton ~frame:(BView.bounds ~self:home_tab_view ())
+                        ~name:"Hello" ~label:"Hello"
+                        ~message:(BMessage.bmessage ~command:1 ())
+                        ~resizingMode:Beapi.b_FOLLOW_ALL_SIDES
+                        ~flags:Beapi.b_WILL_DRAW () in
+      BView.add_child ~self:home_tab_view
+                      ~aView:(Beapi.bview_of_bbutton button)
+	              ~sibling:(BView.null ()) ()
+end
+
 class hello_window ~frame =
   object (self)
     inherit BWindow.bwindow ~frame:frame ~title:"Hello Window"
     val message_received = fun message -> print_endline "button clicked"
     initializer
       self#setMessageReceived message_received ;
-      let tabview =
-        new BTabView.btabview ~frame:(self#bounds ()) ~name:"Test Tabs"
-                              ~width:Beapi.B_WIDTH_AS_USUAL
-                              ~resizingMode:Beapi.b_FOLLOW_ALL
-                              ~flags:(Beapi.b_WILL_DRAW) () in
-      self#add_child ~aView:(Beapi.bview_of_btabview tabview#get_pointer)
+      let tabs = new ribbon_tabs ~frame:(self#bounds ()) in
+      self#add_child ~aView:(Beapi.bview_of_btabview tabs#get_pointer)
                      ~sibling:(BView.null ()) () ;
-      let view =
-        BView.bview ~frame:(self#bounds ()) ~name:"Hello, Haiku"
-                    ~resizingMode:Beapi.b_FOLLOW_ALL_SIDES
-                    ~flags:Beapi.b_WILL_DRAW () in
-      tabview#add_tab ~target:view ~tab:(BTab.null ()) () ;
-      let button =
-        BButton.bbutton ~frame:(BView.bounds ~self:view ())
-                        ~name:"Hello" ~label:"Hello"
-                        ~message:(BMessage.bmessage ~command:1 ())
-                        ~resizingMode:Beapi.b_FOLLOW_ALL_SIDES
-                        ~flags:Beapi.b_WILL_DRAW () in
-      BView.add_child ~self:view ~aView:(Beapi.bview_of_bbutton button)
-	              ~sibling:(BView.null ()) ()
-  end
+end
 
 class hello_haiku =
   object (self)