aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-09-01 20:47:10 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-09-01 20:47:10 +0200
commit060b89f24df61f71f281989ce81368dbefb47886 (patch)
tree849463041d1b1e8ecffa6bb24439990a62af32d6
parent6745ec4d738cb4f268bc7c221b6e96c51c2f4808 (diff)
widget focus, update glfw-netcolors
-rw-r--r--Crow/Crow.csproj2
-rw-r--r--Crow/src/IML/Instantiator.cs4
-rw-r--r--Crow/src/Interface.cs22
-rw-r--r--Crow/src/Mono.Cairo/Device.cs2
-rw-r--r--Crow/src/Widgets/TextBox.cs2
-rw-r--r--Crow/src/Widgets/Widget.cs7
6 files changed, 22 insertions, 17 deletions
diff --git a/Crow/Crow.csproj b/Crow/Crow.csproj
index 8a0b9434..481cb7b0 100644
--- a/Crow/Crow.csproj
+++ b/Crow/Crow.csproj
@@ -38,7 +38,7 @@
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
<PackageReference Include="System.Reflection.Emit.ILGeneration" Version="4.6.0" />
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.6.0" />
- <PackageReference Include="glfw-sharp" Version="0.2.7-beta" />
+ <PackageReference Include="glfw-sharp" Version="0.2.9-beta" />
<PackageReference Include="FastEnum" Version="1.5.3" />
</ItemGroup>
<PropertyGroup Condition=" '$(CrowStbSharp)' == 'true'">
diff --git a/Crow/src/IML/Instantiator.cs b/Crow/src/IML/Instantiator.cs
index 7bf27b28..7a4ca5a6 100644
--- a/Crow/src/IML/Instantiator.cs
+++ b/Crow/src/IML/Instantiator.cs
@@ -1319,8 +1319,8 @@ namespace Crow.IML {
//value type for conversion
CompilerServices.emitConvert (il, piSource.PropertyType);
- if (!piSource.CanWrite)
- throw new Exception ("Source member of bindind is read only:" + piSource.ToString());
+ if (piSource.SetMethod == null)
+ throw new Exception ("Source member of bindind is read only:" + piSource.ToString ());
il.Emit (OpCodes.Callvirt, piSource.GetSetMethod ());
diff --git a/Crow/src/Interface.cs b/Crow/src/Interface.cs
index 520899fd..d11070f8 100644
--- a/Crow/src/Interface.cs
+++ b/Crow/src/Interface.cs
@@ -125,6 +125,17 @@ namespace Crow
Cursor currentCursor;
bool ownWindow;
+ protected void registerGlfwCallbacks ()
+ {
+ windows.Add (hWin, this);
+ Glfw3.SetKeyCallback (hWin, HandleKeyDelegate);
+ Glfw3.SetMouseButtonPosCallback (hWin, HandleMouseButtonDelegate);
+ Glfw3.SetCursorPosCallback (hWin, HandleCursorPosDelegate);
+ Glfw3.SetScrollCallback (hWin, HandleScrollDelegate);
+ Glfw3.SetCharCallback (hWin, HandleCharDelegate);
+ Glfw3.SetWindowSizeCallback (hWin, HandleWindowSizeDelegate);
+ }
+
void initSurface ()
{
Glfw3.Init ();
@@ -138,12 +149,7 @@ namespace Crow
throw new Exception ("[GLFW3] Unable to create vulkan Window");
ownWindow = true;
- Glfw3.SetKeyCallback (hWin, HandleKeyDelegate);
- Glfw3.SetMouseButtonPosCallback (hWin, HandleMouseButtonDelegate);
- Glfw3.SetCursorPosCallback (hWin, HandleCursorPosDelegate);
- Glfw3.SetScrollCallback (hWin, HandleScrollDelegate);
- Glfw3.SetCharCallback (hWin, HandleCharDelegate);
- Glfw3.SetWindowSizeCallback (hWin, HandleWindowSizeDelegate);
+ registerGlfwCallbacks ();
switch (Environment.OSVersion.Platform) {
case PlatformID.MacOSX:
@@ -166,8 +172,6 @@ namespace Crow
case PlatformID.WinCE:
throw new PlatformNotSupportedException ("Unable to create cairo surface.");
}
-
- windows.Add (hWin, this);
}
#region events delegates
@@ -597,7 +601,7 @@ namespace Crow
#region focus
Widget _activeWidget; //button is pressed on widget
Widget _hoverWidget; //mouse is over
- Widget _focusedWidget; //has keyboard (or other perif) focus
+ internal Widget _focusedWidget; //has keyboard (or other perif) focus
/// <summary>Widget is focused and button is down or another perif action is occuring
/// , it can not lose focus while Active</summary>
diff --git a/Crow/src/Mono.Cairo/Device.cs b/Crow/src/Mono.Cairo/Device.cs
index dc9910cb..484264f0 100644
--- a/Crow/src/Mono.Cairo/Device.cs
+++ b/Crow/src/Mono.Cairo/Device.cs
@@ -64,7 +64,7 @@ namespace Crow.Cairo
}
public string Status {
get {
- return ""; //System.Runtime.InteropServices.Marshal.PtrToStringAuto(NativeMethods.cairo_status_to_string (NativeMethods.cairo_device_status (handle)));
+ return System.Runtime.InteropServices.Marshal.PtrToStringAuto(NativeMethods.cairo_status_to_string (NativeMethods.cairo_device_status (handle)));
}
}
public void SetThreadAware (bool value){
diff --git a/Crow/src/Widgets/TextBox.cs b/Crow/src/Widgets/TextBox.cs
index 06b2b2d9..31b513a6 100644
--- a/Crow/src/Widgets/TextBox.cs
+++ b/Crow/src/Widgets/TextBox.cs
@@ -18,7 +18,7 @@ namespace Crow
[XmlIgnore]public override bool HasFocus //trigger update when lost focus to errase text beam
{
get => base.HasFocus;
- internal set {
+ set {
if (base.HasFocus == value)
return;
base.HasFocus = value;
diff --git a/Crow/src/Widgets/Widget.cs b/Crow/src/Widgets/Widget.cs
index 04eadf8d..c060f954 100644
--- a/Crow/src/Widgets/Widget.cs
+++ b/Crow/src/Widgets/Widget.cs
@@ -701,14 +701,15 @@ namespace Crow
/// </summary>
[XmlIgnore]public virtual bool HasFocus {
get { return hasFocus; }
- internal set {
+ set {
if (value == hasFocus)
return;
hasFocus = value;
- if (hasFocus)
+ if (hasFocus) {
+ IFace.FocusedWidget = this;
onFocused (this, null);
- else
+ } else
onUnfocused (this, null);
NotifyValueChangedAuto (hasFocus);
}