Commits

Anonymous committed 14ac8c3

Minor changes

Comments (0)

Files changed (3)

BGroupLayoutML.cpp

 {
 	unsetHooks();
 }
+BGroupLayoutML::~BGroupLayoutML()
+{
+	unsetHooks();
+}
 
 void
 BGroupLayoutML::unsetHooks()
 	bool res = ((BGroupLayout*)v_self)->HasHeightForWidth();
 	CAMLreturn(Val_bool(res));
 }
-//void 	CAMLprim value bgrouplayout_InvalidateLayout (bool children=false)
-//bool 	CAMLprim value bgrouplayout_IsVisible ()
-//float 	CAMLprim value bgrouplayout_ItemWeight (int32 index) const
-//BLayout * 	CAMLprim value bgrouplayout_Layout () const
+CAMLprim value bgrouplayout_InvalidateLayout(value v_self, value v_children)
+{
+	CAMLparam2(v_self, v_children);
+	((BGroupLayout*)v_self)->InvalidateLayout(Bool_val(v_children));
+	CAMLreturn(Val_unit);
+}
+CAMLprim value bgrouplayout_IsVisible(value v_self)
+{
+	CAMLparam1(v_self);
+	bool res = ((BGroupLayout*)v_self)->IsVisible();
+	CAMLreturn(Val_bool(res));
+}
+CAMLprim value bgrouplayout_ItemWeight(value v_self, value v_index)
+{
+	CAMLparam2(v_self, v_index);
+	float res = ((BGroupLayout*)v_self)->ItemWeight(Int_val(v_index));
+	CAMLreturn(caml_copy_double(res));
+}
+CAMLprim value bgrouplayout_Layout(value v_self)
+{
+	CAMLparam1(v_self);
+	BLayout* res = ((BGroupLayout*)v_self)->Layout();
+	CAMLreturn((value)res);
+}
 CAMLprim value bgrouplayout_MaxSize(value v_self)
 {
 	CAMLparam1(v_self);
 	orientation res = ((BGroupLayout*)v_self)->Orientation();
 	CAMLreturn(val_of_orientation(res));
 }
+CAMLprim value bgrouplayout_SetOrientation(value v_self, value v_orientation)
+{
+	CAMLparam2(v_self, v_orientation);
+	((BGroupLayout*)v_self)->SetOrientation(orientation_of_val(v_orientation));
+	CAMLreturn(Val_unit);
+}
 //status_t 	CAMLprim value bgrouplayout_Perform (perform_code d, void *arg)
 CAMLprim value bgrouplayout_PreferredSize(value v_self)
 {
 	BSize* res = new BSize(pre_res);
 	CAMLreturn((value)res);
 }
-//void 	CAMLprim value bgrouplayout_SetExplicitAlignment (BAlignment alignment)
-//void 	CAMLprim value bgrouplayout_SetExplicitMaxSize (BSize size)
-//void 	CAMLprim value bgrouplayout_SetExplicitMinSize (BSize size)
-//void 	CAMLprim value bgrouplayout_SetExplicitPreferredSize (BSize size)
+CAMLprim value bgrouplayout_SetExplicitAlignment(value v_self, value v_alignment)
+{
+	CAMLparam2(v_self, v_alignment);
+	((BGroupLayout*)v_self)->SetExplicitAlignment(*(BAlignment*)v_alignment);
+	CAMLreturn(Val_unit);
+}
+CAMLprim value bgrouplayout_SetExplicitMaxSize(value v_self, value v_size)
+{
+	CAMLparam2(v_self, v_size);
+	((BGroupLayout*)v_self)->SetExplicitMaxSize(*(BSize*)v_size);
+	CAMLreturn(Val_unit);
+}
+CAMLprim value bgrouplayout_SetExplicitMinSize(value v_self, value v_size)
+{
+	CAMLparam2(v_self, v_size);
+	((BGroupLayout*)v_self)->SetExplicitMinSize(*(BSize*)v_size);
+	CAMLreturn(Val_unit);
+}
+CAMLprim value bgrouplayout_SetExplicitPreferredSize(value v_self, value v_size)
+{
+	CAMLparam2(v_self, v_size);
+	((BGroupLayout*)v_self)->SetExplicitPreferredSize(*(BSize*)v_size);
+	CAMLreturn(Val_unit);
+}
 CAMLprim value bgrouplayout_SetFrame(value v_self, value v_frame)
 {
 	CAMLparam2(v_self, v_frame);
 	((BGroupLayout*)v_self)->SetFrame(*(BRect*)v_frame);
 	CAMLreturn(Val_unit);
 }
-//void 	CAMLprim value bgrouplayout_SetInsets (float left, float top, float right, float bottom)
-//void 	CAMLprim value bgrouplayout_SetItemWeight (int32 index, float weight)
-//void 	CAMLprim value bgrouplayout_SetSpacing (float spacing)
-//void 	CAMLprim value bgrouplayout_SetVisible (bool visible)
-//float 	CAMLprim value bgrouplayout_Spacing () const
-//BView * 	CAMLprim value bgrouplayout_Owner () const
-//BView * 	CAMLprim value bgrouplayout_TargetView () const
-//BView * 	CAMLprim value bgrouplayout_View ()
-//bool 	CAMLprim value bgrouplayout_RemoveView (BView *child)
-//bool 	CAMLprim value bgrouplayout_RemoveItem_1 (BLayoutItem *item)
-//BLayoutItem * 	CAMLprim value bgrouplayout_RemoveItem_2 (int32 index)
-//BLayoutItem * 	CAMLprim value bgrouplayout_ItemAt (int32 index) const
-//int32 	CAMLprim value bgrouplayout_CountItems () const
-//int32 	CAMLprim value bgrouplayout_IndexOfItem (const BLayoutItem *item) const
-//int32 	CAMLprim value bgrouplayout_IndexOfView (BView *child) const
-//void 	CAMLprim value bgrouplayout_Relayout (bool immediate=false)
-//void 	CAMLprim value bgrouplayout_LayoutItems (bool force=false)
+CAMLprim value bgrouplayout_SetInsets(value v_self, value v_left, value v_top, value v_right, value v_bottom)
+{
+	CAMLparam5(v_self, v_left, v_top, v_right, v_bottom);
+	((BGroupLayout*)v_self)->SetInsets(Double_val(v_left), Double_val(v_top), Double_val(v_right), Double_val(v_bottom));
+	CAMLreturn(Val_unit);
+}
+CAMLprim value bgrouplayout_SetItemWeight(value v_self, value v_index, value v_weight)
+{
+	CAMLparam3(v_self, v_index, v_weight);
+	((BGroupLayout*)v_self)->SetItemWeight(Int_val(v_index), Double_val(v_weight));
+	CAMLreturn(Val_unit);
+}
+CAMLprim value bgrouplayout_SetSpacing(value v_self, value v_spacing)
+{
+	CAMLparam2(v_self, v_spacing);
+	((BGroupLayout*)v_self)->SetSpacing(Double_val(v_spacing));
+	CAMLreturn(Val_unit);
+}
+CAMLprim value bgrouplayout_SetVisible(value v_self, value v_visible)
+{
+	CAMLparam2(v_self, v_visible);
+	((BGroupLayout*)v_self)->SetVisible(Bool_val(v_visible));
+	CAMLreturn(Val_unit);
+}
+CAMLprim value bgrouplayout_Spacing(value v_self)
+{
+	CAMLparam1(v_self);
+	float res =((BGroupLayout*)v_self)->Spacing();
+	CAMLreturn(caml_copy_double(res));
+}
+CAMLprim value bgrouplayout_Owner(value v_self)
+{
+	CAMLparam1(v_self);
+	BView* res = ((BGroupLayout*)v_self)->Owner();
+	CAMLreturn((value)res);
+}
+CAMLprim value bgrouplayout_TargetView(value v_self)
+{
+	CAMLparam1(v_self);
+	BView* res = ((BGroupLayout*)v_self)->TargetView();
+	CAMLreturn((value)res);
+}
+CAMLprim value bgrouplayout_View(value v_self)
+{
+	CAMLparam1(v_self);
+	BView* res = ((BGroupLayout*)v_self)->View();
+	CAMLreturn((value)res);
+}
+CAMLprim value bgrouplayout_RemoveView(value v_self, value v_child)
+{
+	CAMLparam2(v_self, v_child);
+	bool res = ((BGroupLayout*)v_self)->RemoveView((BView*)v_child);
+	CAMLreturn(Val_bool(res));
+}
+CAMLprim value bgrouplayout_RemoveItem_1(value v_self, value v_item)
+{
+	CAMLparam2(v_self, v_item);
+	bool res = ((BGroupLayout*)v_self)->RemoveItem((BLayoutItem*)v_item);
+	CAMLreturn(Val_bool(res));
+}
+CAMLprim value bgrouplayout_RemoveItem_2(value v_self, value v_index)
+{
+	CAMLparam2(v_self, v_index);
+	BLayoutItem* res = ((BGroupLayout*)v_self)->RemoveItem(Int_val(v_index));
+	CAMLreturn((value)res);
+}
+CAMLprim value bgrouplayout_ItemAt(value v_self, value v_index)
+{
+	CAMLparam2(v_self, v_index);
+	BLayoutItem* res = ((BGroupLayout*)v_self)->ItemAt(Int_val(v_index));
+	CAMLreturn((value)res);
+}
+CAMLprim value bgrouplayout_CountItems(value v_self)
+{
+	CAMLparam1(v_self);
+	int res = ((BGroupLayout*)v_self)->CountItems();
+	CAMLreturn(Val_int(res));
+}
+CAMLprim value bgrouplayout_IndexOfItem(value v_self, value v_item)
+{
+	CAMLparam2(v_self, v_item);
+	int res = ((BGroupLayout*)v_self)->IndexOfItem((BLayoutItem*)v_item);
+	CAMLreturn(Val_int(res));
+}
+CAMLprim value bgrouplayout_IndexOfView(value v_self, value v_child)
+{
+	CAMLparam2(v_self, v_child);
+	int res = ((BGroupLayout*)v_self)->IndexOfView((BView*)v_child);
+	CAMLreturn(Val_int(res));
+}
+CAMLprim value bgrouplayout_Relayout(value v_self, value v_immediate)
+{
+	CAMLparam2(v_self, v_immediate);
+	((BGroupLayout*)v_self)->Relayout(Bool_val(v_immediate));
+	CAMLreturn(Val_unit);
+}
+CAMLprim value bgrouplayout_LayoutItems(value v_self, value v_force)
+{
+	CAMLparam2(v_self, v_force);
+	((BGroupLayout*)v_self)->LayoutItems(Bool_val(v_force));
+	CAMLreturn(Val_unit);
+}
 CAMLprim value bgrouplayout_LayoutData(value v_self)
 {
 	CAMLparam1(v_self);
 	((BGroupLayout*)v_self)->DerivedLayoutItems();
 	CAMLreturn(Val_unit);
 }*/
-//void 	CAMLprim value bgrouplayout_GetColumnRowConstraints (enum orientation orientation, int32 index, ColumnRowConstraints *constraints)
-//void 	CAMLprim value bgrouplayout_GetItemDimensions (BLayoutItem *item, Dimensions *dimensions)
+/* CAMLprim value bgrouplayout_GetColumnRowConstraints(value v_self, value v_orientation, value v_index, value v_constraints)
+{
+	CAMLparam4(v_self, v_orientation, v_index, v_constraints);
+	((BGroupLayout*)v_self)->GetColumnRowConstraints(orientation_of_val(v_orientation), Int_val(v_index), (BTwoDimensionalLayout::ColumnRowConstraints*)v_constraints);
+	CAMLreturn(Val_unit);
+}*/
+/*CAMLprim value bgrouplayout_GetItemDimensions(value v_self, value v_item, value v_dimensions)
+{
+	CAMLparam3(v_self, v_item, v_dimensions);
+	((BGroupLayout*)v_self)->GetItemDimensions((BLayoutItem*)v_item, (BDimensions*)v_dimensions);
+	CAMLreturn(Val_unit);
+}*/
 //int32 	CAMLprim value bgrouplayout_InternalCountColumns ()
 /* PROTECTED CAMLprim value bgrouplayout_InternalCountRows(value v_self)
 {
 external bgrouplayout_Frame :
 	Beapi.bgrouplayout -> Beapi.brect =
 	"bgrouplayout_Frame"
-external bgrouplayout_GetHeightForWidth :
+(* external bgrouplayout_GetHeightForWidth :
 	Beapi.bgrouplayout -> float -> (float*float*float) =
 	"bgrouplayout_GetHeightForWidth"
 external bgrouplayout_GetInsets :
 	Beapi.bgrouplayout -> (float*float*float*float)=
-	"bgrouplayout_GetInsets"
+	"bgrouplayout_GetInsets" *)
 external bgrouplayout_HasHeightForWidth :
 	Beapi.bgrouplayout -> bool =
 	"bgrouplayout_HasHeightForWidth"
 external bgrouplayout_AlignInFrame :
 	Beapi.bgrouplayout -> bool -> unit =
 	"bgrouplayout_AlignInFrame"
-external bgrouplayout_DerivedLayoutItems :
+(* external bgrouplayout_DerivedLayoutItems :
 	Beapi.bgrouplayout -> unit =
-	"bgrouplayout_DerivedLayoutItems"
-external bgrouplayout_GetColumnRowConstraints :
+	"bgrouplayout_DerivedLayoutItems" *)
+(* external bgrouplayout_GetColumnRowConstraints :
 	Beapi.bgrouplayout -> Beapi.orientation -> int -> Beapi.column_row_constraints -> unit =
-	"bgrouplayout_GetColumnRowConstraints"
-external bgrouplayout_GetItemDimensions :
+	"bgrouplayout_GetColumnRowConstraints" *)
+(* external bgrouplayout_GetItemDimensions :
 	Beapi.bgrouplayout -> Beapi.blayoutitem -> Beapi.dimensions -> unit =
-	"bgrouplayout_GetItemDimensions"
-external bgrouplayout_InternalCountColumns :
+	"bgrouplayout_GetItemDimensions" *)
+(* PROTECTED external bgrouplayout_InternalCountColumns :
 	Beapi.bgrouplayout -> int =
 	"bgrouplayout_InternalCountColumns"
 external bgrouplayout_InternalCountRows :
 	"bgrouplayout_InternalCountRows"
 external bgrouplayout_PrepareItems :
 	Beapi.bgrouplayout -> Beapi.orientation -> unit =
-	"bgrouplayout_PrepareItems"
+	"bgrouplayout_PrepareItems" *)
 
 
 
 (*    method getHeightForWidth =
 	Beapi.bgrouplayout -> float -> (float*float*float) =
       bgrouplayout_GetHeightForWidth pointer
-    method get_insets =
+      method get_insets =
 	Beapi.bgrouplayout -> (float*float*float*float)=
       bgrouplayout_GetInsets pointer *)
     method has_height_for_width =
       bgrouplayout_SetLayoutData pointer data
     method align_in_frame ~frame =
       bgrouplayout_AlignInFrame pointer frame
-    method get_column_row_constraints ~orientation ~index ~constraints =
-      bgrouplayout_GetColumnRowConstraints pointer orientation index constraints
-    method get_item_dimensions ~item ~dimensions =
-      bgrouplayout_GetItemDimensions pointer item dimensions
-    method internal_count_columns =
-      bgrouplayout_InternalCountColumns pointer
-    method internal_count_rows =
-      bgrouplayout_InternalCountRows pointer
 end
     val message_received = fun message -> print_endline "button clicked"
     initializer
       self#setMessageReceived message_received ;
+      let layout = new BGroupLayout.bgrouplayout ~orientation:Beapi.B_VERTICAL ~spacing:1.0 () in
       let tabs = new ribbon_tabs ~frame:(self#bounds ()) in
       self#add_child ~aView:(Beapi.bview_of_btabview tabs#get_pointer)
                      ~sibling:(BView.null ()) () ;