# HG changeset patch # User Olaf Wintermann # Date 1422123269 -3600 # Node ID 135920fe441b6e1d2c35ab2765fcbdac67454478 # Parent bc0ed99e49c7f4e92f106991f455ca186337b17b added initial WPF code diff -r bc0ed99e49c7 -r 135920fe441b application/main.c --- a/application/main.c Wed Jan 21 20:38:21 2015 +0100 +++ b/application/main.c Sat Jan 24 19:14:29 2015 +0100 @@ -33,7 +33,7 @@ #include #include - +/* typedef struct Person { char *name; char *mail; @@ -91,10 +91,15 @@ void action_test(UiEvent *event, void *data) { //ui_select_tab(tabview, 0); } - +*/ int main(int argc, char** argv) { ui_init("app1", argc, argv); - ui_locales_dir("/opt/app1/locales"); + + UiObject *obj = ui_window("Test", NULL); + ui_show(obj); + ui_main(); + /* + ui_locales_dir("/opt/app1/locales"); ui_load_lang_def(NULL, "en_EN"); //ui_openfilefunc(action_new, NULL); @@ -153,6 +158,6 @@ ui_show(window); ui_main(); - + */ return (EXIT_SUCCESS); } diff -r bc0ed99e49c7 -r 135920fe441b ui/ui/toolkit.h --- a/ui/ui/toolkit.h Wed Jan 21 20:38:21 2015 +0100 +++ b/ui/ui/toolkit.h Sat Jan 24 19:14:29 2015 +0100 @@ -58,6 +58,8 @@ #define UIWIDGET void* #endif +#elif UI_WPF +#define UIWIDGET void* #endif #ifndef TRUE diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/Makefile Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,38 @@ +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2012 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. +# + +$(WPF_OBJPRE)%.o: wpf/%.c + $(CC) -o $@ -c $(CFLAGS) $< + +$(UI_LIB): $(OBJ) uiw + $(AR) $(ARFLAGS) $(UI_LIB) $(OBJ) + +uiw: + cd wpf/UIwrapper; $(MSBUILD) + cp $(BUILD_ROOT)/build/UIwrapper/UIwrapper.dll $(BUILD_ROOT)/build/bin/ + cp $(BUILD_ROOT)/build/UIcore/UIcore.dll $(BUILD_ROOT)/build/bin/ diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIcore/Application.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIcore/Application.cs Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,141 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace UI +{ + public class Application + { + private static Application instance; + + private System.Windows.Application application; + + private Thread thread; + private Queue queue = new Queue(); + private object sync = new object(); + private object result = new object(); + + private Boolean Running = false; + public String Name; + + private Application() : base() + { + thread = new Thread(() => Run()); + thread.SetApartmentState(ApartmentState.STA); + thread.Start(); + } + + public static Application GetInstance() + { + if (instance == null) + { + instance = new Application(); + GC.KeepAlive(instance); + } + return instance; + } + + public Thread Start() + { + lock(sync) + { + queue.Enqueue(() => RunApplication()); + Monitor.Pulse(sync); + } + return thread; + } + + private void RunApplication() + { + application = new System.Windows.Application(); + application.Run(); + } + + public void Run() + { + lock(sync) + { + for (;;) + { + Monitor.Wait(sync); + Action action = queue.Dequeue(); + action.Invoke(); + lock (result) + { + Monitor.Pulse(result); + } + } + } + } + + public T Exec(Func func) + { + ResultExec e = new ResultExec(); + e.Func = func; + + if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA) + { + e.Exec(); + return e.Result; + } + else + { + lock (sync) + { + queue.Enqueue(() => e.Exec()); + Monitor.Pulse(sync); + } + lock (result) + { + Monitor.Wait(result); + } + + return e.Result; + } + } + + public void Exec(Action action) + { + if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA) + { + action.Invoke(); + } + else + { + lock (sync) + { + queue.Enqueue(action); + Monitor.Pulse(sync); + } + lock (result) + { + Monitor.Wait(result); + } + } + } + } + + public class ResultExec + { + public T Result; + public Func Func; + + public void Exec() + { + Result = Func.Invoke(); + } + } + + public class VoidExec + { + public Action Action; + + public void Exec() + { + Action.Invoke(); + } + } +} diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIcore/Properties/AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIcore/Properties/AssemblyInfo.cs Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("UIcore")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("UIcore")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("e93c93b6-d270-4178-998f-7e68d9591874")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIcore/Toolkit.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIcore/Toolkit.cs Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace UI +{ + public class Toolkit + { + + } +} diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIcore/UIcore.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIcore/UIcore.csproj Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {8573F7D8-F05F-4195-9005-1C219B976146} + Library + Properties + UIcore + UIcore + v4.5 + 512 + + + true + full + true + ..\..\..\build\UIcore\ + DEBUG;TRACE + prompt + 4 + AnyCPU + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIcore/Window.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIcore/Window.cs Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; + +namespace UI +{ + public class MainWindow : Window + { + private Label label1; + + public MainWindow(String title) + { + Title = title; + Width = 300; + Height = 300; + GC.KeepAlive(this); // remove KeepAlive and add the Window to the application + } + + public static MainWindow CreateMainWindow(String title) + { + return Application.GetInstance().Exec(() => new MainWindow(title)); + } + + public void ShowWindow() + { + Application.GetInstance().Exec(() => this.Show()); + } + } +} diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper.sln Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,56 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UIwrapper", "UIwrapper\UIwrapper.vcxproj", "{367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}" + ProjectSection(ProjectDependencies) = postProject + {8573F7D8-F05F-4195-9005-1C219B976146} = {8573F7D8-F05F-4195-9005-1C219B976146} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIcore", "..\UIcore\UIcore.csproj", "{8573F7D8-F05F-4195-9005-1C219B976146}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Debug|Win32.ActiveCfg = Debug|Win32 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Debug|Win32.Build.0 = Debug|Win32 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Debug|x64.ActiveCfg = Debug|x64 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Debug|x64.Build.0 = Debug|x64 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Release|Any CPU.ActiveCfg = Release|Win32 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Release|Mixed Platforms.Build.0 = Release|Win32 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Release|Win32.ActiveCfg = Release|Win32 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Release|Win32.Build.0 = Release|Win32 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Release|x64.ActiveCfg = Release|x64 + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5}.Release|x64.Build.0 = Release|x64 + {8573F7D8-F05F-4195-9005-1C219B976146}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Debug|Win32.ActiveCfg = Debug|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Debug|x64.ActiveCfg = Debug|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Debug|x64.Build.0 = Debug|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Release|Any CPU.Build.0 = Release|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Release|Win32.ActiveCfg = Release|Any CPU + {8573F7D8-F05F-4195-9005-1C219B976146}.Release|x64.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper.v12.suo Binary file ui/wpf/UIwrapper/UIwrapper.v12.suo has changed diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/AssemblyInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/AssemblyInfo.cpp Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,38 @@ +#include "stdafx.h" + +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::CompilerServices; +using namespace System::Runtime::InteropServices; +using namespace System::Security::Permissions; + +// +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +// +[assembly:AssemblyTitleAttribute(L"UIwrapper")]; +[assembly:AssemblyDescriptionAttribute(L"")]; +[assembly:AssemblyConfigurationAttribute(L"")]; +[assembly:AssemblyCompanyAttribute(L"")]; +[assembly:AssemblyProductAttribute(L"UIwrapper")]; +[assembly:AssemblyCopyrightAttribute(L"Copyright (c) 2015")]; +[assembly:AssemblyTrademarkAttribute(L"")]; +[assembly:AssemblyCultureAttribute(L"")]; + +// +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder für die Revisions- und Buildnummer den Standard +// übernehmen, indem Sie "*" eingeben: + +[assembly:AssemblyVersionAttribute("1.0.*")]; + +[assembly:ComVisible(false)]; + +[assembly:CLSCompliantAttribute(true)]; \ No newline at end of file diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/ReadMe.txt Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,30 @@ +======================================================================== + DYNAMIC LINK LIBRARY: UIwrapper-Projektübersicht +======================================================================== + +Diese UIwrapper-DLL wurde vom Anwendungs-Assistenten für Sie erstellt. + +Diese Datei bietet eine Ãœbersicht über den Inhalt der einzelnen Dateien, aus +denen Ihre UIwrapper-Anwendung besteht. + +UIwrapper.vcxproj + Dies ist die Hauptprojektdatei für VC++-Projekte, die mit dem Anwendungs-Assistenten generiert werden. Sie enthält Informationen über die Version von Visual C++, mit der die Datei generiert wurde, sowie über die Plattformen, Konfigurationen und Projektfunktionen, die im Anwendungs-Assistenten ausgewählt wurden. + +UIwrapper.vcxproj.filters + Dies ist die Filterdatei für VC++-Projekte, die mithilfe eines Anwendungs-Assistenten erstellt werden. Sie enthält Informationen über die Zuordnung zwischen den Dateien im Projekt und den Filtern. Diese Zuordnung wird in der IDE zur Darstellung der Gruppierung von Dateien mit ähnlichen Erweiterungen unter einem bestimmten Knoten verwendet (z. B. sind CPP-Dateien dem Filter "Quelldateien" zugeordnet). + +UIwrapper.cpp + Dies ist die Hauptquelldatei der DLL. + +UIwrapper.h + Diese Datei enthält eine Klassendeklaration. + +AssemblyInfo.cpp + Enthält benutzerdefinierte Attribute zum Ändern von Assemblymetadaten. + +///////////////////////////////////////////////////////////////////////////// +Weitere Hinweise: + +Der Anwendungs-Assistent weist Sie mit "TODO:" auf Teile des Quellcodes hin, die Sie ergänzen oder anpassen sollten. + +///////////////////////////////////////////////////////////////////////////// diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/Stdafx.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/Stdafx.cpp Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,5 @@ +// stdafx.cpp : Quelldatei, die nur die Standard-Includes einbindet. +// UIwrapper.pch ist der vorkompilierte Header. +// stdafx.obj enthält die vorkompilierten Typinformationen. + +#include "stdafx.h" diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/Stdafx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/Stdafx.h Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,7 @@ +// stdafx.h : Includedatei für Standardsystem-Includedateien +// oder häufig verwendete projektspezifische Includedateien, +// die nur in unregelmäßigen Abständen geändert werden. + +#pragma once + + diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/UIwrapper.vcxproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/UIwrapper.vcxproj Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,178 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {367C474F-D7EA-44E3-9CB7-A4A35DCE9CC5} + v4.5 + ManagedCProj + UIwrapper + + + + DynamicLibrary + true + v120 + true + Unicode + + + DynamicLibrary + true + v120 + true + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)..\..\..\build\UIwrapper\ + + + true + $(SolutionDir)..\..\..\build\UIwrapper\ + + + false + + + false + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + Use + + + true + + C:\Users\Olaf\Projekte\toolkit\build\UIcore\ + + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + Use + $(SolutionDir)..\..\..\build\UIcore\;%(AdditionalUsingDirectories) + + + true + + + + + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + Use + + + true + + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + Use + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + \ No newline at end of file diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/UIwrapper.vcxproj.filters --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/UIwrapper.vcxproj.filters Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,58 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Headerdateien + + + Headerdateien + + + Headerdateien + + + Headerdateien + + + + + Quelldateien + + + Quelldateien + + + Quelldateien + + + Quelldateien + + + + + + + + Ressourcendateien + + + + + Ressourcendateien + + + \ No newline at end of file diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/app.ico Binary file ui/wpf/UIwrapper/UIwrapper/app.ico has changed diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/app.rc Binary file ui/wpf/UIwrapper/UIwrapper/app.rc has changed diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/resource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/resource.h Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,3 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by app.rc diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/toolkit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/toolkit.cpp Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,38 @@ +// Dies ist die Haupt-DLL. + +#include "stdafx.h" +#include + +#include "toolkit.h" + +#using "UIcore.dll" + + +void* ObjectToPtr(Object ^obj) { + GCHandle handle = GCHandle::Alloc(obj); + IntPtr pointer = GCHandle::ToIntPtr(handle); + return pointer.ToPointer(); +} + +Object^ PtrToObject(void *ptr) { + GCHandle h = GCHandle::FromIntPtr(IntPtr(ptr)); + Object^ object = h.Target; + h.Free(); + return object; +} + + +UI_EXPORT void __stdcall UIinit(char *appname) { + UI::Application ^app = UI::Application::GetInstance(); + app->Name = gcnew String(appname); +} + +UI_EXPORT void __stdcall UImain() { + Thread ^thread = UI::Application::GetInstance()->Start(); + thread->Join(); +} + +UI_EXPORT void __stdcall UIshow(void *wptr) { + UI::MainWindow ^window = (UI::MainWindow^)PtrToObject(wptr); + window->ShowWindow(); +} diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/toolkit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/toolkit.h Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,13 @@ +// UIwrapper.h + +#pragma once + +using namespace System; +using namespace System::Runtime::InteropServices; +using namespace System::Threading; +using namespace System::Windows; +using namespace System::Windows::Controls; + +#define UI_EXPORT extern "C" __declspec(dllexport) + +void* ObjectToPtr(Object ^obj); diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/window.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/window.cpp Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,13 @@ + + +#include "stdafx.h" +#include + +#include "window.h" + +#using "UIcore.dll" + +UI_EXPORT void* UIwindow(char *title, void *uiobj) { + UI::MainWindow ^window = UI::MainWindow::CreateMainWindow(gcnew String(title)); + return ObjectToPtr(window); +} diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/window.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/window.h Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,6 @@ + + +#pragma once + +#include "toolkit.h" + diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/objs.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/objs.mk Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,36 @@ +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2012 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. +# + +WPF_SRC_DIR = ui/wpf/ +WPF_OBJPRE = $(OBJ_DIR)$(WPF_SRC_DIR) + +WPFOBJ = toolkit.o +WPFOBJ += window.o + +TOOLKITOBJS += $(WPFOBJ:%=$(WPF_OBJPRE)%) +TOOLKITSOURCE += $(WPFOBJ:%.o=wpf/%.c) diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/toolkit.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/toolkit.c Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,54 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2014 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 +#include +#include + +#include "toolkit.h" + + +void ui_init(char *appname, int argc, char **argv) { + UIinit(appname); +} + +void ui_main() { + UImain(); +} + +void ui_show(UiObject *obj) { + UIshow(obj->widget); +} + +void ui_set_enabled(UIWIDGET widget, int enabled) { + +} + +void ui_set_show_all(UIWIDGET widget, int value) { + +} \ No newline at end of file diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/toolkit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/toolkit.h Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,53 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2014 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 TOOLKIT_H +#define TOOLKIT_H + +#include +#include "../ui/toolkit.h" +#include "../common/context.h" +#include "../common/object.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define UI_IMPORT __declspec(dllimport) +__declspec(dllimport) int __stdcall myfunc(char *str); + +UI_IMPORT void __stdcall UIinit(char *appname); +UI_IMPORT void __stdcall UImain(); +UI_IMPORT void __stdcall UIshow(UIWIDGET widget); + +#ifdef __cplusplus +} +#endif + +#endif /* TOOLKIT_H */ + diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/window.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/window.c Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,18 @@ +#include +#include +#include + +#include "../ui/window.h" +#include "../ui/properties.h" +#include "../common/context.h" + +#include "window.h" + +UiObject* ui_window(char *title, void *window_data) { + UcxMempool *mp = ucx_mempool_new(256); + UiObject *obj = ucx_mempool_calloc(mp, 1, sizeof(UiObject)); + obj->widget = UIwindow(title, obj); + obj->ctx = uic_context(obj, mp); + + return obj; +} diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/window.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/window.h Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,25 @@ +/* + * File: window.h + * Author: Olaf + * + * Created on 24. Januar 2015, 15:42 + */ + +#ifndef WINDOW_H +#define WINDOW_H + +#include "toolkit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +UI_IMPORT UIWIDGET __stdcall UIwindow(char *title, void *uiobj); + + +#ifdef __cplusplus +} +#endif + +#endif /* WINDOW_H */ +