Merge remote-tracking branch 'upstream/master' into gtk3
Conflicts: Xwt.Gtk/Xwt.GtkBackend/Conversion.cs
This commit is contained in:
Коммит
8e6a86aa5d
|
@ -48,6 +48,7 @@ namespace Samples
|
|||
// Custom list box
|
||||
|
||||
ListBox customList = new ListBox ();
|
||||
customList.GridLinesVisible = true;
|
||||
ListStore store = new ListStore (name, icon);
|
||||
customList.DataSource = store;
|
||||
customList.Views.Add (new ImageCellView (icon));
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace Samples
|
|||
{
|
||||
PackStart (new Label ("The listview should have a red background"));
|
||||
ListView list = new ListView ();
|
||||
list.GridLinesVisible = GridLines.Both;
|
||||
ListStore store = new ListStore (name, icon, text, icon2, progress);
|
||||
list.DataSource = store;
|
||||
list.Columns.Add ("Name", icon, name);
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Samples
|
|||
|
||||
ListStore store = new ListStore(editableActiveField, nonEditableActiveField, textField, textField2, editableField, somewhatEditableData);
|
||||
list.DataSource = store;
|
||||
list.GridLinesVisible = GridLines.Horizontal;
|
||||
|
||||
list.Columns.Add (new ListViewColumn("Editable", new CheckBoxCellView { Editable = true, ActiveField = editableActiveField }));
|
||||
list.Columns.Add (new ListViewColumn("Not Editable", new CheckBoxCellView { Editable = false, ActiveField = nonEditableActiveField }));
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace Samples
|
|||
{
|
||||
TreeView view = new TreeView ();
|
||||
TreeStore store = new TreeStore (triState, check, text, desc);
|
||||
view.GridLinesVisible = GridLines.Both;
|
||||
|
||||
var triStateCellView = new CheckBoxCellView (triState) { Editable = true, AllowMixed = true };
|
||||
triStateCellView.Toggled += (object sender, WidgetEventArgs e) => {
|
||||
|
|
|
@ -139,6 +139,38 @@ namespace Xwt.GtkBackend
|
|||
req.Width = (int)size.Width;
|
||||
return req;
|
||||
}
|
||||
|
||||
public static Gtk.TreeViewGridLines ToGtkValue (this GridLines value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case GridLines.Both:
|
||||
return Gtk.TreeViewGridLines.Both;
|
||||
case GridLines.Horizontal:
|
||||
return Gtk.TreeViewGridLines.Horizontal;
|
||||
case GridLines.Vertical:
|
||||
return Gtk.TreeViewGridLines.Vertical;
|
||||
case GridLines.None:
|
||||
return Gtk.TreeViewGridLines.None;
|
||||
}
|
||||
throw new InvalidOperationException("Invalid GridLines value: " + value);
|
||||
}
|
||||
|
||||
public static GridLines ToXwtValue (this Gtk.TreeViewGridLines value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case Gtk.TreeViewGridLines.Both:
|
||||
return GridLines.Both;
|
||||
case Gtk.TreeViewGridLines.Horizontal:
|
||||
return GridLines.Horizontal;
|
||||
case Gtk.TreeViewGridLines.Vertical:
|
||||
return GridLines.Vertical;
|
||||
case Gtk.TreeViewGridLines.None:
|
||||
return GridLines.None;
|
||||
}
|
||||
throw new InvalidOperationException("Invalid TreeViewGridLines value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,15 @@ namespace Xwt.GtkBackend
|
|||
{
|
||||
}
|
||||
|
||||
public new bool GridLinesVisible {
|
||||
get {
|
||||
return (base.GridLinesVisible == Xwt.GridLines.Horizontal || base.GridLinesVisible == Xwt.GridLines.Both);
|
||||
}
|
||||
set {
|
||||
base.GridLinesVisible = value ? Xwt.GridLines.Horizontal : Xwt.GridLines.None;
|
||||
}
|
||||
}
|
||||
|
||||
protected new IListBoxEventSink EventSink {
|
||||
get { return (IListBoxEventSink)((WidgetBackend)this).EventSink; }
|
||||
}
|
||||
|
|
|
@ -91,6 +91,12 @@ namespace Xwt.GtkBackend
|
|||
}
|
||||
}
|
||||
|
||||
public GridLines GridLinesVisible
|
||||
{
|
||||
get { return Widget.EnableGridLines.ToXwtValue (); }
|
||||
set { Widget.EnableGridLines = value.ToGtkValue (); }
|
||||
}
|
||||
|
||||
public IScrollControlBackend CreateVerticalScrollControl ()
|
||||
{
|
||||
return new ScrollControltBackend (ScrolledWindow.Vadjustment);
|
||||
|
|
|
@ -37,6 +37,15 @@ namespace Xwt.Mac
|
|||
{
|
||||
}
|
||||
|
||||
public new bool GridLinesVisible {
|
||||
get {
|
||||
return (base.GridLinesVisible == Xwt.GridLines.Horizontal || base.GridLinesVisible == Xwt.GridLines.Both);
|
||||
}
|
||||
set {
|
||||
base.GridLinesVisible = value ? Xwt.GridLines.Horizontal : Xwt.GridLines.None;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialize ()
|
||||
{
|
||||
base.Initialize ();
|
||||
|
|
|
@ -256,6 +256,12 @@ namespace Xwt.Mac
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GridLines GridLinesVisible
|
||||
{
|
||||
get { return Table.GridStyleMask.ToXwtValue (); }
|
||||
set { Table.GridStyleMask = value.ToMacValue (); }
|
||||
}
|
||||
}
|
||||
|
||||
class ScrollView: NSScrollView, IViewObject
|
||||
|
|
|
@ -407,6 +407,38 @@ namespace Xwt.Mac
|
|||
m |= ModifierKeys.Shift;
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static MonoMac.AppKit.NSTableViewGridStyle ToMacValue (this GridLines value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case GridLines.Both:
|
||||
return (NSTableViewGridStyle.SolidHorizontalLine | NSTableViewGridStyle.SolidVerticalLine);
|
||||
case GridLines.Horizontal:
|
||||
return NSTableViewGridStyle.SolidHorizontalLine;
|
||||
case GridLines.Vertical:
|
||||
return NSTableViewGridStyle.SolidVerticalLine;
|
||||
case GridLines.None:
|
||||
return NSTableViewGridStyle.None;
|
||||
}
|
||||
throw new InvalidOperationException("Invalid GridLines value: " + value);
|
||||
}
|
||||
|
||||
public static GridLines ToXwtValue (this NSTableViewGridStyle value)
|
||||
{
|
||||
if (value.HasFlag (NSTableViewGridStyle.SolidHorizontalLine)) {
|
||||
if (value.HasFlag (NSTableViewGridStyle.SolidVerticalLine))
|
||||
return GridLines.Both;
|
||||
else
|
||||
return GridLines.Horizontal;
|
||||
}
|
||||
if (value.HasFlag (NSTableViewGridStyle.SolidVerticalLine))
|
||||
return GridLines.Vertical;
|
||||
|
||||
return GridLines.None;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ICopiableObject
|
||||
|
|
|
@ -52,6 +52,31 @@ namespace Xwt.WPFBackend
|
|||
}
|
||||
}
|
||||
|
||||
bool gridLinesVisible;
|
||||
public bool GridLinesVisible {
|
||||
get {
|
||||
return gridLinesVisible;
|
||||
}
|
||||
set {
|
||||
gridLinesVisible = value;
|
||||
if (!value) {
|
||||
if (this.ListBox.ItemContainerStyle != null) {
|
||||
this.ListBox.ItemContainerStyle.Setters.Remove (GridHorizontalSetter);
|
||||
this.ListBox.ItemContainerStyle.Setters.Remove (BorderBrushSetter);
|
||||
}
|
||||
} else {
|
||||
if (this.ListBox.ItemContainerStyle == null)
|
||||
this.ListBox.ItemContainerStyle = new Style ();
|
||||
|
||||
this.ListBox.ItemContainerStyle.Setters.Add (GridHorizontalSetter);
|
||||
this.ListBox.ItemContainerStyle.Setters.Add (BorderBrushSetter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Setter GridHorizontalSetter = new Setter (ListBoxItem.BorderThicknessProperty, new Thickness (0, 0, 0, 1));
|
||||
private static readonly Setter BorderBrushSetter = new Setter (ListBoxItem.BorderBrushProperty, System.Windows.Media.Brushes.LightGray);
|
||||
|
||||
public ScrollPolicy VerticalScrollPolicy
|
||||
{
|
||||
get { return ScrollViewer.GetVerticalScrollBarVisibility (ListBox).ToXwtScrollPolicy(); }
|
||||
|
|
|
@ -109,6 +109,30 @@ namespace Xwt.WPFBackend
|
|||
}
|
||||
}
|
||||
|
||||
GridLines gridLinesVisible;
|
||||
public GridLines GridLinesVisible {
|
||||
get {
|
||||
return gridLinesVisible;
|
||||
}
|
||||
set {
|
||||
gridLinesVisible = value;
|
||||
// we support only horizontal grid lines for now
|
||||
// vertical lines are tricky and have to be drawn manually...
|
||||
if (value == GridLines.None) {
|
||||
if (this.ListView.ItemContainerStyle != null) {
|
||||
this.ListView.ItemContainerStyle.Setters.Remove (GridHorizontalSetter);
|
||||
this.ListView.ItemContainerStyle.Setters.Remove (BorderBrushSetter);
|
||||
}
|
||||
} else {
|
||||
if (this.ListView.ItemContainerStyle == null)
|
||||
this.ListView.ItemContainerStyle = new Style ();
|
||||
|
||||
this.ListView.ItemContainerStyle.Setters.Add (GridHorizontalSetter);
|
||||
this.ListView.ItemContainerStyle.Setters.Add (BorderBrushSetter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int[] SelectedRows {
|
||||
get { return ListView.SelectedItems.Cast<object>().Select (ListView.Items.IndexOf).ToArray (); }
|
||||
}
|
||||
|
@ -239,6 +263,8 @@ namespace Xwt.WPFBackend
|
|||
}
|
||||
|
||||
private static readonly Setter HideHeadersSetter = new Setter (UIElement.VisibilityProperty, Visibility.Collapsed);
|
||||
private static readonly Setter GridHorizontalSetter = new Setter (ListViewItem.BorderThicknessProperty, new Thickness (0, 0, 0, 1));
|
||||
private static readonly Setter BorderBrushSetter = new Setter (ListViewItem.BorderBrushProperty, System.Windows.Media.Brushes.LightGray);
|
||||
|
||||
|
||||
public int GetRowAtPosition(Point p)
|
||||
|
|
|
@ -113,6 +113,16 @@ namespace Xwt.WPFBackend
|
|||
}
|
||||
}
|
||||
|
||||
GridLines gridLinesVisible;
|
||||
public GridLines GridLinesVisible {
|
||||
get {
|
||||
return gridLinesVisible;
|
||||
}
|
||||
set {
|
||||
gridLinesVisible = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectRow (TreePosition pos)
|
||||
{
|
||||
Tree.SelectedItems.Add (pos);
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace Xwt.Backends
|
|||
void SelectRow (int pos);
|
||||
void UnselectRow (int pos);
|
||||
void ScrollToRow (int row);
|
||||
bool GridLinesVisible { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace Xwt.Backends
|
|||
void ScrollToRow (int row);
|
||||
|
||||
bool BorderVisible { get; set; }
|
||||
GridLines GridLinesVisible { get; set; }
|
||||
bool HeadersVisible { get; set; }
|
||||
|
||||
int GetRowAtPosition (Point p);
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace Xwt.Backends
|
|||
void ExpandToRow (TreePosition pos);
|
||||
|
||||
bool HeadersVisible { get; set; }
|
||||
GridLines GridLinesVisible { get; set; }
|
||||
|
||||
bool GetDropTargetRow (double x, double y, out RowDropPosition pos, out TreePosition nodePosition);
|
||||
|
||||
|
|
|
@ -321,6 +321,7 @@
|
|||
<Compile Include="Xwt.Backends\ICanvasCellViewBackend.cs" />
|
||||
<Compile Include="Xwt\SearchTextEntry.cs" />
|
||||
<Compile Include="Xwt.Backends\ISearchTextEntryBackend.cs" />
|
||||
<Compile Include="Xwt\GridLines.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup />
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// GridLines.cs
|
||||
//
|
||||
// Author:
|
||||
// Vsevolod Kukol <v.kukol@rubologic.de>
|
||||
//
|
||||
// Copyright (c) 2014 Vsevolod Kukol
|
||||
//
|
||||
// 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.
|
||||
|
||||
namespace Xwt
|
||||
{
|
||||
public enum GridLines
|
||||
{
|
||||
None,
|
||||
Vertical,
|
||||
Horizontal,
|
||||
Both
|
||||
}
|
||||
}
|
|
@ -144,6 +144,12 @@ namespace Xwt
|
|||
}
|
||||
}
|
||||
|
||||
public bool GridLinesVisible
|
||||
{
|
||||
get { return Backend.GridLinesVisible; }
|
||||
set { Backend.GridLinesVisible = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the vertical scroll policy.
|
||||
/// </summary>
|
||||
|
|
|
@ -95,6 +95,12 @@ namespace Xwt
|
|||
set { Backend.BorderVisible = value; }
|
||||
}
|
||||
|
||||
public GridLines GridLinesVisible
|
||||
{
|
||||
get { return Backend.GridLinesVisible; }
|
||||
set { Backend.GridLinesVisible = value; }
|
||||
}
|
||||
|
||||
public ScrollPolicy VerticalScrollPolicy {
|
||||
get { return Backend.VerticalScrollPolicy; }
|
||||
set { Backend.VerticalScrollPolicy = value; }
|
||||
|
|
|
@ -187,6 +187,12 @@ namespace Xwt
|
|||
}
|
||||
}
|
||||
|
||||
public GridLines GridLinesVisible
|
||||
{
|
||||
get { return Backend.GridLinesVisible; }
|
||||
set { Backend.GridLinesVisible = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the selection mode.
|
||||
/// </summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче