]> O.S.I.I.S - jp/crow.git/commitdiff
widget focus, update glfw-net colors
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 1 Sep 2020 18:47:10 +0000 (20:47 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 1 Sep 2020 18:47:10 +0000 (20:47 +0200)
Crow/Crow.csproj
Crow/src/IML/Instantiator.cs
Crow/src/Interface.cs
Crow/src/Mono.Cairo/Device.cs
Crow/src/Widgets/TextBox.cs
Crow/src/Widgets/Widget.cs

index 8a0b9434c5ec59c2a4c2dd7cd77d6baa091dc3de..481cb7b062729b19bec42a968520aab816c6f4f2 100644 (file)
@@ -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'">
index 7bf27b285d844a9e1bb5a7a3e205643fee8c0fd9..7a4ca5a66c5f6b0b768590b4ed4263050128838c 100644 (file)
@@ -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 ());
 
index 520899fd931ada34b53cbc7abf2b665fae5fe105..d11070f879b3444f6a7c4fc567bdb86570a5e66c 100644 (file)
@@ -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>
index dc9910cbde3f66e6ee71ad6b5ed2f3db94b5e2f5..484264f0373d535a8f9eedd2b9366c63ca79c481 100644 (file)
@@ -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){
index 06b2b2d94f31109ba96f4fa9cb9e520e692077a6..31b513a6f378b4e9471454fdd4753a45e54a2d1a 100644 (file)
@@ -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;
index 04eadf8d62c08c7eec8b6d255bc8358587358d0b..c060f954f3e9dfe91629dbf6be8e5e579a457778 100644 (file)
@@ -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);
                        }