Use XwtComponent as base class for Widget and WindowFrame
This commit is contained in:
Родитель
c6da836444
Коммит
dff0a2b16f
|
@ -37,6 +37,8 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
|
@ -45,6 +47,9 @@
|
|||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
<DebugType>none</DebugType>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{E41F4448-15C3-4E95-B310-FD333FDF5D2F}</ProjectGuid>
|
||||
|
@ -10,7 +10,6 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WpfTest</RootNamespace>
|
||||
<AssemblyName>WpfTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
|
@ -24,6 +23,8 @@
|
|||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
|
@ -33,6 +34,7 @@
|
|||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
@ -44,6 +46,8 @@
|
|||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
|
@ -55,6 +59,7 @@
|
|||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Samples\Samples.csproj">
|
||||
|
|
53
Xwt.sln
53
Xwt.sln
|
@ -24,23 +24,12 @@ Global
|
|||
Win-Debug|Any CPU = Win-Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Mac-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Win-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Win-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Mac-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Win-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Win-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}.Mac-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}.Win-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Mac-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Win-Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Win-Debug|Any CPU.Build.0 = Debug|x86
|
||||
{2B7FF081-FE53-42F7-9D5D-D4B38E548F94}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2B7FF081-FE53-42F7-9D5D-D4B38E548F94}.Mac-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2B7FF081-FE53-42F7-9D5D-D4B38E548F94}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
@ -53,14 +42,26 @@ Global
|
|||
{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}.Win-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{88C04B85-B69B-47B4-AB9F-64F6DD4E0897}.Win-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Mac-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Win-Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{0AF50CE4-E455-4A9D-92AD-711CBD068A55}.Win-Debug|Any CPU.Build.0 = Debug|x86
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Mac-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Win-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}.Win-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}.Mac-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}.Win-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Mac-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Win-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}.Win-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C93D746E-1586-4D4F-B411-BF5A966E6A08}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C93D746E-1586-4D4F-B411-BF5A966E6A08}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C93D746E-1586-4D4F-B411-BF5A966E6A08}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C93D746E-1586-4D4F-B411-BF5A966E6A08}.Win-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C93D746E-1586-4D4F-B411-BF5A966E6A08}.Win-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E41F4448-15C3-4E95-B310-FD333FDF5D2F}.Mac-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
|
@ -69,9 +70,6 @@ Global
|
|||
{E41F4448-15C3-4E95-B310-FD333FDF5D2F}.Win-Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{E41F4448-15C3-4E95-B310-FD333FDF5D2F}.Win-Debug|Any CPU.Build.0 = Debug|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = GtkTest\GtkTest.csproj
|
||||
Policies = $0
|
||||
|
@ -84,4 +82,7 @@ Global
|
|||
$3.Text = @\n${FileName}\n \nAuthor:\n ${AuthorName} <${AuthorEmail}>\n\nCopyright (c) ${Year} ${CopyrightHolder}\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.
|
||||
$3.IncludeInNewFiles = True
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -29,20 +29,20 @@ using Xwt.Engine;
|
|||
|
||||
namespace Xwt.Backends
|
||||
{
|
||||
public class BackendHost<T>: BackendHost
|
||||
public class BackendHost<T,B>: BackendHost where B:IBackend
|
||||
{
|
||||
public BackendHost ()
|
||||
{
|
||||
}
|
||||
|
||||
protected BackendHost (IBackend backend): base (backend)
|
||||
{
|
||||
}
|
||||
|
||||
public new T Parent {
|
||||
get { return (T)base.Parent; }
|
||||
set { base.Parent = value; }
|
||||
}
|
||||
|
||||
public new B Backend {
|
||||
get { return (B)base.Backend; }
|
||||
}
|
||||
}
|
||||
|
||||
public class BackendHost
|
||||
|
@ -56,7 +56,7 @@ namespace Xwt.Backends
|
|||
{
|
||||
}
|
||||
|
||||
protected BackendHost (IBackend backend)
|
||||
public void SetCustomBackend (IBackend backend)
|
||||
{
|
||||
this.backend = backend;
|
||||
usingCustomBackend = true;
|
||||
|
@ -115,11 +115,6 @@ namespace Xwt.Backends
|
|||
}
|
||||
}
|
||||
|
||||
protected static void MapEvent (object eventId, Type type, string methodName)
|
||||
{
|
||||
EventUtil.MapEvent (eventId, type, methodName);
|
||||
}
|
||||
|
||||
public void OnBeforeEventAdd (object eventId, Delegate eventDelegate)
|
||||
{
|
||||
if (eventDelegate == null && !DefaultEnabledEvents.Contains (eventId))
|
||||
|
|
|
@ -93,16 +93,9 @@ namespace Xwt.Backends
|
|||
|
||||
class NativeWindowFrame: WindowFrame
|
||||
{
|
||||
IWindowFrameBackend backend;
|
||||
|
||||
public NativeWindowFrame (IWindowFrameBackend backend)
|
||||
{
|
||||
this.backend = backend;
|
||||
}
|
||||
|
||||
protected override WindowBackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WindowBackendHost (backend);
|
||||
BackendHost.SetCustomBackend (backend);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Xwt
|
|||
}
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Xwt
|
|||
Image = img;
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace Xwt
|
|||
return Rectangle.Zero;
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace Xwt
|
|||
Label = label;
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace Xwt
|
|||
views = new CellViewCollection ((ICellContainer)BackendHost);
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace Xwt
|
|||
entry = new CustomComboTextEntry (Backend.TextEntryBackend);
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace Xwt
|
|||
}
|
||||
}
|
||||
|
||||
protected override WindowFrame.WindowBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WindowBackendHost ();
|
||||
}
|
||||
|
|
|
@ -41,11 +41,12 @@ namespace Xwt
|
|||
string fileName;
|
||||
string[] fileNames = new string[0];
|
||||
|
||||
BackendHost<FileDialog> backendHost = new BackendHost<FileDialog> ();
|
||||
BackendHost<FileDialog,IFileDialogBackend> backendHost;
|
||||
|
||||
internal FileDialog ()
|
||||
{
|
||||
filters = new FileDialogFilterCollection (AddRemoveItem);
|
||||
backendHost = new BackendHost<FileDialog,IFileDialogBackend> ();
|
||||
backendHost.Parent = this;
|
||||
}
|
||||
|
||||
|
@ -55,7 +56,7 @@ namespace Xwt
|
|||
}
|
||||
|
||||
IFileDialogBackend Backend {
|
||||
get { return (IFileDialogBackend) backendHost.Backend; }
|
||||
get { return backendHost.Backend; }
|
||||
}
|
||||
|
||||
void AddRemoveItem (FileDialogFilter filter, bool added)
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Xwt
|
|||
}
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace Xwt
|
|||
views = new CellViewCollection ((ICellContainer)BackendHost);
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -35,15 +35,12 @@ namespace Xwt
|
|||
{
|
||||
DataField[] fields;
|
||||
|
||||
class ListStoreBackendHost: BackendHost<ListStore>
|
||||
class ListStoreBackendHost: BackendHost<ListStore,IListStoreBackend>
|
||||
{
|
||||
protected override IBackend OnCreateBackend ()
|
||||
protected override void OnBackendCreated ()
|
||||
{
|
||||
IBackend b = base.OnCreateBackend ();
|
||||
if (b == null)
|
||||
b = new DefaultListStoreBackend ();
|
||||
((IListStoreBackend)b).Initialize (Parent.fields.Select (f => f.FieldType).ToArray ());
|
||||
return b;
|
||||
Backend.Initialize (Parent.fields.Select (f => f.FieldType).ToArray ());
|
||||
base.OnBackendCreated ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace Xwt
|
|||
VerticalScrollPolicy = HorizontalScrollPolicy = ScrollPolicy.Automatic;
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Xwt
|
|||
Image = img;
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -38,12 +38,12 @@ namespace Xwt
|
|||
EventHandler clicked;
|
||||
Image image;
|
||||
|
||||
protected class MenuItemBackendHost: BackendHost<MenuItem>, IMenuItemEventSink
|
||||
protected class MenuItemBackendHost: BackendHost<MenuItem,IMenuItemBackend>, IMenuItemEventSink
|
||||
{
|
||||
protected override void OnBackendCreated ()
|
||||
{
|
||||
base.OnBackendCreated ();
|
||||
((IMenuItemBackend)Backend).Initialize (this);
|
||||
Backend.Initialize (this);
|
||||
}
|
||||
|
||||
public void OnClicked ()
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace Xwt
|
|||
tabs = new ChildrenCollection <NotebookTab> ((WidgetBackendHost) BackendHost);
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace Xwt
|
|||
panel2 = new Panel ((WidgetBackendHost)BackendHost, 2);
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -32,23 +32,23 @@ namespace Xwt
|
|||
{
|
||||
EventHandler valueChanged;
|
||||
|
||||
class BackendHost: BackendHost<ScrollAdjustment>, IScrollAdjustmentEventSink
|
||||
class ScrollAdjustmentBackendHost: BackendHost<ScrollAdjustment,IScrollAdjustmentBackend>, IScrollAdjustmentEventSink
|
||||
{
|
||||
protected override void OnBackendCreated ()
|
||||
{
|
||||
base.OnBackendCreated ();
|
||||
Backend.Initialize (new EventSink () { Parent = this });
|
||||
Backend.Initialize (this);
|
||||
}
|
||||
|
||||
public void OnValueChanged ()
|
||||
{
|
||||
((IScrollAdjustmentBackend)Parent).OnValueChanged (EventArgs.Empty);
|
||||
Parent.OnValueChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
protected override Xwt.Backends.BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new ScrollAdjustment.BackendHost ();
|
||||
return new ScrollAdjustmentBackendHost ();
|
||||
}
|
||||
|
||||
static ScrollAdjustment ()
|
||||
|
@ -66,11 +66,12 @@ namespace Xwt
|
|||
PageIncrement = 10;
|
||||
}
|
||||
|
||||
internal ScrollAdjustment (IBackend backend): base (backend)
|
||||
internal ScrollAdjustment (IBackend backend)
|
||||
{
|
||||
BackendHost.SetCustomBackend (backend);
|
||||
}
|
||||
|
||||
new IScrollAdjustmentBackend Backend {
|
||||
IScrollAdjustmentBackend Backend {
|
||||
get { return (IScrollAdjustmentBackend) BackendHost.Backend; }
|
||||
}
|
||||
|
||||
|
@ -140,12 +141,12 @@ namespace Xwt
|
|||
|
||||
public event EventHandler ValueChanged {
|
||||
add {
|
||||
OnBeforeEventAdd (ScrollAdjustmentEvent.ValueChanged, valueChanged);
|
||||
BackendHost.OnBeforeEventAdd (ScrollAdjustmentEvent.ValueChanged, valueChanged);
|
||||
valueChanged += value;
|
||||
}
|
||||
remove {
|
||||
valueChanged -= value;
|
||||
OnAfterEventRemove (ScrollAdjustmentEvent.ValueChanged, valueChanged);
|
||||
BackendHost.OnAfterEventRemove (ScrollAdjustmentEvent.ValueChanged, valueChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Xwt
|
|||
}
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ namespace Xwt
|
|||
this.title = title;
|
||||
}
|
||||
|
||||
new ISelectFolderDialogBackend Backend {
|
||||
get { return (ISelectFolderDialogBackend) base.Backend; }
|
||||
ISelectFolderDialogBackend Backend {
|
||||
get { return (ISelectFolderDialogBackend) BackendHost.Backend; }
|
||||
}
|
||||
|
||||
public string Title {
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Xwt
|
|||
}
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Xwt
|
|||
}
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Xwt
|
|||
{
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace Xwt
|
|||
{
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -37,15 +37,12 @@ namespace Xwt
|
|||
{
|
||||
DataField[] fields;
|
||||
|
||||
class TreeStoreBackendHost: BackendHost<TreeStore>
|
||||
class TreeStoreBackendHost: BackendHost<TreeStore,ITreeStoreBackend>
|
||||
{
|
||||
protected override IBackend OnCreateBackend ()
|
||||
protected override void OnBackendCreated ()
|
||||
{
|
||||
IBackend b = base.OnCreateBackend ();
|
||||
if (b == null)
|
||||
b = new DefaultTreeStoreBackend ();
|
||||
((ITreeStoreBackend)b).Initialize (Parent.fields.Select (f => f.FieldType).ToArray ());
|
||||
return b;
|
||||
Backend.Initialize (Parent.fields.Select (f => f.FieldType).ToArray ());
|
||||
base.OnBackendCreated ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace Xwt
|
|||
DataSource = source;
|
||||
}
|
||||
|
||||
protected override Widget.WidgetBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ using System.Linq;
|
|||
|
||||
namespace Xwt
|
||||
{
|
||||
public abstract class Widget: Component, IWidgetSurface, IFrontend
|
||||
public abstract class Widget: XwtComponent, IWidgetSurface
|
||||
{
|
||||
static Widget[] emptyList = new Widget[0];
|
||||
List<Widget> children;
|
||||
|
@ -45,7 +45,6 @@ namespace Xwt
|
|||
WidgetSize height;
|
||||
bool widthCached;
|
||||
bool heightCached;
|
||||
WidgetBackendHost backendHost;
|
||||
DragOperation currentDragOperation;
|
||||
Widget contentWidget;
|
||||
WindowFrame parentWindow;
|
||||
|
@ -82,16 +81,12 @@ namespace Xwt
|
|||
}
|
||||
}
|
||||
|
||||
protected class WidgetBackendHost: BackendHost<Widget>, IWidgetEventSink, ISpacingListener
|
||||
protected class WidgetBackendHost: BackendHost<Widget, IWidgetBackend>, IWidgetEventSink, ISpacingListener
|
||||
{
|
||||
public WidgetBackendHost ()
|
||||
{
|
||||
}
|
||||
|
||||
public WidgetBackendHost (IBackend backend): base (backend)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IBackend OnCreateBackend ()
|
||||
{
|
||||
var backend = base.OnCreateBackend ();
|
||||
|
@ -263,9 +258,9 @@ namespace Xwt
|
|||
|
||||
public Widget ()
|
||||
{
|
||||
backendHost = CreateBackendHost ();
|
||||
backendHost.Parent = this;
|
||||
margin = new Xwt.WidgetSpacing (backendHost);
|
||||
if (!(base.BackendHost is WidgetBackendHost))
|
||||
throw new InvalidOperationException ("CreateBackendHost for Widget did not return a WidgetBackendHost instance");
|
||||
margin = new Xwt.WidgetSpacing (BackendHost);
|
||||
}
|
||||
|
||||
static Widget ()
|
||||
|
@ -292,16 +287,20 @@ namespace Xwt
|
|||
MapEvent (WidgetEvent.PreferredWidthForHeightCheck, typeof (Widget), "OnGetPreferredWidthForHeight");
|
||||
}
|
||||
|
||||
protected static void MapEvent (object eventId, Type type, string methodName)
|
||||
{
|
||||
EventUtil.MapEvent (eventId, type, methodName);
|
||||
}
|
||||
|
||||
internal protected static IBackend GetBackend (Widget w)
|
||||
{
|
||||
return w != null ? w.Backend : null;
|
||||
}
|
||||
|
||||
protected new WidgetBackendHost BackendHost {
|
||||
get { return (WidgetBackendHost) base.BackendHost; }
|
||||
}
|
||||
|
||||
protected override Xwt.Backends.BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
base.Dispose (disposing);
|
||||
|
@ -330,21 +329,17 @@ namespace Xwt
|
|||
parentWindow = win;
|
||||
}
|
||||
|
||||
protected virtual WidgetBackendHost CreateBackendHost ()
|
||||
/* protected virtual WidgetBackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WidgetBackendHost ();
|
||||
}
|
||||
|
||||
protected WidgetBackendHost BackendHost {
|
||||
get { return backendHost; }
|
||||
}
|
||||
}*/
|
||||
|
||||
IWidgetBackend Backend {
|
||||
get { return (IWidgetBackend) backendHost.Backend; }
|
||||
}
|
||||
|
||||
object IFrontend.Backend {
|
||||
get { return Backend; }
|
||||
get { return (IWidgetBackend) BackendHost.Backend; }
|
||||
}
|
||||
|
||||
public WidgetSpacing Margin {
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Xwt
|
|||
}
|
||||
}
|
||||
|
||||
protected override WindowFrame.WindowBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WindowBackendHost ();
|
||||
}
|
||||
|
|
|
@ -56,30 +56,20 @@ using System.ComponentModel;
|
|||
|
||||
namespace Xwt
|
||||
{
|
||||
public class WindowFrame: Component
|
||||
public class WindowFrame: XwtComponent
|
||||
{
|
||||
EventHandler boundsChanged;
|
||||
Rectangle bounds;
|
||||
WindowBackendHost backendHost;
|
||||
bool pendingReallocation;
|
||||
|
||||
protected class WindowBackendHost: BackendHost<WindowFrame>, IWindowFrameEventSink
|
||||
protected class WindowBackendHost: BackendHost<WindowFrame,IWindowFrameBackend>, IWindowFrameEventSink
|
||||
{
|
||||
public WindowBackendHost ()
|
||||
{
|
||||
}
|
||||
|
||||
public WindowBackendHost (IBackend backend): base (backend)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBackendCreated ()
|
||||
{
|
||||
base.OnBackendCreated ();
|
||||
var b = (IWindowFrameBackend)Backend;
|
||||
b.Initialize (this);
|
||||
Parent.bounds = b.Bounds;
|
||||
b.EnableEvent (WindowFrameEvent.BoundsChanged);
|
||||
Backend.Initialize (this);
|
||||
Parent.bounds = Backend.Bounds;
|
||||
Backend.EnableEvent (WindowFrameEvent.BoundsChanged);
|
||||
}
|
||||
|
||||
public void OnBoundsChanged (Rectangle bounds)
|
||||
|
@ -90,8 +80,8 @@ namespace Xwt
|
|||
|
||||
public WindowFrame ()
|
||||
{
|
||||
backendHost = CreateBackendHost ();
|
||||
backendHost.Parent = this;
|
||||
if (!(base.BackendHost is WindowBackendHost))
|
||||
throw new InvalidOperationException ("CreateBackendHost for WindowFrame did not return a WindowBackendHost instance");
|
||||
}
|
||||
|
||||
public WindowFrame (string title): this ()
|
||||
|
@ -113,13 +103,13 @@ namespace Xwt
|
|||
get { return (IWindowFrameBackend) BackendHost.Backend; }
|
||||
}
|
||||
|
||||
protected virtual WindowBackendHost CreateBackendHost ()
|
||||
protected override BackendHost CreateBackendHost ()
|
||||
{
|
||||
return new WindowBackendHost ();
|
||||
}
|
||||
|
||||
protected WindowBackendHost BackendHost {
|
||||
get { return backendHost; }
|
||||
protected new WindowBackendHost BackendHost {
|
||||
get { return (WindowBackendHost) base.BackendHost; }
|
||||
}
|
||||
|
||||
public Rectangle ScreenBounds {
|
||||
|
|
|
@ -33,103 +33,6 @@ using Xwt.Backends;
|
|||
|
||||
namespace Xwt
|
||||
{
|
||||
/* public abstract class XwtComponent: Component, IFrontend
|
||||
{
|
||||
IBackend backend;
|
||||
bool usingCustomBackend;
|
||||
|
||||
HashSet<object> defaultEnabledEvents;
|
||||
|
||||
public XwtComponent ()
|
||||
{
|
||||
}
|
||||
|
||||
protected XwtComponent (IBackend backend)
|
||||
{
|
||||
this.backend = backend;
|
||||
usingCustomBackend = true;
|
||||
}
|
||||
|
||||
protected IBackend Backend {
|
||||
get {
|
||||
LoadBackend ();
|
||||
return backend;
|
||||
}
|
||||
}
|
||||
|
||||
object IFrontend.Backend {
|
||||
get { return Backend; }
|
||||
}
|
||||
|
||||
internal bool BackendCreated {
|
||||
get { return backend != null; }
|
||||
}
|
||||
|
||||
protected virtual void OnBackendCreated ()
|
||||
{
|
||||
foreach (var ev in DefaultEnabledEvents)
|
||||
Backend.EnableEvent (ev);
|
||||
}
|
||||
|
||||
protected virtual IBackend OnCreateBackend ()
|
||||
{
|
||||
Type t = GetType ();
|
||||
while (t != typeof(XwtComponent)) {
|
||||
IBackend b = WidgetRegistry.CreateBackend<IBackend> (t);
|
||||
if (b != null)
|
||||
return b;
|
||||
t = t.BaseType;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void LoadBackend ()
|
||||
{
|
||||
if (usingCustomBackend) {
|
||||
usingCustomBackend = false;
|
||||
backend.InitializeBackend (this);
|
||||
OnBackendCreated ();
|
||||
}
|
||||
else if (backend == null) {
|
||||
backend = OnCreateBackend ();
|
||||
if (backend == null)
|
||||
throw new InvalidOperationException ("No backend found for widget: " + GetType ());
|
||||
backend.InitializeBackend (this);
|
||||
OnBackendCreated ();
|
||||
}
|
||||
}
|
||||
|
||||
internal static IBackend GetBackend (XwtComponent w)
|
||||
{
|
||||
return w != null ? w.Backend : null;
|
||||
}
|
||||
|
||||
protected static void MapEvent (object eventId, Type type, string methodName)
|
||||
{
|
||||
EventUtil.MapEvent (eventId, type, methodName);
|
||||
}
|
||||
|
||||
protected void OnBeforeEventAdd (object eventId, Delegate eventDelegate)
|
||||
{
|
||||
if (eventDelegate == null && !DefaultEnabledEvents.Contains (eventId))
|
||||
Backend.EnableEvent (eventId);
|
||||
}
|
||||
|
||||
protected void OnAfterEventRemove (object eventId, Delegate eventDelegate)
|
||||
{
|
||||
if (eventDelegate != null && !DefaultEnabledEvents.Contains (eventId))
|
||||
Backend.DisableEvent (eventId);
|
||||
}
|
||||
|
||||
internal HashSet<object> DefaultEnabledEvents {
|
||||
get {
|
||||
if (defaultEnabledEvents == null)
|
||||
defaultEnabledEvents = EventUtil.GetDefaultEnabledEvents (GetType ());
|
||||
return defaultEnabledEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
public abstract class XwtComponent: Component, IFrontend
|
||||
{
|
||||
BackendHost backendHost;
|
||||
|
|
Загрузка…
Ссылка в новой задаче