Skip to content

Commit

Permalink
add demo1: hellxul
Browse files Browse the repository at this point in the history
  • Loading branch information
dustpg committed Jul 8, 2018
1 parent 0746dda commit daeab57
Show file tree
Hide file tree
Showing 16 changed files with 282 additions and 12 deletions.
3 changes: 2 additions & 1 deletion AaaaUI/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ void main_inited(LongUI::UIViewport& viewport, int switch_on) noexcept {
void object_test() noexcept {
LongUI::CUIStringEx c = L"";
LongUI::CUIString aaaa;
#ifdef LUI_NONPOD_VECTOR
LongUI::NonPOD::Vector<LongUI::CUIStringEx> a, b;
a.reserve(10);
a.emplace_back_ex()->assign(L"SAD");
Expand All @@ -600,7 +601,7 @@ void object_test() noexcept {
b = a;
b = std::move(a);
b.resize(9);

#endif
{
LongUI::CUIString b1, b2;
LongUI::CUIString a = L"++++";
Expand Down
13 changes: 13 additions & 0 deletions Demos.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo0_helloworld", "demo\de
{68DBE32A-6DDF-4E22-B265-8AC889B912F4} = {68DBE32A-6DDF-4E22-B265-8AC889B912F4}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo1_helloxul", "demo\demo1_helloxul\demo1_helloxul.vcxproj", "{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F9}"
ProjectSection(ProjectDependencies) = postProject
{68DBE32A-6DDF-4E22-B265-8AC889B912F4} = {68DBE32A-6DDF-4E22-B265-8AC889B912F4}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand All @@ -34,6 +39,14 @@ Global
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F8}.Release|x64.Build.0 = Release|x64
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F8}.Release|x86.ActiveCfg = Release|Win32
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F8}.Release|x86.Build.0 = Release|Win32
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F9}.Debug|x64.ActiveCfg = Debug|x64
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F9}.Debug|x64.Build.0 = Debug|x64
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F9}.Debug|x86.ActiveCfg = Debug|Win32
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F9}.Debug|x86.Build.0 = Debug|Win32
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F9}.Release|x64.ActiveCfg = Release|x64
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F9}.Release|x64.Build.0 = Release|x64
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F9}.Release|x86.ActiveCfg = Release|Win32
{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F9}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 4 additions & 1 deletion KnownIssues.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
1. Memory leak in Accessible under Windows 7.
ref: https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/4986251c-3aea-4c4b-b8ea-dc77e3566a65/releasing-irawelementprovidersimple-implementations?forum=windowsaccessibilityandautomation

2.
2. Memory leak on OutOfMemory
well, well...

3.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Current Version : **Alpha-Stage**

**Light Weight**
- main target on LongUI
- static-link framework, helloworld.exe just 133kb now
- static-link framework, helloworld just 150kb now
- for this, **no c++ exception** in LongUI, becareful exception in LongUI

**XML User Interface Language**
Expand Down
2 changes: 2 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Xxx::ControlAttached 目前无用

赋予原子控件真正的意义
------------------------------------------------------------------
双滚动条 BUG1. 没有显示完 2.夹角处显示

gif等动画支持?

CSS支持完善?
Expand Down
29 changes: 29 additions & 0 deletions demo/demo1_helloxul/demo1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <core/ui_manager.h>
#include <control/ui_label.h>
#include <control/ui_viewport.h>

const auto xul = u8R"xml(
<?xml version="1.0"?>
<window>
<spacer flex="1"/>
<hbox>
<spacer flex="1"/>
<label value="hellow world!"/>
<spacer flex="1"/>
</hbox>
<spacer flex="1"/>
</window>
)xml";

int main() {
if (UIManager.Initialize()) {
{
LongUI::UIViewport viewport;
viewport.SetXUL(xul);
viewport.GetWindow()->ShowWindow();
UIManager.MainLoop();
}
UIManager.Uninitialize();
}
return 0;
}
Binary file added demo/demo1_helloxul/demo1_helloxul.exe
Binary file not shown.
170 changes: 170 additions & 0 deletions demo/demo1_helloxul/demo1_helloxul.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{AA91B48A-FFEB-4F6D-9E4E-8C2D5DBCD3F9}</ProjectGuid>
<RootNamespace>demo1helloxul</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>..\..\include\;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>..\..\include\;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>..\..\include\;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>..\..\include\;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>false</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<AdditionalDependencies>CodeUI.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>false</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<AdditionalDependencies>CodeUI.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>false</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<AdditionalDependencies>CodeUI.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>false</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<AdditionalDependencies>CodeUI.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="demo1.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
6 changes: 6 additions & 0 deletions demo/demo1_helloxul/demo1_helloxul.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="demo1.cpp" />
</ItemGroup>
</Project>
40 changes: 40 additions & 0 deletions doc/test-xul/ctxmenu.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>

<window title="XUL Popups"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script>
<![CDATA[
]]>
</script>

<description><html:h1>XUL Popups</html:h1></description>

<popupset>
<popup id="contextpopup">
<menuitem label="This is a context popup" />
</popup>

<popup id="popupmenu">
<menuitem label="Pearl" />
<menuitem label="Aramis" />
<menuitem label="Yakima" />
</popup>
</popupset>
<label href="http://example.com" class="text-link" value="Click here to go to example.com"/>
<vbox flex="1" style="overflow: auto">

<groupbox orient="horizontal" context="popupmenu">
<caption label="Context Popups" />
<!-- context="contextpopup" -->
<spacer flex="1" />
<button flex="1" label="button here" />
</groupbox>


</vbox>

</window>
3 changes: 3 additions & 0 deletions include/container/nonpod_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <iterator>
#include <type_traits>

#ifdef LUI_NONPOD_VECTOR

// LongUI::non-pod namespace
namespace LongUI { namespace NonPOD {
Expand Down Expand Up @@ -312,3 +313,5 @@ namespace LongUI { namespace NonPOD {
auto end() noexcept ->iterator { return { *this, tr(m_vector.end_n()) }; }
};
}}

#endif
2 changes: 1 addition & 1 deletion include/control/ui_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace LongUI {
// add child[child maybe in ctor, cannot call method except under UIControl]
virtual void add_child(UIControl& child) noexcept;
// get sub element ::before
virtual auto get_subelement(U8View name) noexcept->UIControl*;
//virtual auto get_subelement(U8View name) noexcept->UIControl*;
// add attribute : key = bkdr hashed string key, this method valid before inited
virtual void add_attribute(uint32_t key, U8View value) noexcept;
#ifdef LUI_ACCESSIBLE
Expand Down
5 changes: 4 additions & 1 deletion include/luiconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// **include this file in source-file at first**
//

// style sheet support, include css-parse[unused yet]
// style sheet support, include css-parse[unused yet], undef to make bin-file smaller
#define LUI_STYLESHEET_SUPPORT

// windows 10 support only, make bin-file smaller, faster
Expand All @@ -13,6 +13,9 @@
// no accessible? make bin-file smaller
//#define LUI_NO_ACCESSIBLE

// longui implement a non-pod vector, define this if you want to use
//#define LUI_NONPOD_VECTOR

// give every control intptr_t c++: user_data/xml: data-user;
#define LUI_USER_INIPTR_DATA

Expand Down
2 changes: 0 additions & 2 deletions include/util/ui_named_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ namespace LongUI {
UIControl* ctrl;
// control name
const char* name;
#ifndef NDEBUG
// pointer value
uintptr_t value;
#endif
};
}
4 changes: 3 additions & 1 deletion src/container/nonpod_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <debugger/ui_debug.h>
#endif

#ifdef LUI_NONPOD_VECTOR
using namespace LongUI::NonPOD;

/// <summary>
Expand Down Expand Up @@ -595,4 +596,5 @@ void detail::vector_base::assign_count(const char* data, uint32_t count) noexcep
// }
// // +ns
// m_uVecLen += n;
//}
//}
#endif
Loading

0 comments on commit daeab57

Please sign in to comment.