[hyena/gtk3: 2/13] Port hyena to API of gtk-sharp master (3.x)
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena/gtk3: 2/13] Port hyena to API of gtk-sharp master (3.x)
- Date: Thu, 28 Apr 2011 16:58:21 +0000 (UTC)
commit 86641637ec8b24dcba41bc323607903c4e9aa194
Author: Andrés G. Aragoneses <knocte gmail com>
Date: Thu Apr 21 13:26:56 2011 +0200
Port hyena to API of gtk-sharp master (3.x)
Main changes for it to compile.
Doesn't include a11y changes.
Still has some things to fix (I'll add FIXMEs soon).
Hyena.Gui/Hyena.Data.Gui/CellContext.cs | 2 +-
Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs | 4 +-
.../Hyena.Data.Gui/ListView/ListView_Accessible.cs | 6 +-
.../Hyena.Data.Gui/ListView/ListView_Header.cs | 2 +-
.../ListView/ListView_Interaction.cs | 16 +++---
.../Hyena.Data.Gui/ListView/ListView_Rendering.cs | 15 ++++---
.../Hyena.Data.Gui/ListView/ListView_Windowing.cs | 36 +++++++++++----
Hyena.Gui/Hyena.Gui.Canvas/CanvasHost.cs | 33 ++++++++++----
Hyena.Gui/Hyena.Gui.Dialogs/ExceptionDialog.cs | 5 +-
.../Hyena.Gui.Dialogs/VersionInformationDialog.cs | 6 +-
Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs | 8 ---
Hyena.Gui/Hyena.Gui.Theming/ThemeTestModule.cs | 25 ++++------
Hyena.Gui/Hyena.Gui/CairoExtensions.cs | 3 +-
Hyena.Gui/Hyena.Gui/CompositeUtils.cs | 35 +-------------
Hyena.Gui/Hyena.Gui/EditableUndoAdapter.cs | 2 +-
Hyena.Gui/Hyena.Gui/GtkUtilities.cs | 17 ++-----
Hyena.Gui/Hyena.Gui/HyenaActionGroup.cs | 4 +-
Hyena.Gui/Hyena.Gui/ShadingTestWindow.cs | 5 +-
.../Hyena.Query.Gui/FileSizeQueryValueEntry.cs | 4 +-
Hyena.Gui/Hyena.Query.Gui/QueryBox.cs | 6 +-
Hyena.Gui/Hyena.Query.Gui/QueryLimitBox.cs | 8 ++--
Hyena.Gui/Hyena.Query.Gui/QueryTermBox.cs | 16 +++----
.../Hyena.Query.Gui/TimeSpanQueryValueEntry.cs | 4 +-
Hyena.Gui/Hyena.Widgets/AnimatedBox.cs | 21 +++++++-
Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs | 48 +++++++++++++-------
Hyena.Gui/Hyena.Widgets/ComplexMenuItem.cs | 23 ++++++---
Hyena.Gui/Hyena.Widgets/EntryPopup.cs | 15 +++---
Hyena.Gui/Hyena.Widgets/GrabHandle.cs | 10 ++--
Hyena.Gui/Hyena.Widgets/HigMessageDialog.cs | 5 +-
Hyena.Gui/Hyena.Widgets/MenuButton.cs | 17 +++++--
Hyena.Gui/Hyena.Widgets/MessageBar.cs | 20 +++-----
Hyena.Gui/Hyena.Widgets/PulsingButton.cs | 11 +++--
Hyena.Gui/Hyena.Widgets/RatingEntry.cs | 44 ++++++++++++------
Hyena.Gui/Hyena.Widgets/RoundedFrame.cs | 44 ++++++++++--------
Hyena.Gui/Hyena.Widgets/SegmentedBar.cs | 23 +++++----
Hyena.Gui/Hyena.Widgets/TextViewEditable.cs | 4 +-
Hyena.Gui/Hyena.Widgets/WrapLabel.cs | 12 +++---
37 files changed, 300 insertions(+), 259 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Data.Gui/CellContext.cs b/Hyena.Gui/Hyena.Data.Gui/CellContext.cs
index e300c20..d22c25f 100644
--- a/Hyena.Gui/Hyena.Data.Gui/CellContext.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/CellContext.cs
@@ -44,7 +44,7 @@ namespace Hyena.Data.Gui
public Pango.FontDescription FontDescription { get; set; }
public Gtk.Widget Widget { get; set; }
public Gtk.StateType State { get; set; }
- public Gdk.Drawable Drawable { get; set; }
+ public Gdk.Window Drawable { get; set; }
public Theme Theme { get; set; }
public Gdk.Rectangle Area { get; set; }
public Gdk.Rectangle Clip { get; set; }
diff --git a/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs b/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs
index 28b2161..1887b06 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs
@@ -59,9 +59,9 @@ namespace Hyena.Data.Gui
context.State = StateType.Prelight;
}
- Style.PaintCheck (context.Widget.Style, context.Drawable, context.State,
+ Style.PaintCheck (context.Widget.Style, context.Context, context.State,
Value ? ShadowType.In : ShadowType.Out,
- context.Clip, context.Widget, "cellcheck", x, y, Size, Size);
+ context.Widget, "cellcheck", x, y, Size, Size);
}
private object last_pressed_bound;
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
index e6e9869..d31eba4 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
@@ -80,7 +80,7 @@ namespace Hyena.Data.Gui
return rectangle;
int origin_x, origin_y;
- GdkWindow.GetPosition (out origin_x, out origin_y);
+ Window.GetPosition (out origin_x, out origin_y);
rectangle.X += origin_x;
rectangle.Y += origin_y;
@@ -109,7 +109,7 @@ namespace Hyena.Data.Gui
return rectangle;
int origin_x, origin_y;
- GdkWindow.GetPosition (out origin_x, out origin_y);
+ Window.GetPosition (out origin_x, out origin_y);
rectangle.X += origin_x;
rectangle.Y += origin_y;
@@ -122,7 +122,7 @@ namespace Hyena.Data.Gui
int origin_x = 0;
int origin_y = 0;
if (coord_type == Atk.CoordType.Screen)
- GdkWindow.GetPosition (out origin_x, out origin_y);
+ Window.GetPosition (out origin_x, out origin_y);
x = x - ListAllocation.X - origin_x;
y = y - ListAllocation.Y - origin_y;
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
index 0706563..bddb01d 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
@@ -353,7 +353,7 @@ namespace Hyena.Data.Gui
menu.ShowAll ();
menu.Popup (null, null, delegate (Menu popup, out int pos_x, out int pos_y, out bool push_in) {
int win_x, win_y;
- GdkWindow.GetOrigin (out win_x, out win_y);
+ Window.GetOrigin (out win_x, out win_y);
pos_x = win_x + x;
pos_y = win_y + y;
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
index 31946eb..6109459 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
@@ -40,7 +40,7 @@ using Selection = Hyena.Collections.Selection;
namespace Hyena.Data.Gui
{
- public partial class ListView<T> : ListViewBase
+ public partial class ListView<T> : ListViewBase, ScrollableImplementor
{
private enum KeyDirection {
Press,
@@ -706,7 +706,7 @@ namespace Hyena.Data.Gui
if (resizing_column_index >= 0) {
pressed_column_index = -1;
resizing_column_index = -1;
- GdkWindow.Cursor = null;
+ Window.Cursor = null;
return true;
}
@@ -801,7 +801,7 @@ namespace Hyena.Data.Gui
return true;
}
- GdkWindow.Cursor = header_interaction_alloc.Contains ((int)evnt.X, (int)evnt.Y) &&
+ Window.Cursor = header_interaction_alloc.Contains ((int)evnt.X, (int)evnt.Y) &&
(resizing_column_index >= 0 || GetColumnForResizeHandle (x) != null)
? resize_x_cursor
: null;
@@ -827,7 +827,7 @@ namespace Hyena.Data.Gui
OnDragScroll (OnDragHScrollTimeout, header_interaction_alloc.Width * 0.1, header_interaction_alloc.Width, x);
- GdkWindow.Cursor = drag_cursor;
+ Window.Cursor = drag_cursor;
Column swap_column = GetColumnAt (x);
@@ -871,7 +871,7 @@ namespace Hyena.Data.Gui
protected override bool OnLeaveNotifyEvent (Gdk.EventCrossing evnt)
{
if (evnt.Mode == Gdk.CrossingMode.Normal) {
- GdkWindow.Cursor = null;
+ Window.Cursor = null;
if (LayoutChildHandlesEvent (evnt, false)) {
return true;
}
@@ -919,7 +919,7 @@ namespace Hyena.Data.Gui
if (pressed_column_index >= 0 && pressed_column_is_dragging) {
pressed_column_is_dragging = false;
pressed_column_index = -1;
- GdkWindow.Cursor = null;
+ Window.Cursor = null;
QueueDirtyRegion ();
return true;
}
@@ -1088,7 +1088,7 @@ namespace Hyena.Data.Gui
}
}
- protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
+ /*protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
{
if (hadj == null || vadj == null) {
return;
@@ -1098,7 +1098,7 @@ namespace Hyena.Data.Gui
vadj.ValueChanged += OnVadjustmentChanged;
UpdateAdjustments (hadj, vadj);
- }
+ }*/
#endregion
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
index 78bf70c..1bac1eb 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
@@ -49,8 +49,8 @@ namespace Hyena.Data.Gui
public override Pango.Layout PangoLayout {
get {
- if (pango_layout == null && GdkWindow != null && IsRealized) {
- using (var cr = Gdk.CairoHelper.Create (GdkWindow)) {
+ if (pango_layout == null && Window != null && IsRealized) {
+ using (var cr = Gdk.CairoHelper.Create (Window)) {
pango_layout = CairoExtensions.CreateLayout (this, cr);
cell_context.FontDescription = pango_layout.FontDescription;
cell_context.Layout = pango_layout;
@@ -100,7 +100,7 @@ namespace Hyena.Data.Gui
theme = Hyena.Gui.Theming.ThemeEngine.CreateTheme (this);
// Save the drawable so we can reuse it
- Gdk.Drawable drawable = cell_context != null ? cell_context.Drawable : null;
+ var drawable = cell_context != null ? cell_context.Drawable : null;
if (pango_layout != null) {
cell_context.FontDescription.Dispose ();
@@ -129,18 +129,21 @@ namespace Hyena.Data.Gui
}
}
- protected override bool OnExposeEvent (EventExpose evnt)
+ protected override bool OnDamageEvent (Gdk.EventExpose evnt)
{
if (DoNotRenderNullModel && Model == null) {
return true;
}
var damage = new Rectangle ();
- foreach (Rectangle rect in evnt.Region.GetRectangles ()) {
+ for (int i = 0; i < evnt.Region.NumRectangles; i++) {
+ var rect_int = evnt.Region.GetRectangle (i);
+ var rect =
+ new Rectangle (rect_int.X, rect_int.Y, rect_int.Width, rect_int.Height);
damage = damage.Union (rect);
}
- cairo_context = CairoHelper.Create (evnt.Window);
+ cairo_context = Gdk.CairoHelper.Create (evnt.Window);
cell_context.Layout = PangoLayout;
cell_context.Context = cairo_context;
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs
index 898e73f..58b570a 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs
@@ -53,10 +53,11 @@ namespace Hyena.Data.Gui
protected override void OnRealized ()
{
- WidgetFlags |= WidgetFlags.Realized | WidgetFlags.NoWindow;
+ IsRealized = true;
+ HasWindow = false;
- GdkWindow = Parent.GdkWindow;
- cell_context.Drawable = GdkWindow;
+ Window = Parent.Window;
+ cell_context.Drawable = Window;
WindowAttr attributes = new WindowAttr ();
attributes.WindowType = Gdk.WindowType.Child;
@@ -64,7 +65,7 @@ namespace Hyena.Data.Gui
attributes.Y = Allocation.Y;
attributes.Width = Allocation.Width;
attributes.Height = Allocation.Height;
- attributes.Wclass = WindowClass.InputOnly;
+ attributes.Wclass = WindowWindowClass.Only;
attributes.EventMask = (int)(
EventMask.PointerMotionMask |
EventMask.KeyPressMask |
@@ -77,7 +78,7 @@ namespace Hyena.Data.Gui
WindowAttributesType attributes_mask =
WindowAttributesType.X | WindowAttributesType.Y | WindowAttributesType.Wmclass;
- event_window = new Gdk.Window (GdkWindow, attributes, attributes_mask);
+ event_window = new Gdk.Window (Window, attributes, attributes_mask);
event_window.UserData = Handle;
OnDragSourceSet ();
@@ -88,7 +89,7 @@ namespace Hyena.Data.Gui
protected override void OnUnrealized ()
{
- WidgetFlags &= ~WidgetFlags.Realized;
+ IsRealized = false;
event_window.UserData = IntPtr.Zero;
Hyena.Gui.GtkWorkarounds.WindowDestroy (event_window);
@@ -99,13 +100,13 @@ namespace Hyena.Data.Gui
protected override void OnMapped ()
{
- WidgetFlags |= WidgetFlags.Mapped;
+ IsMapped = true;
event_window.Show ();
}
protected override void OnUnmapped ()
{
- WidgetFlags &= ~WidgetFlags.Mapped;
+ IsMapped = false;
event_window.Hide ();
}
@@ -141,14 +142,29 @@ namespace Hyena.Data.Gui
header_width = header_interaction_alloc.Width;
}
- protected override void OnSizeRequested (ref Requisition requisition)
+ protected override void OnGetPreferredHeight (out int minimum_height, out int natural_height)
{
+ var requisition = SizeRequested ();
+ minimum_height = natural_height = requisition.Height;
+ }
+
+ protected override void OnGetPreferredWidth (out int minimum_width, out int natural_width)
+ {
+ var requisition = SizeRequested ();
+ minimum_width = natural_width = requisition.Width;
+ }
+
+ protected Requisition SizeRequested ()
+ {
+ var requisition = new Requisition ();
+
// TODO give the minimum height of the header
if (Theme == null) {
- return;
+ return requisition;
}
requisition.Width = Theme.TotalBorderWidth * 2;
requisition.Height = HeaderHeight + Theme.TotalBorderWidth * 2;
+ return requisition;
}
protected override void OnSizeAllocated (Rectangle allocation)
diff --git a/Hyena.Gui/Hyena.Gui.Canvas/CanvasHost.cs b/Hyena.Gui/Hyena.Gui.Canvas/CanvasHost.cs
index a0a4cea..2627fc9 100644
--- a/Hyena.Gui/Hyena.Gui.Canvas/CanvasHost.cs
+++ b/Hyena.Gui/Hyena.Gui.Canvas/CanvasHost.cs
@@ -44,7 +44,7 @@ namespace Hyena.Gui.Canvas
public CanvasHost ()
{
- WidgetFlags |= WidgetFlags.NoWindow;
+ HasWindow = false;
manager = new CanvasManager (this);
}
@@ -62,7 +62,7 @@ namespace Hyena.Gui.Canvas
attributes.Y = Allocation.Y;
attributes.Width = Allocation.Width;
attributes.Height = Allocation.Height;
- attributes.Wclass = WindowClass.InputOnly;
+ attributes.Wclass = WindowWindowClass.Only;
attributes.EventMask = (int)(
EventMask.PointerMotionMask |
EventMask.ButtonPressMask |
@@ -74,7 +74,7 @@ namespace Hyena.Gui.Canvas
WindowAttributesType attributes_mask =
WindowAttributesType.X | WindowAttributesType.Y | WindowAttributesType.Wmclass;
- event_window = new Gdk.Window (GdkWindow, attributes, attributes_mask);
+ event_window = new Gdk.Window (Window, attributes, attributes_mask);
event_window.UserData = Handle;
AllocateChild ();
@@ -83,7 +83,7 @@ namespace Hyena.Gui.Canvas
protected override void OnUnrealized ()
{
- WidgetFlags ^= WidgetFlags.Realized;
+ IsRealized = false;
event_window.UserData = IntPtr.Zero;
Hyena.Gui.GtkWorkarounds.WindowDestroy (event_window);
@@ -114,8 +114,21 @@ namespace Hyena.Gui.Canvas
}
}
- protected override void OnSizeRequested (ref Gtk.Requisition requisition)
+ protected override void OnGetPreferredHeight (out int minimum_height, out int natural_height)
{
+ var requisition = SizeRequested ();
+ minimum_height = natural_height = requisition.Height;
+ }
+
+ protected override void OnGetPreferredWidth (out int minimum_width, out int natural_width)
+ {
+ var requisition = SizeRequested ();
+ minimum_width = natural_width = requisition.Width;
+ }
+
+ protected Requisition SizeRequested ()
+ {
+ var requisition = new Requisition ();
if (canvas_child != null) {
Size size = canvas_child.Measure (Size.Empty);
@@ -127,11 +140,12 @@ namespace Hyena.Gui.Canvas
requisition.Height = (int)Math.Ceiling (size.Height);
}
}
+ return requisition;
}
private Random rand;
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnDamageEvent (Gdk.EventExpose evnt)
{
if (canvas_child == null || !canvas_child.Visible || !Visible || !IsMapped) {
return true;
@@ -140,7 +154,8 @@ namespace Hyena.Gui.Canvas
Cairo.Context cr = Gdk.CairoHelper.Create (evnt.Window);
context.Context = cr;
- foreach (Gdk.Rectangle damage in evnt.Region.GetRectangles ()) {
+ for (int i = 0; i < evnt.Region.NumRectangles; i++) {
+ var damage = evnt.Region.GetRectangle (i);
cr.Rectangle (damage.X, damage.Y, damage.Width, damage.Height);
cr.Clip ();
@@ -309,11 +324,11 @@ namespace Hyena.Gui.Canvas
public Pango.Layout PangoLayout {
get {
if (layout == null) {
- if (GdkWindow == null || !IsRealized) {
+ if (Window == null || !IsRealized) {
return null;
}
- using (var cr = Gdk.CairoHelper.Create (GdkWindow)) {
+ using (var cr = Gdk.CairoHelper.Create (Window)) {
layout = CairoExtensions.CreateLayout (this, cr);
FontDescription = layout.FontDescription;
}
diff --git a/Hyena.Gui/Hyena.Gui.Dialogs/ExceptionDialog.cs b/Hyena.Gui/Hyena.Gui.Dialogs/ExceptionDialog.cs
index 7150a4f..143b0b8 100644
--- a/Hyena.Gui/Hyena.Gui.Dialogs/ExceptionDialog.cs
+++ b/Hyena.Gui/Hyena.Gui.Dialogs/ExceptionDialog.cs
@@ -46,14 +46,13 @@ namespace Hyena.Gui.Dialogs
{
debugInfo = BuildExceptionMessage(e);
- HasSeparator = false;
BorderWidth = 5;
Resizable = false;
//Translators: {0} is substituted with the application name
Title = String.Format(Catalog.GetString("{0} Encountered a Fatal Error"),
ApplicationContext.ApplicationName);
- VBox.Spacing = 12;
+ ContentArea.Spacing = 12;
ActionArea.Layout = ButtonBoxStyle.End;
accel_group = new AccelGroup();
@@ -61,7 +60,7 @@ namespace Hyena.Gui.Dialogs
HBox hbox = new HBox(false, 12);
hbox.BorderWidth = 5;
- VBox.PackStart(hbox, false, false, 0);
+ ContentArea.PackStart(hbox, false, false, 0);
Image image = new Image(Stock.DialogError, IconSize.Dialog);
image.Yalign = 0.0f;
diff --git a/Hyena.Gui/Hyena.Gui.Dialogs/VersionInformationDialog.cs b/Hyena.Gui/Hyena.Gui.Dialogs/VersionInformationDialog.cs
index 484dc0a..4c2c2c1 100644
--- a/Hyena.Gui/Hyena.Gui.Dialogs/VersionInformationDialog.cs
+++ b/Hyena.Gui/Hyena.Gui.Dialogs/VersionInformationDialog.cs
@@ -74,15 +74,15 @@ namespace Hyena.Gui.Dialogs
scroll.ShadowType = ShadowType.In;
scroll.SetSizeRequest(420, 200);
- VBox.PackStart(scroll, true, true, 0);
- VBox.Spacing = 5;
+ ContentArea.PackStart(scroll, true, true, 0);
+ ContentArea.Spacing = 5;
path_label = new Label();
path_label.Ellipsize = Pango.EllipsizeMode.End;
path_label.Hide();
path_label.Xalign = 0.0f;
path_label.Yalign = 1.0f;
- VBox.PackStart(path_label, false, true, 0);
+ ContentArea.PackStart(path_label, false, true, 0);
scroll.ShowAll();
}
diff --git a/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs b/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
index 32504d4..0d37799 100644
--- a/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
+++ b/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
@@ -48,14 +48,6 @@ namespace Hyena.Gui.Theming
return CairoExtensions.AlphaBlend (text_color, background_color, 0.5);
}
- public static Gdk.Color GetGdkTextMidColor (Widget widget)
- {
- Cairo.Color color = GetCairoTextMidColor (widget);
- Gdk.Color gdk_color = new Gdk.Color ((byte)(color.R * 255), (byte)(color.G * 255), (byte)(color.B * 255));
- Gdk.Colormap.System.AllocColor (ref gdk_color, true, true);
- return gdk_color;
- }
-
protected override void OnColorsRefreshed ()
{
base.OnColorsRefreshed ();
diff --git a/Hyena.Gui/Hyena.Gui.Theming/ThemeTestModule.cs b/Hyena.Gui/Hyena.Gui.Theming/ThemeTestModule.cs
index dbf0b18..9ad741f 100644
--- a/Hyena.Gui/Hyena.Gui.Theming/ThemeTestModule.cs
+++ b/Hyena.Gui/Hyena.Gui.Theming/ThemeTestModule.cs
@@ -80,22 +80,17 @@ namespace Hyena.Gui.Theming
theme.Context.Radius = 10;
}
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnDrawn (Cairo.Context cr)
{
- Cairo.Context cr = null;
- try {
- var alloc = new Gdk.Rectangle () {
- X = Allocation.X,
- Y = Allocation.Y,
- Width = Allocation.Width,
- Height = Allocation.Height
- };
- cr = Gdk.CairoHelper.Create (evnt.Window);
- theme.DrawListBackground (cr, alloc, true);
- theme.DrawFrameBorder (cr, alloc);
- } finally {
- CairoExtensions.DisposeContext (cr);
- }
+ var alloc = new Gdk.Rectangle () {
+ X = Allocation.X,
+ Y = Allocation.Y,
+ Width = Allocation.Width,
+ Height = Allocation.Height
+ };
+ CairoHelper.TransformToWindow (cr, this, Window);
+ theme.DrawListBackground (cr, alloc, true);
+ theme.DrawFrameBorder (cr, alloc);
return true;
}
}
diff --git a/Hyena.Gui/Hyena.Gui/CairoExtensions.cs b/Hyena.Gui/Hyena.Gui/CairoExtensions.cs
index 80cc29d..3286ab5 100644
--- a/Hyena.Gui/Hyena.Gui/CairoExtensions.cs
+++ b/Hyena.Gui/Hyena.Gui/CairoExtensions.cs
@@ -69,7 +69,8 @@ namespace Hyena.Gui
{
Surface surface = cr.Target.CreateSimilar (cr.Target.Content, pixbuf.Width, pixbuf.Height);
Cairo.Context surface_cr = new Context (surface);
- Gdk.CairoHelper.SetSourcePixbuf (surface_cr, pixbuf, 0, 0);
+ //Gdk.CairoHelper.SetSourcePixbuf (surface_cr, pixbuf, 0.0, 0.0);
+ Gdk.CairoHelper.SetSourcePixbuf (surface_cr, pixbuf, 0.0, 0.0);
surface_cr.Paint ();
((IDisposable)surface_cr).Dispose ();
return surface;
diff --git a/Hyena.Gui/Hyena.Gui/CompositeUtils.cs b/Hyena.Gui/Hyena.Gui/CompositeUtils.cs
index 4d93bb8..d757813 100644
--- a/Hyena.Gui/Hyena.Gui/CompositeUtils.cs
+++ b/Hyena.Gui/Hyena.Gui/CompositeUtils.cs
@@ -45,35 +45,6 @@ namespace Hyena.Gui
[DllImport ("libgdk-win32-2.0-0.dll")]
private static extern IntPtr gdk_screen_get_rgba_colormap (IntPtr screen);
- public static Colormap GetRgbaColormap (Screen screen)
- {
- try {
- IntPtr raw_ret = gdk_screen_get_rgba_colormap (screen.Handle);
- Gdk.Colormap ret = GLib.Object.GetObject(raw_ret) as Gdk.Colormap;
- return ret;
- } catch {
- Gdk.Visual visual = Gdk.Visual.GetBestWithDepth (32);
- if (visual != null) {
- Gdk.Colormap cmap = new Gdk.Colormap (visual, false);
- return cmap;
- }
- }
-
- return null;
- }
-
- public static bool SetRgbaColormap (Widget w)
- {
- Gdk.Colormap cmap = GetRgbaColormap (w.Screen);
-
- if (cmap != null) {
- w.Colormap = cmap;
- return true;
- }
-
- return false;
- }
-
public static Visual GetRgbaVisual (Screen screen)
{
try {
@@ -144,7 +115,7 @@ namespace Hyena.Gui
public static void SetWinOpacity (Gtk.Window win, double opacity)
{
- CompositeUtils.ChangeProperty (win.GdkWindow,
+ CompositeUtils.ChangeProperty (win.Window,
Atom.Intern ("_NET_WM_WINDOW_OPACITY", false),
Atom.Intern ("CARDINAL", false),
PropMode.Replace,
@@ -152,10 +123,10 @@ namespace Hyena.Gui
);
}
- public static void InputShapeCombineMask (Widget w, Pixmap shape_mask, int offset_x, int offset_y)
+ /*public static void InputShapeCombineMask (Widget w, Pixmap shape_mask, int offset_x, int offset_y)
{
gtk_widget_input_shape_combine_mask (w.Handle, shape_mask == null ? IntPtr.Zero : shape_mask.Handle,
offset_x, offset_y);
- }
+ }*/
}
}
diff --git a/Hyena.Gui/Hyena.Gui/EditableUndoAdapter.cs b/Hyena.Gui/Hyena.Gui/EditableUndoAdapter.cs
index fdd171d..7b4d4a8 100644
--- a/Hyena.Gui/Hyena.Gui/EditableUndoAdapter.cs
+++ b/Hyena.Gui/Hyena.Gui/EditableUndoAdapter.cs
@@ -109,7 +109,7 @@ namespace Hyena.Gui
[GLib.ConnectBefore]
private void OnTextInserted (object o, TextInsertedArgs args)
{
- undo_manager.AddUndoAction (new EditableInsertAction (editable, args.Position, args.Text, args.Length));
+ undo_manager.AddUndoAction (new EditableInsertAction (editable, args.Position, args.NewText, args.NewTextLength));
}
private void OnPopulatePopup (object o, PopulatePopupArgs args)
diff --git a/Hyena.Gui/Hyena.Gui/GtkUtilities.cs b/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
index 5aa6fe0..b50d1bb 100644
--- a/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
+++ b/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
@@ -116,7 +116,6 @@ namespace Hyena.Gui
double blB = mB * blendRatio;
Gdk.Color color = new Gdk.Color ((byte)blR, (byte)blG, (byte)blB);
- Gdk.Colormap.System.AllocColor (ref color, true, true);
return color;
}
@@ -170,11 +169,13 @@ namespace Hyena.Gui
}
}
+ [Obsolete ("Use Gtk.Global.ShowUri() from gtk# 3.x")]
public static bool ShowUri (string uri)
{
return ShowUri (null, uri);
}
+ [Obsolete ("Use Gtk.Global.ShowUri() from gtk# 3.x")]
public static bool ShowUri (Gdk.Screen screen, string uri)
{
return ShowUri (screen, uri, Gtk.Global.CurrentEventTime);
@@ -183,20 +184,10 @@ namespace Hyena.Gui
[System.Runtime.InteropServices.DllImport ("libgtk-win32-2.0-0.dll")]
private static extern unsafe bool gtk_show_uri (IntPtr screen, IntPtr uri, uint timestamp, out IntPtr error);
+ [Obsolete ("Use Gtk.Global.ShowUri() from gtk# 3.x")]
public static bool ShowUri (Gdk.Screen screen, string uri, uint timestamp)
{
- var native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
- var native_error = IntPtr.Zero;
-
- try {
- return gtk_show_uri (screen == null ? IntPtr.Zero : screen.Handle,
- native_uri, timestamp, out native_error);
- } finally {
- GLib.Marshaller.Free (native_uri);
- if (native_error != IntPtr.Zero) {
- throw new GLib.GException (native_error);
- }
- }
+ return Gtk.Global.ShowUri (screen, uri, timestamp);
}
}
}
diff --git a/Hyena.Gui/Hyena.Gui/HyenaActionGroup.cs b/Hyena.Gui/Hyena.Gui/HyenaActionGroup.cs
index c650984..c5c299d 100644
--- a/Hyena.Gui/Hyena.Gui/HyenaActionGroup.cs
+++ b/Hyena.Gui/Hyena.Gui/HyenaActionGroup.cs
@@ -75,7 +75,7 @@ namespace Hyena.Gui
}
}
- public override void Dispose ()
+ protected override void Dispose (bool disposing)
{
Hyena.ThreadAssist.ProxyToMain (delegate {
UnRegister ();
@@ -87,7 +87,7 @@ namespace Hyena.Gui
}
ui_merge_ids.Clear ();
- base.Dispose ();
+ base.Dispose (disposing);
});
}
diff --git a/Hyena.Gui/Hyena.Gui/ShadingTestWindow.cs b/Hyena.Gui/Hyena.Gui/ShadingTestWindow.cs
index d82d67b..1cdf63b 100644
--- a/Hyena.Gui/Hyena.Gui/ShadingTestWindow.cs
+++ b/Hyena.Gui/Hyena.Gui/ShadingTestWindow.cs
@@ -40,9 +40,9 @@ namespace Hyena.Gui
SetSizeRequest (512, 512);
}
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnDrawn (Cairo.Context cr)
{
- Cairo.Context cr = Gdk.CairoHelper.Create (evnt.Window);
+ CairoHelper.TransformToWindow (cr, this, Window);
double step_width = Allocation.Width / (double)steps;
double step_height = Allocation.Height / (double)steps;
@@ -74,7 +74,6 @@ namespace Hyena.Gui
}
}
- CairoExtensions.DisposeContext (cr);
return true;
}
diff --git a/Hyena.Gui/Hyena.Query.Gui/FileSizeQueryValueEntry.cs b/Hyena.Gui/Hyena.Query.Gui/FileSizeQueryValueEntry.cs
index ba9ea15..2f11b00 100644
--- a/Hyena.Gui/Hyena.Query.Gui/FileSizeQueryValueEntry.cs
+++ b/Hyena.Gui/Hyena.Query.Gui/FileSizeQueryValueEntry.cs
@@ -38,7 +38,7 @@ namespace Hyena.Query.Gui
public class FileSizeQueryValueEntry : QueryValueEntry
{
protected SpinButton spin_button;
- protected ComboBox combo;
+ protected ComboBoxText combo;
protected FileSizeQueryValue query_value;
protected static readonly FileSizeFactor [] factors = new FileSizeFactor [] {
@@ -57,7 +57,7 @@ namespace Hyena.Query.Gui
spin_button.SetRange (0.0, Double.MaxValue);
Add (spin_button);
- combo = ComboBox.NewText ();
+ combo = new ComboBoxText ();
combo.AppendText (Catalog.GetString ("bytes"));
combo.AppendText (Catalog.GetString ("KB"));
combo.AppendText (Catalog.GetString ("MB"));
diff --git a/Hyena.Gui/Hyena.Query.Gui/QueryBox.cs b/Hyena.Gui/Hyena.Query.Gui/QueryBox.cs
index 0fe4562..649fb7f 100644
--- a/Hyena.Gui/Hyena.Query.Gui/QueryBox.cs
+++ b/Hyena.Gui/Hyena.Query.Gui/QueryBox.cs
@@ -52,7 +52,7 @@ namespace Hyena.Query.Gui
get { return limit_box; }
}
- private ComboBox terms_logic_combo;
+ private ComboBoxText terms_logic_combo;
private CheckButton terms_enabled_checkbox;
private Label terms_label;
private QueryFieldSet field_set;
@@ -107,7 +107,7 @@ namespace Hyena.Query.Gui
terms_enabled_checkbox.Toggled += OnMatchCheckBoxToggled;
header.PackStart (terms_enabled_checkbox, false, false, 0);
- terms_logic_combo = ComboBox.NewText ();
+ terms_logic_combo = new ComboBoxText ();
terms_logic_combo.AppendText (Catalog.GetString ("all"));
terms_logic_combo.AppendText (Catalog.GetString ("any"));
terms_logic_combo.Show ();
@@ -163,7 +163,7 @@ namespace Hyena.Query.Gui
}
} catch (ArgumentException) {
complex_query = true;
- matchesFrame.HideAll ();
+ matchesFrame.Hide ();
terms_entry.Text = value.ToUserQuery ();
terms_entry_box.ShowAll ();
}
diff --git a/Hyena.Gui/Hyena.Query.Gui/QueryLimitBox.cs b/Hyena.Gui/Hyena.Query.Gui/QueryLimitBox.cs
index 545b9e3..622fc03 100644
--- a/Hyena.Gui/Hyena.Query.Gui/QueryLimitBox.cs
+++ b/Hyena.Gui/Hyena.Query.Gui/QueryLimitBox.cs
@@ -42,8 +42,8 @@ namespace Hyena.Query.Gui
{
private CheckButton enabled_checkbox;
private SpinButton count_spin;
- private ComboBox limit_combo;
- private ComboBox order_combo;
+ private ComboBoxText limit_combo;
+ private ComboBoxText order_combo;
private QueryOrder [] orders;
private QueryLimit [] limits;
@@ -64,12 +64,12 @@ namespace Hyena.Query.Gui
count_spin.Value = 25;
count_spin.SetSizeRequest (60, -1);
- limit_combo = ComboBox.NewText ();
+ limit_combo = new ComboBoxText ();
foreach (QueryLimit limit in limits) {
limit_combo.AppendText (limit.Label);
}
- order_combo = ComboBox.NewText ();
+ order_combo = new ComboBoxText ();
order_combo.RowSeparatorFunc = IsRowSeparator;
foreach (QueryOrder order in orders) {
if (order == null) {
diff --git a/Hyena.Gui/Hyena.Query.Gui/QueryTermBox.cs b/Hyena.Gui/Hyena.Query.Gui/QueryTermBox.cs
index f5413d7..36ae5d7 100644
--- a/Hyena.Gui/Hyena.Query.Gui/QueryTermBox.cs
+++ b/Hyena.Gui/Hyena.Query.Gui/QueryTermBox.cs
@@ -54,13 +54,13 @@ namespace Hyena.Query.Gui
private QueryField [] sorted_fields;
- private ComboBox field_chooser;
- public ComboBox FieldChooser {
+ private ComboBoxText field_chooser;
+ public ComboBoxText FieldChooser {
get { return field_chooser; }
}
- private ComboBox op_chooser;
- public ComboBox OpChooser {
+ private ComboBoxText op_chooser;
+ public ComboBoxText OpChooser {
get { return op_chooser; }
}
@@ -82,10 +82,10 @@ namespace Hyena.Query.Gui
private void BuildInterface ()
{
- field_chooser = ComboBox.NewText ();
+ field_chooser = new ComboBoxText ();
field_chooser.Changed += HandleFieldChanged;
- op_chooser = ComboBox.NewText ();
+ op_chooser = new ComboBoxText ();
op_chooser.RowSeparatorFunc = IsRowSeparator;
op_chooser.Changed += HandleOperatorChanged;
@@ -156,9 +156,7 @@ namespace Hyena.Query.Gui
this.field = field;
// Remove old type's operators
- while (op_chooser.Model.IterNChildren () > 0) {
- op_chooser.RemoveText (0);
- }
+ op_chooser.RemoveAll ();
// Add new field's operators
int val_count = 0;
diff --git a/Hyena.Gui/Hyena.Query.Gui/TimeSpanQueryValueEntry.cs b/Hyena.Gui/Hyena.Query.Gui/TimeSpanQueryValueEntry.cs
index 0158ad1..469ddb0 100644
--- a/Hyena.Gui/Hyena.Query.Gui/TimeSpanQueryValueEntry.cs
+++ b/Hyena.Gui/Hyena.Query.Gui/TimeSpanQueryValueEntry.cs
@@ -38,7 +38,7 @@ namespace Hyena.Query.Gui
public class TimeSpanQueryValueEntry : QueryValueEntry
{
protected SpinButton spin_button;
- protected ComboBox combo;
+ protected ComboBoxText combo;
protected TimeSpanQueryValue query_value;
private int set_combo = 1;
@@ -55,7 +55,7 @@ namespace Hyena.Query.Gui
spin_button.SetRange (0.0, Double.MaxValue);
Add (spin_button);
- combo = ComboBox.NewText ();
+ combo = new ComboBoxText ();
combo.AppendText (Catalog.GetString ("seconds"));
combo.AppendText (Catalog.GetString ("minutes"));
combo.AppendText (Catalog.GetString ("hours"));
diff --git a/Hyena.Gui/Hyena.Widgets/AnimatedBox.cs b/Hyena.Gui/Hyena.Widgets/AnimatedBox.cs
index 4154570..2ac20a7 100644
--- a/Hyena.Gui/Hyena.Widgets/AnimatedBox.cs
+++ b/Hyena.Gui/Hyena.Widgets/AnimatedBox.cs
@@ -61,7 +61,7 @@ namespace Hyena.Widgets
protected AnimatedBox (bool horizontal)
{
- WidgetFlags |= WidgetFlags.NoWindow;
+ HasWindow = false;
this.horizontal = horizontal;
stage.ActorStep += OnActorStep;
border_stage.Iteration += OnBorderIteration;
@@ -184,8 +184,22 @@ namespace Hyena.Widgets
PackStart (widget, duration, easing, blocking);
}
- protected override void OnSizeRequested (ref Requisition requisition)
+
+ protected override void OnGetPreferredHeight (out int minimum_height, out int natural_height)
+ {
+ var requisition = SizeRequested ();
+ minimum_height = natural_height = requisition.Height;
+ }
+
+ protected override void OnGetPreferredWidth (out int minimum_width, out int natural_width)
+ {
+ var requisition = SizeRequested ();
+ minimum_width = natural_width = requisition.Width;
+ }
+
+ protected Requisition SizeRequested ()
{
+ var requisition = new Requisition ();
int width = 0;
int height = 0;
@@ -208,6 +222,7 @@ namespace Hyena.Widgets
requisition.Width = width;
requisition.Height = height;
+ return requisition;
}
protected override void OnSizeAllocated (Rectangle allocation)
@@ -546,4 +561,4 @@ namespace Hyena.Widgets
#endregion
}
-}
\ No newline at end of file
+}
diff --git a/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs b/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs
index a77eadf..8b628c7 100644
--- a/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs
+++ b/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs
@@ -62,7 +62,7 @@ namespace Hyena.Widgets
private readonly bool horizontal;
private double percent;
private Rectangle widget_alloc;
- private Pixmap canvas;
+ //private Pixmap canvas;
public AnimatedWidget (Widget widget, uint duration, Easing easing, Blocking blocking, bool horizontal)
{
@@ -92,17 +92,17 @@ namespace Hyena.Widgets
private void OnWidgetDestroyed (object sender, EventArgs args)
{
- if (!IsRealized) {
+/* if (!IsRealized) {
return;
}
- canvas = new Pixmap (GdkWindow, widget_alloc.Width, widget_alloc.Height);
- canvas.DrawDrawable (Style.BackgroundGC (State), GdkWindow,
+ canvas = new Pixmap (Window, widget_alloc.Width, widget_alloc.Height);
+ canvas.DrawDrawable (Style.BackgroundGC (State), Window,
widget_alloc.X, widget_alloc.Y, 0, 0, widget_alloc.Width, widget_alloc.Height);
if (AnimationState != AnimationState.Going) {
WidgetDestroyed (this, args);
- }
+ }*/
}
#region Overrides
@@ -117,21 +117,34 @@ namespace Hyena.Widgets
protected override void OnRealized ()
{
- WidgetFlags |= WidgetFlags.Realized;
+ IsRealized = true;
Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
attributes.WindowType = Gdk.WindowType.Child;
- attributes.Wclass = Gdk.WindowClass.InputOutput;
+ attributes.Wclass = Gdk.WindowWindowClass.Output;
attributes.EventMask = (int)Gdk.EventMask.ExposureMask;
- GdkWindow = new Gdk.Window (Parent.GdkWindow, attributes, 0);
- GdkWindow.UserData = Handle;
- GdkWindow.Background = Style.Background (State);
- Style.Attach (GdkWindow);
+ Window = new Gdk.Window (Parent.Window, attributes, 0);
+ Window.UserData = Handle;
+ Window.Background = Style.Background (State);
+ Style.Attach (Window);
+ }
+
+ protected override void OnGetPreferredHeight (out int minimum_height, out int natural_height)
+ {
+ var requisition = SizeRequested ();
+ minimum_height = natural_height = requisition.Height;
+ }
+
+ protected override void OnGetPreferredWidth (out int minimum_width, out int natural_width)
+ {
+ var requisition = SizeRequested ();
+ minimum_width = natural_width = requisition.Width;
}
- protected override void OnSizeRequested (ref Requisition requisition)
+ protected Requisition SizeRequested ()
{
+ var requisition = new Requisition ();
if (Widget != null) {
Requisition req = Widget.SizeRequest ();
widget_alloc.Width = req.Width;
@@ -148,6 +161,7 @@ namespace Hyena.Widgets
requisition.Width = Width;
requisition.Height = Height;
+ return requisition;
}
protected override void OnSizeAllocated (Rectangle allocation)
@@ -174,14 +188,14 @@ namespace Hyena.Widgets
}
}
- protected override bool OnExposeEvent (EventExpose evnt)
+ protected override bool OnDrawn (Cairo.Context cr)
{
- if (canvas != null) {
- GdkWindow.DrawDrawable (Style.BackgroundGC (State), canvas,
+/* if (canvas != null) {
+ Window.DrawDrawable (Style.BackgroundGC (State), canvas,
0, 0, widget_alloc.X, widget_alloc.Y, widget_alloc.Width, widget_alloc.Height);
return true;
- } else {
- return base.OnExposeEvent (evnt);
+ } else*/ {
+ return base.OnDrawn (cr);
}
}
diff --git a/Hyena.Gui/Hyena.Widgets/ComplexMenuItem.cs b/Hyena.Gui/Hyena.Widgets/ComplexMenuItem.cs
index 5d3c9c0..b961f0b 100644
--- a/Hyena.Gui/Hyena.Widgets/ComplexMenuItem.cs
+++ b/Hyena.Gui/Hyena.Widgets/ComplexMenuItem.cs
@@ -61,11 +61,11 @@ namespace Hyena.Widgets
protected void ConnectChildExpose(Widget widget)
{
- widget.ExposeEvent += OnChildExposeEvent;
+ widget.Drawn += OnDrawn;
}
[GLib.ConnectBefore]
- private void OnChildExposeEvent(object o, ExposeEventArgs args)
+ private void OnDrawn(object o, DrawnArgs args)
{
// NOTE: This is a little insane, but it allows packing of EventBox based widgets
// into a GtkMenuItem without breaking the theme (leaving an unstyled void in the item).
@@ -82,12 +82,19 @@ namespace Hyena.Widgets
height = Allocation.Height;
ShadowType shadow_type = (ShadowType)StyleGetProperty("selected-shadow-type");
- Gtk.Style.PaintBox(Style, widget.GdkWindow, StateType.Prelight, shadow_type,
- args.Event.Area, widget, "menuitem", x, y, width, height);
+ Gtk.Style.PaintBox(Style, args.Cr, StateType.Prelight, shadow_type,
+ widget, "menuitem", x, y, width, height);
} else {
+
+ args.Cr.Save ();
+
+ var color = Parent.Style.Background (StateType.Normal);
// Fill only the visible area in solid color, to be most efficient
- widget.GdkWindow.DrawRectangle(Parent.Style.BackgroundGC(StateType.Normal),
- true, 0, 0, widget.Allocation.Width, widget.Allocation.Height);
+ args.Cr.SetSourceRGB (color.Red, color.Green, color.Blue);
+ args.Cr.Rectangle (0, 0, widget.Allocation.Width, widget.Allocation.Height);
+ args.Cr.Fill ();
+
+ args.Cr.Restore ();
// FIXME: The above should not be necessary, but Clearlooks-based themes apparently
// don't provide any style for the menu background so we have to fill it first with
@@ -100,8 +107,8 @@ namespace Hyena.Widgets
width = Parent.Allocation.Width;
height = Parent.Allocation.Height;
- Gtk.Style.PaintBox(Style, widget.GdkWindow, StateType.Normal, ShadowType.Out,
- args.Event.Area, widget, "menu", x, y, width, height);
+ Gtk.Style.PaintBox(Style, args.Cr, StateType.Normal, ShadowType.Out,
+ widget, "menu", x, y, width, height);
}
}
diff --git a/Hyena.Gui/Hyena.Widgets/EntryPopup.cs b/Hyena.Gui/Hyena.Widgets/EntryPopup.cs
index e8da7fb..dc44d63 100644
--- a/Hyena.Gui/Hyena.Widgets/EntryPopup.cs
+++ b/Hyena.Gui/Hyena.Widgets/EntryPopup.cs
@@ -54,7 +54,7 @@ namespace Hyena.Widgets
Modal = true;
Frame frame = new Frame ();
- frame.Shadow = ShadowType.EtchedIn;
+ frame.ShadowType = ShadowType.EtchedIn;
Add (frame);
hbox = new HBox () { Spacing = 6 };
@@ -89,7 +89,7 @@ namespace Hyena.Widgets
text_entry.KeyPressEvent += (o, a) => OnKeyPressed (a);
text_entry.Changed += (o, a) => {
- if (GdkWindow.IsVisible) {
+ if (Window.IsVisible) {
OnChanged (a);
}
};
@@ -132,10 +132,10 @@ namespace Hyena.Widgets
set { reset_when_hiding = value; }
}
- public override void Dispose ()
+ protected override void Dispose (bool disposing)
{
text_entry.Dispose ();
- base.Dispose ();
+ base.Dispose (disposing);
}
public new void GrabFocus ()
@@ -157,7 +157,8 @@ namespace Hyena.Widgets
Gtk.Requisition popup_req;
widget_window.GetOrigin (out widget_x, out widget_y);
- widget_window.GetSize (out widget_width, out widget_height);
+ widget_width = widget_window.Width;
+ widget_height = widget_window.Height;
popup_req = Requisition;
@@ -234,10 +235,10 @@ namespace Hyena.Widgets
return base.OnFocusOutEvent (evnt);
}
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnDrawn (Cairo.Context cr)
{
InitializeDelayedHide ();
- return base.OnExposeEvent (evnt);
+ return base.OnDrawn (cr);
}
protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt)
diff --git a/Hyena.Gui/Hyena.Widgets/GrabHandle.cs b/Hyena.Gui/Hyena.Widgets/GrabHandle.cs
index 82e1e90..e9a5c67 100644
--- a/Hyena.Gui/Hyena.Widgets/GrabHandle.cs
+++ b/Hyena.Gui/Hyena.Widgets/GrabHandle.cs
@@ -51,10 +51,10 @@ namespace Hyena.Widgets
EnterNotifyEvent += (o, a) => Inside = true;
LeaveNotifyEvent += (o, a) => Inside = false;
- da.ExposeEvent += (o, a) => {
+ da.Drawn += (o, a) => {
if (da.IsDrawable) {
- Gtk.Style.PaintHandle (da.Style, da.GdkWindow, da.State, ShadowType.In,
- a.Event.Area, this, "entry", 0, 0, da.Allocation.Width, da.Allocation.Height, Orientation);
+ Gtk.Style.PaintHandle (da.Style, a.Cr, da.State, ShadowType.In,
+ this, "entry", 0, 0, da.Allocation.Width, da.Allocation.Height, Orientation);
}
};
}
@@ -74,14 +74,14 @@ namespace Hyena.Widgets
private bool Inside {
set {
inside = value;
- GdkWindow.Cursor = dragging || inside ? resize_cursor : null;
+ Window.Cursor = dragging || inside ? resize_cursor : null;
}
}
private bool Dragging {
set {
dragging = value;
- GdkWindow.Cursor = dragging || inside ? resize_cursor : null;
+ Window.Cursor = dragging || inside ? resize_cursor : null;
}
}
diff --git a/Hyena.Gui/Hyena.Widgets/HigMessageDialog.cs b/Hyena.Gui/Hyena.Widgets/HigMessageDialog.cs
index abfa153..7fd977c 100644
--- a/Hyena.Gui/Hyena.Widgets/HigMessageDialog.cs
+++ b/Hyena.Gui/Hyena.Widgets/HigMessageDialog.cs
@@ -45,19 +45,18 @@ namespace Hyena.Widgets
string msg)
: base()
{
- HasSeparator = false;
BorderWidth = 5;
Resizable = false;
Title = "";
SkipTaskbarHint = true;
- VBox.Spacing = 12;
+ ContentArea.Spacing = 12;
ActionArea.Layout = Gtk.ButtonBoxStyle.End;
Gtk.HBox hbox = new Gtk.HBox (false, 12);
hbox.BorderWidth = 5;
hbox.Show ();
- VBox.PackStart (hbox, false, false, 0);
+ ContentArea.PackStart (hbox, false, false, 0);
image = null;
diff --git a/Hyena.Gui/Hyena.Widgets/MenuButton.cs b/Hyena.Gui/Hyena.Widgets/MenuButton.cs
index c5f790d..622b114 100644
--- a/Hyena.Gui/Hyena.Widgets/MenuButton.cs
+++ b/Hyena.Gui/Hyena.Widgets/MenuButton.cs
@@ -54,7 +54,7 @@ namespace Hyena.Widgets
protected void Construct (Widget buttonWidget, Menu menu, bool showArrow)
{
- WidgetFlags |= WidgetFlags.NoWindow;
+ HasWindow = false;
button_widget = buttonWidget;
Menu = menu;
@@ -121,9 +121,16 @@ namespace Hyena.Widgets
set { alignment.Visible = value; }
}
- protected override void OnSizeRequested (ref Requisition requisition)
+ protected override void OnGetPreferredHeight (out int minimum_height, out int natural_height)
{
- requisition = size_widget.SizeRequest ();
+ var requisition = size_widget.SizeRequest ();
+ minimum_height = natural_height = requisition.Height;
+ }
+
+ protected override void OnGetPreferredWidth (out int minimum_width, out int natural_width)
+ {
+ var requisition = size_widget.SizeRequest ();
+ minimum_width = natural_width = requisition.Width;
}
protected override void OnSizeAllocated (Rectangle allocation)
@@ -155,10 +162,10 @@ namespace Hyena.Widgets
private void PositionMenu (Menu menu, out int x, out int y, out bool push_in)
{
Gtk.Requisition menu_req = menu.SizeRequest ();
- int monitor_num = Screen.GetMonitorAtWindow (GdkWindow);
+ int monitor_num = Screen.GetMonitorAtWindow (Window);
Gdk.Rectangle monitor = Screen.GetMonitorGeometry (monitor_num < 0 ? 0 : monitor_num);
- GdkWindow.GetOrigin (out x, out y);
+ Window.GetOrigin (out x, out y);
y += Allocation.Y;
x += Allocation.X + (Direction == TextDirection.Ltr
diff --git a/Hyena.Gui/Hyena.Widgets/MessageBar.cs b/Hyena.Gui/Hyena.Widgets/MessageBar.cs
index 9582664..c0f6d11 100644
--- a/Hyena.Gui/Hyena.Widgets/MessageBar.cs
+++ b/Hyena.Gui/Hyena.Widgets/MessageBar.cs
@@ -128,21 +128,15 @@ namespace Hyena.Widgets
QueueDraw ();
}
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnDrawn (Cairo.Context cr)
{
- if (!IsDrawable) {
- return false;
- }
-
- Cairo.Context cr = Gdk.CairoHelper.Create (evnt.Window);
+ cr.Save ();
+ CairoHelper.TransformToWindow (cr, this, Window);
- try {
- Gdk.Color color = Style.Background (StateType.Normal);
- theme.DrawFrame (cr, Allocation, CairoExtensions.GdkColorToCairoColor (color));
- return base.OnExposeEvent (evnt);
- } finally {
- CairoExtensions.DisposeContext (cr);
- }
+ Gdk.Color color = Style.Background (StateType.Normal);
+ theme.DrawFrame (cr, Allocation, CairoExtensions.GdkColorToCairoColor (color));
+ cr.Restore ();
+ return base.OnDrawn (cr);
}
private bool changing_style = false;
diff --git a/Hyena.Gui/Hyena.Widgets/PulsingButton.cs b/Hyena.Gui/Hyena.Widgets/PulsingButton.cs
index 4ee6b8b..953e0bf 100644
--- a/Hyena.Gui/Hyena.Widgets/PulsingButton.cs
+++ b/Hyena.Gui/Hyena.Widgets/PulsingButton.cs
@@ -82,13 +82,14 @@ namespace Hyena.Widgets
pulsator.Pulse += delegate { QueueDraw (); };
}
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnDrawn (Cairo.Context cr)
{
if (!pulsator.IsPulsing) {
- return base.OnExposeEvent (evnt);
+ return base.OnDrawn (cr);
}
- Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow);
+ cr.Save ();
+ CairoHelper.TransformToWindow (cr, this, Window);
double x = Allocation.X + Allocation.Width / 2;
double y = Allocation.Y + Allocation.Height / 2;
@@ -108,8 +109,8 @@ namespace Hyena.Widgets
cr.Fill ();
fill.Destroy ();
- CairoExtensions.DisposeContext (cr);
- return base.OnExposeEvent (evnt);
+ cr.Restore ();
+ return base.OnDrawn (cr);
}
public void StartPulsing ()
diff --git a/Hyena.Gui/Hyena.Widgets/RatingEntry.cs b/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
index 0d251ba..06cb3d7 100644
--- a/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
+++ b/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
@@ -56,7 +56,7 @@ namespace Hyena.Widgets
public RatingEntry () : this (0)
{
- WidgetFlags |= Gtk.WidgetFlags.NoWindow;
+ HasWindow = false;
}
public RatingEntry (int rating) : this (rating, new RatingRenderer ())
@@ -151,8 +151,9 @@ namespace Hyena.Widgets
protected override void OnRealized ()
{
- WidgetFlags |= WidgetFlags.Realized | WidgetFlags.NoWindow;
- GdkWindow = Parent.GdkWindow;
+ IsRealized = true;
+ HasWindow = false;
+ Window = Parent.Window;
Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
attributes.WindowType = Gdk.WindowType.Child;
@@ -160,7 +161,7 @@ namespace Hyena.Widgets
attributes.Y = Allocation.Y;
attributes.Width = Allocation.Width;
attributes.Height = Allocation.Height;
- attributes.Wclass = Gdk.WindowClass.InputOnly;
+ attributes.Wclass = Gdk.WindowWindowClass.InputOnly;
attributes.EventMask = (int)(
Gdk.EventMask.PointerMotionMask |
Gdk.EventMask.EnterNotifyMask |
@@ -176,7 +177,7 @@ namespace Hyena.Widgets
Gdk.WindowAttributesType.Y |
Gdk.WindowAttributesType.Wmclass;
- event_window = new Gdk.Window (GdkWindow, attributes, attributes_mask);
+ event_window = new Gdk.Window (Window, attributes, attributes_mask);
event_window.UserData = Handle;
Style = Gtk.Rc.GetStyleByPaths (Settings, "*.GtkEntry", "*.GtkEntry", GType);
@@ -186,7 +187,7 @@ namespace Hyena.Widgets
protected override void OnUnrealized ()
{
- WidgetFlags &= ~WidgetFlags.Realized;
+ IsRealized = false;
event_window.UserData = IntPtr.Zero;
Hyena.Gui.GtkWorkarounds.WindowDestroy (event_window);
@@ -197,7 +198,7 @@ namespace Hyena.Widgets
protected override void OnMapped ()
{
- WidgetFlags |= WidgetFlags.Mapped;
+ IsMapped = true;
event_window.Show ();
}
@@ -231,8 +232,21 @@ namespace Hyena.Widgets
}
}
- protected override void OnSizeRequested (ref Gtk.Requisition requisition)
+ protected override void OnGetPreferredHeight (out int minimum_height, out int natural_height)
{
+ var requisition = SizeRequested ();
+ minimum_height = natural_height = requisition.Height;
+ }
+
+ protected override void OnGetPreferredWidth (out int minimum_width, out int natural_width)
+ {
+ var requisition = SizeRequested ();
+ minimum_width = natural_width = requisition.Width;
+ }
+
+ protected Requisition SizeRequested ()
+ {
+ var requisition = new Requisition ();
EnsureStyle ();
Pango.FontMetrics metrics = PangoContext.GetMetrics (Style.FontDescription, PangoContext.Language);
@@ -249,30 +263,30 @@ namespace Hyena.Widgets
requisition.Width = renderer.Width;
requisition.Height = renderer.Height;
+ return requisition;
}
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnDrawn (Cairo.Context cr)
{
- if (evnt.Window != GdkWindow) {
+ if (!CairoHelper.ShouldDrawWindow(cr, Window)) {
return true;
}
if (HasFrame) {
int y_mid = (int)Math.Round ((Allocation.Height - renderer.Height) / 2.0);
- Gtk.Style.PaintFlatBox (Style, GdkWindow, State, ShadowType.None, evnt.Area, this, "entry",
+ Gtk.Style.PaintFlatBox (Style, cr, State, ShadowType.None, this, "entry",
Allocation.X, Allocation.Y + y_mid, Allocation.Width, renderer.Height);
- Gtk.Style.PaintShadow (Style, GdkWindow, State, ShadowType.In,
- evnt.Area, this, "entry", Allocation.X, Allocation.Y + y_mid, Allocation.Width, renderer.Height);
+ Gtk.Style.PaintShadow (Style, cr, State, ShadowType.In,
+ this, "entry", Allocation.X, Allocation.Y + y_mid, Allocation.Width, renderer.Height);
}
- Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow);
+ CairoHelper.TransformToWindow (cr, this, Window);
renderer.Render (cr, Allocation,
CairoExtensions.GdkColorToCairoColor (HasFrame ? Parent.Style.Text (State) : Parent.Style.Foreground (State)),
AlwaysShowEmptyStars, PreviewOnHover && hover_value >= renderer.MinRating, hover_value,
State == StateType.Insensitive ? 1 : 0.90,
State == StateType.Insensitive ? 1 : 0.55,
State == StateType.Insensitive ? 1 : 0.45);
- CairoExtensions.DisposeContext (cr);
return true;
}
diff --git a/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs b/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
index ac28bf0..2e6a1e1 100644
--- a/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
+++ b/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
@@ -36,7 +36,7 @@ using Hyena.Gui.Theming;
namespace Hyena.Widgets
{
- public class RoundedFrame : Bin
+ public class RoundedFrame : Bin, Gtk.ScrollableImplementor
{
private Theme theme;
protected Theme Theme {
@@ -95,8 +95,21 @@ namespace Hyena.Widgets
frame_width = (int)theme.Context.Radius + 1;
}
- protected override void OnSizeRequested (ref Requisition requisition)
+ protected override void OnGetPreferredHeight (out int minimum_height, out int natural_height)
{
+ var requisition = SizeRequested ();
+ minimum_height = natural_height = requisition.Height;
+ }
+
+ protected override void OnGetPreferredWidth (out int minimum_width, out int natural_width)
+ {
+ var requisition = SizeRequested ();
+ minimum_width = natural_width = requisition.Width;
+ }
+
+ protected Requisition SizeRequested ()
+ {
+ var requisition = new Requisition ();
if (child != null && child.Visible) {
// Add the child's width/height
Requisition child_requisition = child.SizeRequest ();
@@ -110,6 +123,7 @@ namespace Hyena.Widgets
// Add the frame border
requisition.Width += ((int)BorderWidth + frame_width) * 2;
requisition.Height += ((int)BorderWidth + frame_width) * 2;
+ return requisition;
}
protected override void OnSizeAllocated (Gdk.Rectangle allocation)
@@ -134,33 +148,25 @@ namespace Hyena.Widgets
child.SizeAllocate (child_allocation);
}
- protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
+ /*protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
{
// This is to satisfy the gtk_widget_set_scroll_adjustments
// inside of GtkScrolledWindow so it doesn't complain about
// its child not being scrollable.
- }
+ }*/
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnDrawn (Cairo.Context cr)
{
- if (!IsDrawable) {
- return false;
- }
-
- Cairo.Context cr = Gdk.CairoHelper.Create (evnt.Window);
+ CairoHelper.TransformToWindow (cr, this, Window);
- try {
- DrawFrame (cr, evnt.Area);
- if (child != null) {
- PropagateExpose (child, evnt);
- }
- return false;
- } finally {
- CairoExtensions.DisposeContext (cr);
+ DrawFrame (cr);
+ if (child != null) {
+ PropagateDraw (child, cr);
}
+ return false;
}
- private void DrawFrame (Cairo.Context cr, Gdk.Rectangle clip)
+ private void DrawFrame (Cairo.Context cr)
{
int x = child_allocation.X - frame_width;
int y = child_allocation.Y - frame_width;
diff --git a/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs b/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
index 66e8fab..9fdbdc2 100644
--- a/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
+++ b/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
@@ -106,21 +106,25 @@ namespace Hyena.Widgets
public SegmentedBar ()
{
- WidgetFlags |= WidgetFlags.NoWindow;
+ HasWindow = false;
}
protected override void OnRealized ()
{
- GdkWindow = Parent.GdkWindow;
+ Window = Parent.Window;
base.OnRealized ();
}
#region Size Calculations
- protected override void OnSizeRequested (ref Requisition requisition)
+ protected override void OnGetPreferredHeight (out int minimum_height, out int natural_height)
{
- requisition.Width = 200;
- requisition.Height = 0;
+ minimum_height = natural_height = 0;
+ }
+
+ protected override void OnGetPreferredWidth (out int minimum_width, out int natural_width)
+ {
+ minimum_width = natural_width = 200;
}
protected override void OnSizeAllocated (Gdk.Rectangle allocation)
@@ -312,13 +316,13 @@ namespace Hyena.Widgets
#region Rendering
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnDrawn (Cairo.Context cr)
{
- if (evnt.Window != GdkWindow) {
- return base.OnExposeEvent (evnt);
+ if (!CairoHelper.ShouldDrawWindow (cr, Window)) {
+ return base.OnDrawn (cr);
}
- Cairo.Context cr = Gdk.CairoHelper.Create (evnt.Window);
+ CairoHelper.TransformToWindow (cr, this, Window);
if (reflect) {
CairoExtensions.PushGroup (cr);
@@ -374,7 +378,6 @@ namespace Hyena.Widgets
}
bar.Destroy ();
- CairoExtensions.DisposeContext (cr);
return true;
}
diff --git a/Hyena.Gui/Hyena.Widgets/TextViewEditable.cs b/Hyena.Gui/Hyena.Widgets/TextViewEditable.cs
index 5b25c80..091b28e 100644
--- a/Hyena.Gui/Hyena.Widgets/TextViewEditable.cs
+++ b/Hyena.Gui/Hyena.Widgets/TextViewEditable.cs
@@ -58,8 +58,8 @@ namespace Hyena.Widgets
if (handler != null) {
TextInsertedArgs raise_args = new TextInsertedArgs ();
raise_args.Args = new object [] {
- args.Text,
- args.Length,
+ args.NewText,
+ args.NewTextLength,
args.Pos.Offset
};
handler (this, raise_args);
diff --git a/Hyena.Gui/Hyena.Widgets/WrapLabel.cs b/Hyena.Gui/Hyena.Widgets/WrapLabel.cs
index 52d3224..74cf9a7 100644
--- a/Hyena.Gui/Hyena.Widgets/WrapLabel.cs
+++ b/Hyena.Gui/Hyena.Widgets/WrapLabel.cs
@@ -40,7 +40,7 @@ namespace Hyena.Widgets
public WrapLabel ()
{
- WidgetFlags |= WidgetFlags.NoWindow;
+ HasWindow = false;
}
private void CreateLayout ()
@@ -83,7 +83,7 @@ namespace Hyena.Widgets
protected override void OnRealized ()
{
- GdkWindow = Parent.GdkWindow;
+ Window = Parent.Window;
base.OnRealized ();
}
@@ -100,16 +100,16 @@ namespace Hyena.Widgets
base.OnSizeAllocated (allocation);
}
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnDrawn (Cairo.Context cr)
{
- if (evnt.Window == GdkWindow) {
+ if (CairoHelper.ShouldDrawWindow (cr, Window)) {
// Center the text vertically
int lw, lh;
layout.GetPixelSize (out lw, out lh);
int y = Allocation.Y + (Allocation.Height - lh) / 2;
- Gtk.Style.PaintLayout (Style, GdkWindow, State, false,
- evnt.Area, this, null, Allocation.X, y, layout);
+ Gtk.Style.PaintLayout (Style, cr, State, false,
+ this, null, Allocation.X, y, layout);
}
return true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]