ui/wpf/UIwrapper/UIwrapper/container.cpp

Sun, 29 Sep 2024 19:06:29 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 29 Sep 2024 19:06:29 +0200
branch
newapi
changeset 318
8d8a31d55dd5
parent 138
d781436e2490
permissions
-rw-r--r--

fix simple window (libadwaita)



#include "stdafx.h"
#include <stdio.h>

#include "container.h"

#using "UIcore.dll"

UI_EXPORT void* __stdcall UIvbox(gcroot<UI::Container^> *parent, int margin, int spacing) {
	UI::BoxContainer ^vbox = gcnew UI::BoxContainer(*parent, UI::BoxOrientation::VERTICAL, margin, spacing);
	gcroot<UI::BoxContainer^> *container = new gcroot<UI::BoxContainer^>();
	*container = vbox;
	return container;
}

UI_EXPORT void* __stdcall UIhbox(gcroot<UI::Container^> *parent, int margin, int spacing) {
	UI::BoxContainer ^hbox = gcnew UI::BoxContainer(*parent, UI::BoxOrientation::HORIZONTAL, margin, spacing);
	gcroot<UI::BoxContainer^> *container = new gcroot<UI::BoxContainer^>();
	*container = hbox;
	return container;
}

UI_EXPORT void* __stdcall UIgrid(gcroot<UI::Container^> *parent, int margin, int columnspacing, int rowspacing) {
	UI::GridContainer ^grid = gcnew UI::GridContainer(*parent, margin, columnspacing, rowspacing);
	gcroot<UI::GridContainer^> *container = new gcroot<UI::GridContainer^>();
	*container = grid;
	return container;
}

UI_EXPORT void* __stdcall UIscrolledwindow(gcroot<UI::Container^> *parent) {
	UI::ScrollViewerContainer ^scrollviewer = gcnew UI::ScrollViewerContainer(*parent);
	gcroot<UI::ScrollViewerContainer^> *container = new gcroot<UI::ScrollViewerContainer^>();
	*container = scrollviewer;
	return container;
}

UI_EXPORT void* __stdcall UItabview(gcroot<UI::Container^> *parent) {
	UI::TabViewContainer ^tabview = gcnew UI::TabViewContainer(*parent);
	gcroot<UI::TabViewContainer^> *container = new gcroot<UI::TabViewContainer^>();
	*container = tabview;
	return container;
}

UI_EXPORT void __stdcall UItab(gcroot<UI::Container^> *container, char *label) {
	UI::Container ^ct = *container;
	ct->Layout->Label = gcnew String(label);
}



/* ------------------- layout functions ------------------- */

UI_EXPORT void __stdcall UIlayout_fill(gcroot<UI::Container^> *container, int fill) {
	UI::Container ^ct = *container;
	ct->Layout->Fill = fill != 0;
}

UI_EXPORT void __stdcall UIlayout_hexpand(gcroot<UI::Container^> *container, int expand) {
	UI::Container ^ct = *container;
	ct->Layout->Hexpand = expand != 0;
}

UI_EXPORT void __stdcall UIlayout_vexpand(gcroot<UI::Container^> *container, int expand) {
	UI::Container ^ct = *container;
	ct->Layout->Vexpand = expand != 0;
}

UI_EXPORT void __stdcall UIlayout_gridwidth(gcroot<UI::Container^> *container, int width) {
	UI::Container ^ct = *container;
	ct->Layout->GridWidth = width;
}

UI_EXPORT void __stdcall UIlayout_newline(gcroot<UI::Container^> *container) {
	UI::Container ^ct = *container;
	ct->Layout->NewLine = true;
}

mercurial