Back to index

lightning-sunbird  0.9+nobinonly
PrefPanel.cs
Go to the documentation of this file.
00001 /* -*- Mode: C#; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is Manticore.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Silverstone Interactive.
00020  * Portions created by the Initial Developer are Copyright (C) 2001
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Ben Goodger <ben@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 namespace Silverstone.Manticore.Browser
00041 {
00042   using System;
00043   using System.Collections;
00044   using System.ComponentModel;
00045   using System.Drawing;
00046   using System.Data;
00047   using System.Windows.Forms;
00048   
00049   using Silverstone.Manticore.Core;
00050 
00054        public class PrefPanel : Panel
00055        {
00059               private System.ComponentModel.Container components = null;
00060 
00066     private bool mGenerated = false;
00067 
00071     // LAME - need to use global service thingy. 
00072     protected internal Preferences mPrefs;
00073 
00077     protected internal Form mParent;
00078 
00079               public PrefPanel(Form aParent, Preferences aPrefs)
00080               {
00081                      // This call is required by the Windows.Forms Form Designer.
00082                      InitializeComponent();
00083 
00084       // LAME oh so lame.
00085       mPrefs = aPrefs;
00086       mParent = aParent;
00087 
00088       // All preferences panels have these properties initially.
00089       this.Location = new System.Drawing.Point(160, 16);
00090       this.Size = new System.Drawing.Size(320, 264);
00091       this.TabIndex = 1;
00092       this.Visible = false;
00093 
00094       // When the preference panel is shown for the first time, we
00095       // need to fill its fields from preferences. 
00096       this.VisibleChanged += new EventHandler(VisibilityChanged);
00097               }
00098 
00104     public void VisibilityChanged(Object sender, EventArgs e) 
00105     {
00106       if (!mGenerated) {
00107         // The first time we display the panel, read the values 
00108         // for UI elements from preferences and fill the controls.
00109         Load();
00110         mGenerated = true;
00111       }
00112     }
00113 
00118     public virtual void Load()
00119     {
00120       // Implemented by derived class
00121     }
00122 
00127     public virtual void Save() 
00128     {
00129       // Implemented by derived class
00130     }
00131 
00135               protected override void Dispose( bool disposing )
00136               {
00137                      if( disposing )
00138                      {
00139                             if(components != null)
00140                             {
00141                                    components.Dispose();
00142                             }
00143                      }
00144                      base.Dispose( disposing );
00145               }
00146 
00147               #region Component Designer generated code
00148 
00149 
00150 
00151 
00152               private void InitializeComponent()
00153               {
00154                      components = new System.ComponentModel.Container();
00155               }
00156               #endregion
00157        }
00158 }