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:
Diffstat (limited to 'Xwt.XamMac/Xwt.Mac.CellViews/TextTableCell.cs')
-rw-r--r--Xwt.XamMac/Xwt.Mac.CellViews/TextTableCell.cs133
1 files changed, 110 insertions, 23 deletions
diff --git a/Xwt.XamMac/Xwt.Mac.CellViews/TextTableCell.cs b/Xwt.XamMac/Xwt.Mac.CellViews/TextTableCell.cs
index f51e763a..0d79d44a 100644
--- a/Xwt.XamMac/Xwt.Mac.CellViews/TextTableCell.cs
+++ b/Xwt.XamMac/Xwt.Mac.CellViews/TextTableCell.cs
@@ -24,61 +24,148 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-
-using System;
using AppKit;
+using Foundation;
using Xwt.Backends;
namespace Xwt.Mac
{
- class TextTableCell: NSCell, ICellRenderer
+ class TextTableCell : NSTextField, ICellRenderer
{
- bool visible = true;
-
-
- public TextTableCell (): base ("")
- {
- Wraps = false;
- }
-
- public TextTableCell (IntPtr p): base (p)
+ NSTrackingArea trackingArea;
+ public TextTableCell ()
{
+ Editable = false;
+ Bezeled = false;
+ DrawsBackground = false;
}
ITextCellViewFrontend Frontend {
get { return (ITextCellViewFrontend) Backend.Frontend; }
}
+
+ public override bool AllowsVibrancy {
+ get {
+ // we don't support vibrancy
+ if (EffectiveAppearance.AllowsVibrancy)
+ return false;
+ return base.AllowsVibrancy;
+ }
+ }
public CellViewBackend Backend { get; set; }
public CompositeCell CellContainer { get; set; }
+ public NSView CellView { get { return this; } }
+
public void Fill ()
{
if (Frontend.Markup != null)
AttributedStringValue = FormattedText.FromMarkup (Frontend.Markup).ToAttributedString ();
else
StringValue = Frontend.Text ?? "";
- visible = Frontend.Visible;
+ Hidden = !Frontend.Visible;
+ }
+
+ public virtual NSBackgroundStyle BackgroundStyle {
+ [Export ("backgroundStyle")]
+ get {
+ return Cell.BackgroundStyle;
+ }
+ [Export ("setBackgroundStyle:")]
+ set {
+ Cell.BackgroundStyle = value;
+ }
}
- public override CoreGraphics.CGSize CellSizeForBounds (CoreGraphics.CGRect bounds)
+ public void CopyFrom (object other)
{
- if (visible)
- return base.CellSizeForBounds (bounds);
- return CoreGraphics.CGSize.Empty;
+ var ob = (TextTableCell)other;
+ Backend = ob.Backend;
}
- public override void DrawInteriorWithFrame (CoreGraphics.CGRect cellFrame, NSView inView)
+ public override void UpdateTrackingAreas ()
{
- if (visible)
- base.DrawInteriorWithFrame (cellFrame, inView);
+ if (trackingArea != null) {
+ RemoveTrackingArea (trackingArea);
+ trackingArea.Dispose ();
+ }
+ var options = NSTrackingAreaOptions.MouseMoved | NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.MouseEnteredAndExited;
+ trackingArea = new NSTrackingArea (Bounds, options, this, null);
+ AddTrackingArea (trackingArea);
}
- public void CopyFrom (object other)
+ public override void RightMouseDown (NSEvent theEvent)
{
- var ob = (TextTableCell)other;
- Backend = ob.Backend;
+ if (!this.HandleMouseDown (theEvent))
+ base.RightMouseDown (theEvent);
+ }
+
+ public override void RightMouseUp (NSEvent theEvent)
+ {
+ if (!this.HandleMouseUp (theEvent))
+ base.RightMouseUp (theEvent);
+ }
+
+ public override void MouseDown (NSEvent theEvent)
+ {
+ if (!this.HandleMouseDown (theEvent))
+ base.MouseDown (theEvent);
+ }
+
+ public override void MouseUp (NSEvent theEvent)
+ {
+ if (!this.HandleMouseUp (theEvent))
+ base.MouseUp (theEvent);
+ }
+
+ public override void OtherMouseDown (NSEvent theEvent)
+ {
+ if (!this.HandleMouseDown (theEvent))
+ base.OtherMouseDown (theEvent);
+ }
+
+ public override void OtherMouseUp (NSEvent theEvent)
+ {
+ if (!this.HandleMouseUp (theEvent))
+ base.OtherMouseUp (theEvent);
+ }
+
+ public override void MouseEntered (NSEvent theEvent)
+ {
+ this.HandleMouseEntered (theEvent);
+ base.MouseEntered (theEvent);
+ }
+
+ public override void MouseExited (NSEvent theEvent)
+ {
+ this.HandleMouseExited (theEvent);
+ base.MouseExited (theEvent);
+ }
+
+ public override void MouseMoved (NSEvent theEvent)
+ {
+ if (!this.HandleMouseMoved (theEvent))
+ base.MouseMoved (theEvent);
+ }
+
+ public override void MouseDragged (NSEvent theEvent)
+ {
+ if (!this.HandleMouseMoved (theEvent))
+ base.MouseDragged (theEvent);
+ }
+
+ public override void KeyDown (NSEvent theEvent)
+ {
+ if (!this.HandleKeyDown (theEvent))
+ base.KeyDown (theEvent);
+ }
+
+ public override void KeyUp (NSEvent theEvent)
+ {
+ if (!this.HandleKeyUp (theEvent))
+ base.KeyUp (theEvent);
}
}
}