added box layout and button (WPF)

Sat, 31 Jan 2015 11:51:54 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 31 Jan 2015 11:51:54 +0100
changeset 83
a38aec91bd66
parent 82
0cdb8089a29f
child 84
a56c2baa9429

added box layout and button (WPF)

application/main.c file | annotate | diff | comparison | revisions
config.mk file | annotate | diff | comparison | revisions
ui/wpf/UIcore/Container.cs file | annotate | diff | comparison | revisions
ui/wpf/UIcore/Controls.cs file | annotate | diff | comparison | revisions
ui/wpf/UIcore/UIcore.csproj file | annotate | diff | comparison | revisions
ui/wpf/UIcore/Window.cs file | annotate | diff | comparison | revisions
ui/wpf/UIwrapper/UIwrapper.v12.suo file | annotate | diff | comparison | revisions
ui/wpf/UIwrapper/UIwrapper/UIwrapper.vcxproj file | annotate | diff | comparison | revisions
ui/wpf/UIwrapper/UIwrapper/UIwrapper.vcxproj.filters file | annotate | diff | comparison | revisions
ui/wpf/UIwrapper/UIwrapper/controls.cpp file | annotate | diff | comparison | revisions
ui/wpf/UIwrapper/UIwrapper/controls.h file | annotate | diff | comparison | revisions
ui/wpf/UIwrapper/UIwrapper/menu.cpp file | annotate | diff | comparison | revisions
ui/wpf/UIwrapper/UIwrapper/toolkit.cpp file | annotate | diff | comparison | revisions
ui/wpf/UIwrapper/UIwrapper/toolkit.h file | annotate | diff | comparison | revisions
ui/wpf/UIwrapper/UIwrapper/window.cpp file | annotate | diff | comparison | revisions
ui/wpf/button.c file | annotate | diff | comparison | revisions
ui/wpf/button.h file | annotate | diff | comparison | revisions
ui/wpf/objs.mk file | annotate | diff | comparison | revisions
ui/wpf/window.c file | annotate | diff | comparison | revisions
ui/wpf/window.h file | annotate | diff | comparison | revisions
--- a/application/main.c	Tue Jan 27 09:59:32 2015 +0100
+++ b/application/main.c	Sat Jan 31 11:51:54 2015 +0100
@@ -98,6 +98,11 @@
     fflush(stdout);
 }
 
+void action_button(UiEvent *event, void *data) {
+    printf("button clicked\n");
+    fflush(stdout);
+}
+
 int main(int argc, char** argv) { 
     ui_init("app1", argc, argv);
     
@@ -112,6 +117,10 @@
     ui_menuitem("item4", NULL, NULL);
     
     UiObject *obj = ui_window("Test", NULL);
+    ui_button(obj, "Test1", action_button, NULL);
+    ui_button(obj, "Test2", action_button, NULL);
+    ui_button(obj, "Test3", action_button, NULL);
+    ui_button(obj, "Test4", action_button, NULL);
     ui_show(obj);
     ui_main();
     /*
--- a/config.mk	Tue Jan 27 09:59:32 2015 +0100
+++ b/config.mk	Sat Jan 31 11:51:54 2015 +0100
@@ -11,7 +11,7 @@
 CFLAGS += -DUI_WPF 
 
 LDFLAGS += $(BUILD_ROOT)/build/UIwrapper/UIwrapper.lib
-LDFLAGS += -mwindows
+#LDFLAGS += -mwindows
 
 TOOLKIT = wpf
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/wpf/UIcore/Container.cs	Sat Jan 31 11:51:54 2015 +0100
@@ -0,0 +1,120 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace UI
+{
+    public interface Container
+    {
+        void Add(UIElement control, bool fill);
+    }
+
+    public enum BoxOrientation
+    {
+        VERTICAL,
+        HORIZONTAL
+    }
+
+    public class BoxContainer : Container
+    {
+        public Grid Grid;
+        public BoxOrientation Orientation;
+
+        private int x = 0;
+        private int y = 0;
+
+        private bool filled = false;
+
+        public BoxContainer(Grid grid, BoxOrientation orientation)
+        {
+            Grid = grid;
+            Orientation = orientation;
+            if(Orientation == BoxOrientation.HORIZONTAL)
+            {
+                RowDefinition row = new RowDefinition();
+                row.Height = new GridLength(1, GridUnitType.Star);
+                Grid.RowDefinitions.Add(row);
+            }
+            else
+            {
+                ColumnDefinition col = new ColumnDefinition();
+                col.Width = new GridLength(1, GridUnitType.Star);
+                Grid.ColumnDefinitions.Add(col);
+            }
+        }
+        
+        public void Add(UIElement control, bool fill)
+        {
+            if(Orientation == BoxOrientation.HORIZONTAL)
+            {
+                ColumnDefinition col = new ColumnDefinition();
+                if(filled && fill)
+                {
+                    fill = false;
+                    Console.WriteLine("BoxContainer can only contain one filled control");
+                }
+                if(fill)
+                {
+                    col.Width = new GridLength(1, GridUnitType.Star);
+                    filled = true;
+                }
+                else
+                {
+                    col.Width = GridLength.Auto;
+                }
+                Grid.ColumnDefinitions.Add(col);
+            }
+            else
+            {
+                RowDefinition row = new RowDefinition();
+                if (filled && fill)
+                {
+                    fill = false;
+                    Console.WriteLine("BoxContainer can only contain one filled control");
+                }
+                if(fill)
+                {
+                    row.Height = new GridLength(1, GridUnitType.Star);
+                    filled = true;
+                }
+                else
+                {
+                    row.Height = GridLength.Auto;
+                }
+                Grid.RowDefinitions.Add(row);
+            }
+
+            Grid.SetColumn(control, x);
+            Grid.SetRow(control, y);
+            Grid.Children.Add(control);
+
+            if(Orientation == BoxOrientation.HORIZONTAL)
+            {
+                x++;
+            }
+            else
+            {
+                y++;
+            }
+        }
+    }
+    
+    public class GridContainer : Container
+    {
+        public Grid Grid;
+
+        public GridContainer(System.Windows.Controls.Grid grid)
+        {
+            Grid = grid;
+        }
+
+        public void Add(UIElement control, bool fill)
+        {
+
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/wpf/UIcore/Controls.cs	Sat Jan 31 11:51:54 2015 +0100
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace UI
+{  
+    public class Controls
+    {
+
+        public static Button Button(Container container, String label, RoutedEventHandler e)
+        {
+            return Application.GetInstance().Exec<Button>(() => Controls.CreateButton(container, label, e));
+        }
+
+        public static Button CreateButton(Container container, String label, RoutedEventHandler e)
+        {
+            Button button = new Button();
+            button.Content = label;
+            container.Add(button, false);
+
+            button.Click += e;
+
+            return button;
+        }
+
+
+    }
+}
--- a/ui/wpf/UIcore/UIcore.csproj	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/UIcore/UIcore.csproj	Sat Jan 31 11:51:54 2015 +0100
@@ -46,6 +46,8 @@
     <Reference Include="WindowsBase" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Container.cs" />
+    <Compile Include="Controls.cs" />
     <Compile Include="Menu.cs" />
     <Compile Include="Toolkit.cs" />
     <Compile Include="Window.cs" />
--- a/ui/wpf/UIcore/Window.cs	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/UIcore/Window.cs	Sat Jan 31 11:51:54 2015 +0100
@@ -9,9 +9,10 @@
 
 namespace UI
 {
-    public class MainWindow : Window
+    public class MainWindow : Window, Container
     {
         public IntPtr Object;
+        public Container Container;
         
         public MainWindow(String title, IntPtr uiobj)
         {
@@ -20,15 +21,44 @@
             Width = 300;
             Height = 300;
 
+            Grid windowGrid = new Grid();
+            ColumnDefinition column = new ColumnDefinition();
+            column.Width = new GridLength(1, GridUnitType.Star);
+            windowGrid.ColumnDefinitions.Add(column);
+
+            AddChild(windowGrid);
+            int rowIndex = 0;
+
             // menu
             Application app = Application.GetInstance();
             if (!app.AppMenu.IsEmpty())
             {
                 System.Windows.Controls.Menu menu = app.AppMenu.CreateMenu(uiobj);
-                this.AddChild(menu);
+
+                RowDefinition menuRow = new RowDefinition();
+                menuRow.Height = GridLength.Auto;
+                windowGrid.RowDefinitions.Add(menuRow);
+
+                Grid.SetRow(menu, 0);
+                Grid.SetColumn(menu, rowIndex);
+                windowGrid.Children.Add(menu);
+                rowIndex++;
             }
 
-            GC.KeepAlive(this); // TODO: remove KeepAlive and add the Window to the application
+            // TODO: toolbar
+
+            // content
+            RowDefinition contentRow = new RowDefinition();
+            contentRow.Height = new GridLength(1, GridUnitType.Star);
+            windowGrid.RowDefinitions.Add(contentRow);
+            Grid content = new Grid();
+            Grid.SetColumn(content, 0);
+            Grid.SetRow(content, rowIndex);
+            windowGrid.Children.Add(content);
+            rowIndex++;
+
+            Container = new BoxContainer(content, BoxOrientation.VERTICAL);
+
             Closed += CloseEvent;
         }
 
@@ -47,5 +77,10 @@
         {
             Application.GetInstance().RemoveWindow(this);
         }
+
+        public void Add(UIElement control, bool fill)
+        {
+            Container.Add(control, fill);
+        }
     }
 }
Binary file ui/wpf/UIwrapper/UIwrapper.v12.suo has changed
--- a/ui/wpf/UIwrapper/UIwrapper/UIwrapper.vcxproj	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/UIwrapper/UIwrapper/UIwrapper.vcxproj	Sat Jan 31 11:51:54 2015 +0100
@@ -151,6 +151,7 @@
     <Reference Include="WindowsBase" />
   </ItemGroup>
   <ItemGroup>
+    <ClInclude Include="controls.h" />
     <ClInclude Include="menu.h" />
     <ClInclude Include="resource.h" />
     <ClInclude Include="Stdafx.h" />
@@ -159,6 +160,7 @@
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="AssemblyInfo.cpp" />
+    <ClCompile Include="controls.cpp" />
     <ClCompile Include="menu.cpp" />
     <ClCompile Include="window.cpp" />
     <ClCompile Include="Stdafx.cpp">
--- a/ui/wpf/UIwrapper/UIwrapper/UIwrapper.vcxproj.filters	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/UIwrapper/UIwrapper/UIwrapper.vcxproj.filters	Sat Jan 31 11:51:54 2015 +0100
@@ -30,6 +30,9 @@
     <ClInclude Include="menu.h">
       <Filter>Headerdateien</Filter>
     </ClInclude>
+    <ClInclude Include="controls.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="AssemblyInfo.cpp">
@@ -47,6 +50,9 @@
     <ClCompile Include="menu.cpp">
       <Filter>Quelldateien</Filter>
     </ClCompile>
+    <ClCompile Include="controls.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Text Include="ReadMe.txt" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/wpf/UIwrapper/UIwrapper/controls.cpp	Sat Jan 31 11:51:54 2015 +0100
@@ -0,0 +1,18 @@
+
+
+#include "stdafx.h"
+#include <stdio.h>
+
+#include "controls.h"
+
+#using "UIcore.dll"
+
+UI_EXPORT void* __stdcall UIbutton(gcroot<UI::Container^> *container, char *label, UIcallback f, void *eventdata) {
+	gcroot<Button^> *button = new gcroot<Button^>();
+
+	EventWrapper ^evt = gcnew EventWrapper(f, eventdata);
+	RoutedEventHandler ^handler = gcnew RoutedEventHandler(evt, &EventWrapper::Callback);
+
+	*button = UI::Controls::Button(*container, gcnew String(label), handler);
+	return button;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/wpf/UIwrapper/UIwrapper/controls.h	Sat Jan 31 11:51:54 2015 +0100
@@ -0,0 +1,6 @@
+
+
+#pragma once
+
+#include "toolkit.h"
+
--- a/ui/wpf/UIwrapper/UIwrapper/menu.cpp	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/UIwrapper/UIwrapper/menu.cpp	Sat Jan 31 11:51:54 2015 +0100
@@ -20,7 +20,7 @@
 
 
 UI_EXPORT void __stdcall UImenuitem(char *label, UIcallback f, void *eventdata) {
-	EventWrapper ^e = gcnew EventWrapper(f, eventdata);
+	ObjEventWrapper ^e = gcnew ObjEventWrapper(f, eventdata);
 	UI::Application::GetInstance()->AppMenu->AddMenuItem(gcnew String(label), e->GetAction());
 }
 
--- a/ui/wpf/UIwrapper/UIwrapper/toolkit.cpp	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/UIwrapper/UIwrapper/toolkit.cpp	Sat Jan 31 11:51:54 2015 +0100
@@ -23,22 +23,36 @@
 
 // EventWrapper
 
-EventWrapper::EventWrapper(UIcallback callback, void *eventdata) {
+ObjEventWrapper::ObjEventWrapper(UIcallback callback, void *eventdata) {
 	this->callback = callback;
-	this->userdata = eventdata;
-	action = gcnew Action<IntPtr>(this, &EventWrapper::Callback);
+	this->eventdata = eventdata;
+	action = gcnew Action<IntPtr>(this, &ObjEventWrapper::Callback);
 }
 
-Action<IntPtr>^ EventWrapper::GetAction() {
+Action<IntPtr>^ ObjEventWrapper::GetAction() {
 	return action;
 }
 
-void EventWrapper::Callback(IntPtr uiobj) {
+void ObjEventWrapper::Callback(IntPtr uiobj) {
 	if (callback) {
-		callback(uiobj.ToPointer(), userdata);
+		callback(uiobj.ToPointer(), eventdata);
 	}
 }
 
+
+EventWrapper::EventWrapper(UIcallback callback, void *eventdata) {
+	this->callback = callback;
+	this->eventdata = eventdata;
+}
+
+void EventWrapper::Callback(Object ^sender, RoutedEventArgs ^e) {
+	if (callback) {
+		callback(NULL, eventdata);
+	}
+}
+
+
+
 UI_EXPORT void __stdcall UIinit(char *appname) {
 	UI::Application ^app = UI::Application::GetInstance();
 	app->Name = gcnew String(appname);
@@ -49,7 +63,6 @@
 	thread->Join();
 }
 
-UI_EXPORT void __stdcall UIshow(void *wptr) {
-	UI::MainWindow ^window = (UI::MainWindow^)PtrToObject(wptr);
-	window->ShowWindow();
+UI_EXPORT void __stdcall UIshow(gcroot<UI::MainWindow^> *window) {
+	(*window)->ShowWindow();
 }
--- a/ui/wpf/UIwrapper/UIwrapper/toolkit.h	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/UIwrapper/UIwrapper/toolkit.h	Sat Jan 31 11:51:54 2015 +0100
@@ -2,6 +2,8 @@
 
 #pragma once
 
+#include <vcclr.h>
+
 using namespace System;
 using namespace System::Runtime::InteropServices;
 using namespace System::Threading;
@@ -13,16 +15,27 @@
 extern "C" typedef void(*UIcallback)(void*, void*);
 
 void* ObjectToPtr(Object ^obj);
+Object^ PtrToObject(void *ptr);
 
-public ref class EventWrapper {
+public ref class ObjEventWrapper {
 	UIcallback callback = NULL;
-	void *userdata = NULL;
+	void *eventdata = NULL;
 	Action<IntPtr> ^action;
 
 public:
-	EventWrapper(UIcallback callback, void *userdata);
+	ObjEventWrapper(UIcallback callback, void *eventdata);
 
 	Action<IntPtr>^ GetAction();
 
 	void Callback(IntPtr uiobj);
 };
+
+public ref class EventWrapper {
+	UIcallback callback = NULL;
+	void *eventdata = NULL;
+	
+
+public:
+	EventWrapper(UIcallback callback, void *eventdata);
+	void Callback(Object ^sender, RoutedEventArgs ^e);
+};
--- a/ui/wpf/UIwrapper/UIwrapper/window.cpp	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/UIwrapper/UIwrapper/window.cpp	Sat Jan 31 11:51:54 2015 +0100
@@ -7,7 +7,11 @@
 
 #using "UIcore.dll"
 
-UI_EXPORT void* UIwindow(char *title, void *uiobj) {
+UI_EXPORT void* __stdcall UIwindow(char *title, void *uiobj) {
 	UI::MainWindow ^window = UI::MainWindow::CreateMainWindow(gcnew String(title), IntPtr(uiobj));
-	return ObjectToPtr(window);
+	gcroot<UI::MainWindow^> *ptr = new gcroot<UI::MainWindow^>();
+	*ptr = window;
+	return ptr;
 }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/wpf/button.c	Sat Jan 31 11:51:54 2015 +0100
@@ -0,0 +1,59 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2015 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "button.h"
+#include "../common/object.h"
+
+UIWIDGET ui_button(UiObject *obj, char *label, ui_callback f, void *data) {
+    UiEventData *event = NULL;
+    ui_callback callback = NULL;
+    if(f) {
+        event = malloc(sizeof(UiEventData));
+        event->obj = obj;
+        event->callback = f;
+        event->user_data = data;
+        event->value = 0;
+        callback = (ui_callback)ui_button_callback;
+    }
+    
+    fflush(stdout);
+    UiContainer *container = uic_get_current_container(obj);
+    return UIbutton(container, label, callback, event);
+}
+
+void ui_button_callback(UiObject *obj, UiEventData *e) {
+    UiEvent event;
+    event.obj = e->obj;
+    event.document = event.obj->ctx->document;
+    event.window = event.obj->window;
+    event.intval = 0;
+    e->callback(&event, e->user_data);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/wpf/button.h	Sat Jan 31 11:51:54 2015 +0100
@@ -0,0 +1,48 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2015 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BUTTON_H
+#define	BUTTON_H
+
+#include "../ui/button.h"
+#include "toolkit.h"
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+UI_IMPORT UIWIDGET __stdcall UIbutton(void *container, char *label, ui_callback f, void *event);
+
+void ui_button_callback(UiObject *obj, UiEventData *e);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* BUTTON_H */
+
--- a/ui/wpf/objs.mk	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/objs.mk	Sat Jan 31 11:51:54 2015 +0100
@@ -32,6 +32,7 @@
 WPFOBJ = toolkit.o
 WPFOBJ += window.o
 WPFOBJ += menu.o
+WPFOBJ += button.o
 
 TOOLKITOBJS += $(WPFOBJ:%=$(WPF_OBJPRE)%)
 TOOLKITSOURCE += $(WPFOBJ:%.o=wpf/%.c)
--- a/ui/wpf/window.c	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/window.c	Sat Jan 31 11:51:54 2015 +0100
@@ -1,3 +1,31 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2015 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -13,6 +41,9 @@
     UiObject *obj = ucx_mempool_calloc(mp, 1, sizeof(UiObject));  
     obj->widget = UIwindow(title, obj);
     obj->ctx = uic_context(obj, mp);
+    obj->container = (UiContainer*)obj->widget;
+    //obj->window = window_data;
+    //obj->next = NULL;
     
     return obj;
 }
--- a/ui/wpf/window.h	Tue Jan 27 09:59:32 2015 +0100
+++ b/ui/wpf/window.h	Sat Jan 31 11:51:54 2015 +0100
@@ -1,8 +1,29 @@
-/* 
- * File:   window.h
- * Author: Olaf
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2015 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
  *
- * Created on 24. Januar 2015, 15:42
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef WINDOW_H
@@ -16,7 +37,6 @@
 
 UI_IMPORT UIWIDGET __stdcall UIwindow(char *title, void *uiobj);
 
-
 #ifdef	__cplusplus
 }
 #endif

mercurial