Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
MacControls
Browse files Browse the repository at this point in the history
Updated to storyboards for GitHub defect #1013.
  • Loading branch information
KMullins-Xam committed Dec 9, 2015
1 parent 1da8dc3 commit 5af39f3
Show file tree
Hide file tree
Showing 65 changed files with 2,619 additions and 8,620 deletions.
10 changes: 5 additions & 5 deletions MacControls/MacControls.sln
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MacControls", "MacControls\MacControls.csproj", "{87F4FA0E-0256-4260-9DB6-58A8A41BE8C1}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MacControls", "MacControls\MacControls.csproj", "{18BFA1E8-DC95-43FA-B736-3E4B822527F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{87F4FA0E-0256-4260-9DB6-58A8A41BE8C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87F4FA0E-0256-4260-9DB6-58A8A41BE8C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87F4FA0E-0256-4260-9DB6-58A8A41BE8C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87F4FA0E-0256-4260-9DB6-58A8A41BE8C1}.Release|Any CPU.Build.0 = Release|Any CPU
{18BFA1E8-DC95-43FA-B736-3E4B822527F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{18BFA1E8-DC95-43FA-B736-3E4B822527F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18BFA1E8-DC95-43FA-B736-3E4B822527F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18BFA1E8-DC95-43FA-B736-3E4B822527F0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
38 changes: 31 additions & 7 deletions MacControls/MacControls/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,47 @@
using System;

using AppKit;
using Foundation;
using AppKit;

namespace MacControls
{
public partial class AppDelegate : NSApplicationDelegate
[Register ("AppDelegate")]
public class AppDelegate : NSApplicationDelegate
{
MainWindowController mainWindowController;
#region Computed Properties
public int UntitledWindowCount { get; set;} =1;
#endregion

#region Constructors
public AppDelegate ()
{
}
#endregion

#region Override Methods
public override void DidFinishLaunching (NSNotification notification)
{
mainWindowController = new MainWindowController ();
mainWindowController.Window.MakeKeyAndOrderFront (this);
// Insert code here to initialize your application
}

public override void WillTerminate (NSNotification notification)
{
// Insert code here to tear down your application
}
#endregion

#region Custom Actions
[Export ("newDocument:")]
void NewDocument (NSObject sender) {
// Get new window
var storyboard = NSStoryboard.FromName ("Main", null);
var controller = storyboard.InstantiateControllerWithIdentifier ("MainWindow") as NSWindowController;

// Display
controller.ShowWindow(this);

// Set the title
controller.Window.Title = (++UntitledWindowCount == 1) ? "untitled" : string.Format ("untitled {0}", UntitledWindowCount);
}
#endregion
}
}

7 changes: 0 additions & 7 deletions MacControls/MacControls/AppDelegate.designer.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
// This file has been autogenerated from a class added in the UI designer.

using System;

using Foundation;
using AppKit;

namespace MacControls
{
public partial class SubviewButtons : AppKit.NSView
public partial class ButtonsViewController : NSViewController
{
#region Constructors

// Called when created from unmanaged code
public SubviewButtons (IntPtr handle) : base (handle)
{
Initialize ();
}

// Called when created directly from a XIB file
[Export ("initWithCoder:")]
public SubviewButtons (NSCoder coder) : base (coder)
public ButtonsViewController (IntPtr handle) : base (handle)
{
Initialize ();
}

// Shared initialization code
void Initialize ()
{
}

#endregion

#region Override Methods
public override void AwakeFromNib ()
public override void ViewWillAppear ()
{
base.AwakeFromNib ();
base.ViewWillAppear ();

// Wireup events
ButtonOutlet.Activated += (sender, e) => {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
// This file has been autogenerated from a class added in the UI designer.

using System;

using Foundation;
using AppKit;

namespace MacControls
{
public partial class SubviewChecksRadio : AppKit.NSView
public partial class CheckboxViewController : NSViewController
{
#region Constructors

// Called when created from unmanaged code
public SubviewChecksRadio (IntPtr handle) : base (handle)
{
Initialize ();
}

// Called when created directly from a XIB file
[Export ("initWithCoder:")]
public SubviewChecksRadio (NSCoder coder) : base (coder)
public CheckboxViewController (IntPtr handle) : base (handle)
{
Initialize ();
}

// Shared initialization code
void Initialize ()
{
}

#endregion

#region Override Methods
public override void AwakeFromNib ()
public override void ViewWillAppear ()
{
base.AwakeFromNib ();
base.ViewWillAppear ();

// Wireup controls
AdjustTime.Activated += (sender, e) => {
Expand All @@ -51,13 +36,12 @@ public override void AwakeFromNib ()
TransportationWalking.Activated += (sender, e) => {
FeedbackLabel.StringValue = "Walking Selected";
};

}
#endregion

#region Button Actions
partial void SelectCar (Foundation.NSObject sender) {
Transportation.SelectCell(TransportationCar);
TransportationCar.State = NSCellStateValue.On;
FeedbackLabel.StringValue = "Car Selected";
}
#endregion
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions MacControls/MacControls/Classes/ReplaceViewSegue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using AppKit;
using Foundation;
using CoreGraphics;

namespace AppKit
{
[Register("ReplaceViewSeque")]
public class ReplaceViewSeque : NSStoryboardSegue
{
#region Constructors
public ReplaceViewSeque() {

}

public ReplaceViewSeque (string identifier, NSObject sourceController, NSObject destinationController) : base(identifier,sourceController,destinationController) {

}

public ReplaceViewSeque (IntPtr handle) : base(handle) {
}

public ReplaceViewSeque (NSObjectFlag x) : base(x) {
}
#endregion

#region Override Methods
public override void Perform ()
{
// Cast the source and destination controllers
var source = SourceController as NSViewController;
var destination = DestinationController as NSViewController;

// Remove any existing view
if (source.View.Subviews.Length > 0) {
source.View.Subviews [0].RemoveFromSuperview ();
}

// Adjust sizing and add new view
destination.View.Frame = new CGRect(0 ,0 ,source.View.Frame.Width, source.View.Frame.Height);
destination.View.AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable;
source.View.AddSubview(destination.View);

}
#endregion

}

}
Loading

0 comments on commit 5af39f3

Please sign in to comment.