2
// PListEditorWidget.cs
5
// Mike Krüger <mkrueger@xamarin.com>
7
// Copyright (c) 2011 Xamarin <http://xamarin.com>
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
// of this software and associated documentation files (the "Software"), to deal
11
// in the Software without restriction, including without limitation the rights
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
// copies of the Software, and to permit persons to whom the Software is
14
// furnished to do so, subject to the following conditions:
16
// The above copyright notice and this permission notice shall be included in
17
// all copies or substantial portions of the Software.
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
using MonoDevelop.Components;
29
using MonoDevelop.Core;
30
using MonoDevelop.Projects;
32
namespace MonoDevelop.MacDev.PlistEditor
34
[System.ComponentModel.ToolboxItem (false)]
35
public class PListEditorWidget : Notebook, IPListDisplayWidget
38
IPlistEditingHandler handler;
40
class PListEditorSection : CompactScrolledWindow
42
VBox content = new VBox ();
44
public PListEditorSection ()
46
AddWithViewport (content);
51
protected override void OnRealized ()
57
public void AddExpander (MacExpander expander)
59
content.PackStart (expander, false, false, 0);
63
public PListEditorWidget (IPlistEditingHandler handler, Project proj)
65
this.handler = handler;
69
public void SetPListContainer (PObjectContainer container)
71
var summaryScrolledWindow = new PListEditorSection ();
72
AppendPage (summaryScrolledWindow, new Label (GettextCatalog.GetString ("Summary")));
74
var advancedScrolledWindow = new PListEditorSection ();
75
AppendPage (advancedScrolledWindow, new Label (GettextCatalog.GetString ("Advanced")));
77
foreach (var section in handler.GetSections (proj, container)) {
78
var expander = new MacExpander () {
79
ContentLabel = section.Name,
82
expander.SetWidget (section.Widget);
84
if (section.IsAdvanced) {
85
advancedScrolledWindow.AddExpander (expander);
87
summaryScrolledWindow.AddExpander (expander);
90
if (section.CheckVisible != null) {
91
expander.Visible = section.CheckVisible (container);
92
//capture section for closure
94
container.Changed += delegate {
95
expander.Visible = s.CheckVisible (container);
b'\\ No newline at end of file'