Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed canvas double drawing and made BackgroundColor virtual #1037

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Xwt.XamMac/Xwt.Mac/CanvasBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ protected override void OnSizeToFit ()
Widget.SetFrameSize (new CGSize ((nfloat)s.Width, (nfloat)s.Height));
}

// Skip Layer initialization in base to avoid rendering issues. CanvasView.DrawRect will draw the background.
public override Xwt.Drawing.Color BackgroundColor { get; set; }
mykyta-bondarenko marked this conversation as resolved.
Show resolved Hide resolved

public Rectangle Bounds {
get {
return new Rectangle (0, 0, view.Frame.Width, view.Frame.Height);
Expand Down Expand Up @@ -161,4 +164,3 @@ public override bool BecomeFirstResponder()
}
}
}

7 changes: 6 additions & 1 deletion Xwt/Xwt/FrameBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,12 @@ public FrameBox (Widget content): this ()
}
}

public Color BorderColor {
public override Color BackgroundColor {
get { return canvas.BackgroundColor; }
set { canvas.BackgroundColor = value; }
}

public Color BorderColor {
get { return borderColor; }
set { borderColor = value; canvas.QueueDraw (); }
}
Expand Down
2 changes: 1 addition & 1 deletion Xwt/Xwt/Widget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ public void Hide ()
/// Gets or sets the background color.
/// </summary>
/// <value>The background color of the widget.</value>
public Color BackgroundColor {
public virtual Color BackgroundColor {
get { return Backend.BackgroundColor; }
set { Backend.BackgroundColor = value; }
}
Expand Down