Various improvements to GTK engine
This commit is contained in:
parent
6bed614961
commit
637a937b47
@ -62,6 +62,8 @@
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="GTKEngine.cs" />
|
||||
<Compile Include="gtk-gui\UniversalEditor.Engines.GTK.MainWindow.cs" />
|
||||
<Compile Include="Editor.cs" />
|
||||
<Compile Include="gtk-gui\UniversalEditor.Engines.GTK.Editor.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
||||
@ -1,7 +1,19 @@
|
||||
|
||||
namespace UniversalEditor.Environments.GTK
|
||||
// This file has been generated by the GUI designer. Do not modify.
|
||||
namespace UniversalEditor.Engines.GTK
|
||||
{
|
||||
public partial class Editor
|
||||
{
|
||||
protected virtual void Build ()
|
||||
{
|
||||
global::Stetic.Gui.Initialize (this);
|
||||
// Widget UniversalEditor.Engines.GTK.Editor
|
||||
global::Stetic.BinContainer.Attach (this);
|
||||
this.Name = "UniversalEditor.Engines.GTK.Editor";
|
||||
if ((this.Child != null)) {
|
||||
this.Child.ShowAll ();
|
||||
}
|
||||
this.Hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,58 @@ namespace Stetic
|
||||
}
|
||||
}
|
||||
|
||||
internal class BinContainer
|
||||
{
|
||||
private Gtk.Widget child;
|
||||
private Gtk.UIManager uimanager;
|
||||
|
||||
public static BinContainer Attach (Gtk.Bin bin)
|
||||
{
|
||||
BinContainer bc = new BinContainer ();
|
||||
bin.SizeRequested += new Gtk.SizeRequestedHandler (bc.OnSizeRequested);
|
||||
bin.SizeAllocated += new Gtk.SizeAllocatedHandler (bc.OnSizeAllocated);
|
||||
bin.Added += new Gtk.AddedHandler (bc.OnAdded);
|
||||
return bc;
|
||||
}
|
||||
|
||||
private void OnSizeRequested (object sender, Gtk.SizeRequestedArgs args)
|
||||
{
|
||||
if ((this.child != null)) {
|
||||
args.Requisition = this.child.SizeRequest ();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSizeAllocated (object sender, Gtk.SizeAllocatedArgs args)
|
||||
{
|
||||
if ((this.child != null)) {
|
||||
this.child.Allocation = args.Allocation;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAdded (object sender, Gtk.AddedArgs args)
|
||||
{
|
||||
this.child = args.Widget;
|
||||
}
|
||||
|
||||
public void SetUiManager (Gtk.UIManager uim)
|
||||
{
|
||||
this.uimanager = uim;
|
||||
this.child.Realized += new System.EventHandler (this.OnRealized);
|
||||
}
|
||||
|
||||
private void OnRealized (object sender, System.EventArgs args)
|
||||
{
|
||||
if ((this.uimanager != null)) {
|
||||
Gtk.Widget w;
|
||||
w = this.child.Toplevel;
|
||||
if (((w != null) && typeof(Gtk.Window).IsInstanceOfType (w))) {
|
||||
((Gtk.Window)(w)).AddAccelGroup (this.uimanager.AccelGroup);
|
||||
this.uimanager = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class ActionGroups
|
||||
{
|
||||
public static Gtk.ActionGroup GetActionGroup (System.Type type)
|
||||
|
||||
@ -153,4 +153,11 @@
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="Gtk.Bin" id="UniversalEditor.Engines.GTK.Editor" design-size="300 300">
|
||||
<property name="MemberName" />
|
||||
<property name="Visible">False</property>
|
||||
<child>
|
||||
<placeholder />
|
||||
</child>
|
||||
</widget>
|
||||
</stetic-interface>
|
||||
Loading…
x
Reference in New Issue
Block a user