Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVsevolod Kukol <sevoku@microsoft.com>2017-03-04 01:12:55 +0300
committerVsevolod Kukol <sevoku@microsoft.com>2017-03-07 17:46:34 +0300
commit1fbcde76ed54ae5de7e6bc9aa4a7f747b7750abf (patch)
tree7df751164cff51f514ace1eeea823d5b3bf3046c /TestApps
parent404de6951bf9e5ef781e78960eafb7f6f0551d01 (diff)
Add PopupWindow examples
Diffstat (limited to 'TestApps')
-rw-r--r--TestApps/Samples/MainWindow.cs1
-rw-r--r--TestApps/Samples/Samples.csproj1
-rw-r--r--TestApps/Samples/Samples/PopupWindows.cs86
3 files changed, 88 insertions, 0 deletions
diff --git a/TestApps/Samples/MainWindow.cs b/TestApps/Samples/MainWindow.cs
index caab05a0..7523dc47 100644
--- a/TestApps/Samples/MainWindow.cs
+++ b/TestApps/Samples/MainWindow.cs
@@ -135,6 +135,7 @@ namespace Samples
var windows = AddSample (null, "Windows", typeof(Windows));
AddSample (windows, "Message Dialogs", typeof(MessageDialogs));
+ AddSample (windows, "Popup Windows", typeof(PopupWindows));
AddSample (null, "Screens", typeof (ScreensSample));
diff --git a/TestApps/Samples/Samples.csproj b/TestApps/Samples/Samples.csproj
index 7c3933ef..3bbe0b5a 100644
--- a/TestApps/Samples/Samples.csproj
+++ b/TestApps/Samples/Samples.csproj
@@ -117,6 +117,7 @@
<Compile Include="Samples\FileSelectorSample.cs" />
<Compile Include="Samples\FolderSelectorSample.cs" />
<Compile Include="Samples\ListViewCombos.cs" />
+ <Compile Include="Samples\PopupWindows.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
diff --git a/TestApps/Samples/Samples/PopupWindows.cs b/TestApps/Samples/Samples/PopupWindows.cs
new file mode 100644
index 00000000..c7ce2e38
--- /dev/null
+++ b/TestApps/Samples/Samples/PopupWindows.cs
@@ -0,0 +1,86 @@
+//
+// PopupWindows.cs
+//
+// Author:
+// Vsevolod Kukol <sevoku@microsoft.com>
+//
+// Copyright (c) 2017 (c) Microsoft Corporation
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using Xwt;
+using Xwt.Drawing;
+
+namespace Samples
+{
+ public class PopupWindows : VBox
+ {
+ public PopupWindows ()
+ {
+ var btn1 = new Button ("Show Utility Window");
+ PopupWindow popup1 = null;
+ btn1.Clicked += (sender, e) => {
+ if (popup1 == null) {
+ popup1 = new PopupWindow ();
+ popup1.TransientFor = ParentWindow;
+ popup1.InitialLocation = WindowLocation.CenterParent;
+ popup1.Title = "Utility";
+ var content = new VBox ();
+ content.PackStart (new Label ("Utility Window"));
+ var btn = new Button ("Close");
+ btn.Clicked += delegate { popup1.Close (); };
+ content.PackStart (btn);
+ popup1.Content = content;
+ }
+ popup1.Show ();
+ };
+
+ PackStart (btn1);
+
+
+ var btn2 = new Button ("Show custom Tooltip Window");
+ PopupWindow popup2 = null;
+ btn2.Clicked += (sender, e) => {
+ if (popup2 == null) {
+ popup2 = new PopupWindow (PopupWindow.PopupType.Tooltip);
+ popup2.TransientFor = ParentWindow;
+ popup2.Decorated = false;
+ popup2.Title = "Tooltip";
+ popup2.BackgroundColor = Colors.Blue.WithAlpha (0.7);
+ var l = new Label ("Tooltip Window");
+ l.Margin = 5;
+ l.TextColor = Colors.White;
+ l.MouseExited += (sl, el) => popup2.Hide ();
+ l.VerticalPlacement = l.HorizontalPlacement = WidgetPlacement.Center;
+ l.Margin = new WidgetSpacing (5, 4, 5, 4);
+
+ popup2.Content = l;
+ }
+ if (!popup2.Visible) {
+ btn2.Label = "Hide custom Tooltip Window";
+ popup2.Show ();
+ } else {
+ btn2.Label = "Show custom Tooltip Window";
+ popup2.Hide ();
+ }
+ };
+
+ PackStart (btn2);
+ }
+ }
+}