Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Package Attributes | Private Member Functions | Private Attributes
Silverstone.Manticore.Browser.PrefsDialog Class Reference

Summary description for Form1. More...

Inheritance diagram for Silverstone.Manticore.Browser.PrefsDialog:
Inheritance graph
[legend]
Collaboration diagram for Silverstone.Manticore.Browser.PrefsDialog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PrefsDialog (Form aOpener)
void OnOK (object sender, EventArgs e)
void OnTreeSelect (Object sender, TreeViewEventArgs e)
void InitializePanels ()
 Create all the preferences panels.
void VisibleChangedHandler (Object sender, EventArgs e)

Protected Member Functions

override void Dispose (bool disposing)
 Clean up any resources being used.

Package Attributes

Form mOpener

Private Member Functions

void InitializeCategoryList ()
 Load the category list from XML and select the initial panel.
void CatListRecurse (XmlTextReader aReader, Object aRootNode)
void InitializeComponent ()
 Required method for Designer support - do not modify the contents of this method with the code editor.

Private Attributes

System.Windows.Forms.TreeView treeView1
System.Windows.Forms.Button cancelButton
System.Windows.Forms.Button okButton
System.ComponentModel.Container components = null
 Required designer variable.
Hashtable mNodes = null
Hashtable mPanels = null
PrefPanel mCurrentPanel = null
Preferences mPrefs = null

Detailed Description

Summary description for Form1.

Definition at line 57 of file PrefsDialog.cs.


Constructor & Destructor Documentation

Definition at line 74 of file PrefsDialog.cs.

                                               : base(aOpener)
              {
                     //
                     // Required for Windows Form Designer support
                     //
                     InitializeComponent();

      okButton.Click += new EventHandler(OnOK);

      mNodes = new Hashtable();
      mPanels = new Hashtable();

      BrowserWindow window = mOpener as BrowserWindow;
      mPrefs = ServiceManager.Preferences;

      //
      // Initialize all the preference panels.
      //
      InitializePanels();

      // Add select handler for tree view so that we can
      // switch panels.
      treeView1.AfterSelect += new TreeViewEventHandler(OnTreeSelect);

      //
      // Initialize the category list. 
      //
      InitializeCategoryList();

      // XXX - eventually we want to remember user state. This will do
      //       for now. 
      treeView1.ExpandAll();
    }

Here is the call graph for this function:


Member Function Documentation

void Silverstone.Manticore.Browser.PrefsDialog.CatListRecurse ( XmlTextReader  aReader,
Object  aRootNode 
) [inline, private]

Definition at line 168 of file PrefsDialog.cs.

    {
      String inner = aReader.ReadInnerXml();
    
      NameTable nt = new NameTable();
      XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
      XmlParserContext ctxt = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
      XmlTextReader reader2 = new XmlTextReader(inner, XmlNodeType.Element, ctxt);

      TreeNode node;

      while (reader2.Read()) {
        if (reader2.NodeType == XmlNodeType.Element) {
          switch (reader2.LocalName) {
          case "panel":
            // Tree node with children. Retrieve label and id. Label is 
            // used for visual presentation, id is hashed against node
            // and is used as a key when looking for which panel to 
            // load. 
            String[] values = new String[2] {"", ""};
            String[] names = new String[2] {"label", "id"};
            for (int i = 0; i < names.Length; ++i) {
              if (reader2.MoveToAttribute(names[i]) &&
                reader2.ReadAttributeValue())
                values[i] = reader2.Value; 
              reader2.MoveToElement();
            }

            node = new TreeNode(values[0], 0, 0);
            if (aRootNode is TreeView) {
              TreeView rootView = aRootNode as TreeView;
              rootView.Nodes.Add(node);
            }
            else if (aRootNode is TreeNode) {
              TreeNode rootNode = aRootNode as TreeNode;
              rootNode.Nodes.Add(node);
            }

            mNodes.Add(node.GetHashCode(), values[1]);
            CatListRecurse(reader2, node);
            break;
          }
        }
      }
    }

Here is the call graph for this function:

override void Silverstone.Manticore.Browser.PrefsDialog.Dispose ( bool  disposing) [inline, protected]

Clean up any resources being used.

Definition at line 217 of file PrefsDialog.cs.

              {
                     if( disposing )
                     {
                            if(components != null)
                            {
                                   components.Dispose();
                            }
                     }
                     base.Dispose( disposing );
              }

Load the category list from XML and select the initial panel.

Definition at line 155 of file PrefsDialog.cs.

    {
      mNodes = new Hashtable();

      XmlTextReader reader;
      reader = new XmlTextReader("browser\\PrefPanels.xml");
      
      reader.WhitespaceHandling = WhitespaceHandling.None;
      reader.MoveToContent();

      CatListRecurse(reader, treeView1);
    }

Here is the call graph for this function:

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 234 of file PrefsDialog.cs.

              {
      this.cancelButton = new System.Windows.Forms.Button();
      this.treeView1 = new System.Windows.Forms.TreeView();
      this.okButton = new System.Windows.Forms.Button();
      this.SuspendLayout();
      // 
      // cancelButton
      // 
      this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
      this.cancelButton.Location = new System.Drawing.Point(408, 296);
      this.cancelButton.Name = "cancelButton";
      this.cancelButton.TabIndex = 2;
      this.cancelButton.Text = "Cancel";
      this.cancelButton.FlatStyle = FlatStyle.System;
      // 
      // treeView1
      // 
      this.treeView1.ImageIndex = -1;
      this.treeView1.Location = new System.Drawing.Point(16, 16);
      this.treeView1.Name = "treeView1";
      this.treeView1.SelectedImageIndex = -1;
      this.treeView1.Size = new System.Drawing.Size(136, 264);
      this.treeView1.TabIndex = 0;
      // 
      // okButton
      // 
      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
      this.okButton.Location = new System.Drawing.Point(328, 296);
      this.okButton.Name = "okButton";
      this.okButton.TabIndex = 3;
      this.okButton.Text = "OK";
      this.okButton.FlatStyle = FlatStyle.System;
      // 
      // PrefsDialog
      // 
      this.AcceptButton = this.okButton;
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.CancelButton = this.cancelButton;
      this.ClientSize = new System.Drawing.Size(496, 328);
      this.ControlBox = false;
      this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                  this.okButton,
                                                                  this.cancelButton,
                                                                  this.treeView1});
      this.HelpButton = true;
      this.Name = "PrefsDialog";
      this.ShowInTaskbar = false;
      this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
      this.Text = "Options";
      this.ResumeLayout(false);

    }

Create all the preferences panels.

Definition at line 144 of file PrefsDialog.cs.

    {
      BrowserDisplayPanel bdp = new BrowserDisplayPanel(this, mOpener, mPrefs);
      mPanels.Add("browser-display", bdp);
      this.Controls.Add(bdp);
    }
void Silverstone.Manticore.Browser.PrefsDialog.OnOK ( object  sender,
EventArgs  e 
) [inline]

Definition at line 108 of file PrefsDialog.cs.

    {
      // Call |Save| on each preferences panel...
      IEnumerator panels = mPanels.Values.GetEnumerator();
      while (panels.MoveNext()) {
        PrefPanel currPanel = panels.Current as PrefPanel;
        currPanel.Save();
      }

      // ... then flush preferences to disk for safe keepin'.
      // XXX not just yet. 
      // mPrefs.FlushUserPreferences();
    }

Here is the call graph for this function:

void Silverstone.Manticore.Browser.PrefsDialog.OnTreeSelect ( Object  sender,
TreeViewEventArgs  e 
) [inline]

Definition at line 122 of file PrefsDialog.cs.

    {
      TreeNode selectedNode = e.Node;
      String panelID = mNodes[selectedNode.GetHashCode()] as String;
      PrefPanel newPanel = mPanels[panelID] as PrefPanel;
      if (mCurrentPanel != null) 
        mCurrentPanel.Visible = false;
      if (newPanel != null) {
        newPanel.Visible = true;
        mCurrentPanel = newPanel;
      }
      else {
        if (selectedNode.FirstNode != null) {
          TreeView treeview = sender as TreeView;
          treeview.SelectedNode = selectedNode.FirstNode;
        }
      }
    }

Here is the call graph for this function:

void Silverstone.Manticore.Toolkit.ManticoreDialog.VisibleChangedHandler ( Object  sender,
EventArgs  e 
) [inline, inherited]

Definition at line 61 of file ManticoreDialog.cs.

    {
      this.Left = mOpener.Left + ((mOpener.Width / 2) - (this.Width / 2));
      this.Top = mOpener.Top + ((mOpener.Height / 2) - (this.Height / 2));
    }

Member Data Documentation

System.Windows.Forms.Button Silverstone.Manticore.Browser.PrefsDialog.cancelButton [private]

Definition at line 60 of file PrefsDialog.cs.

System.ComponentModel.Container Silverstone.Manticore.Browser.PrefsDialog.components = null [private]

Required designer variable.

Definition at line 65 of file PrefsDialog.cs.

Definition at line 69 of file PrefsDialog.cs.

Definition at line 67 of file PrefsDialog.cs.

Definition at line 50 of file ManticoreDialog.cs.

Definition at line 68 of file PrefsDialog.cs.

Definition at line 72 of file PrefsDialog.cs.

System.Windows.Forms.Button Silverstone.Manticore.Browser.PrefsDialog.okButton [private]

Definition at line 61 of file PrefsDialog.cs.

System.Windows.Forms.TreeView Silverstone.Manticore.Browser.PrefsDialog.treeView1 [private]

Definition at line 59 of file PrefsDialog.cs.


The documentation for this class was generated from the following file: