Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Attributes | Properties
Silverstone.Manticore.Toolkit.ToolbarBuilder Class Reference
Inheritance diagram for Silverstone.Manticore.Toolkit.ToolbarBuilder:
Inheritance graph
[legend]
Collaboration diagram for Silverstone.Manticore.Toolkit.ToolbarBuilder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ToolbarBuilder (String aToolbarFile, Form aForm)
void Build (Object sender, EventArgs e)
abstract void OnCommand (Object sender, ToolBarButtonClickEventArgs e)

Public Attributes

Hashtable mItems

Protected Attributes

String mToolbarFile
AxCoolBar mCoolBar
Form mForm
ToolBar mToolBar

Properties

Rectangle Bounds [get]

Detailed Description

Definition at line 56 of file toolkit.toolbars.cs.


Constructor & Destructor Documentation

Silverstone.Manticore.Toolkit.ToolbarBuilder.ToolbarBuilder ( String  aToolbarFile,
Form  aForm 
) [inline]

Definition at line 74 of file toolkit.toolbars.cs.

    {
      mToolbarFile = aToolbarFile;
      mForm = aForm;
      mItems = new Hashtable();


      // XXX band-set hack 
      mToolBar = new ToolBar();
      mForm.Controls.Add(mToolBar);

      /*
      // Initialize CoolBar
      mCoolBar = new AxCoolBar();
      AxHost host = mCoolBar as AxHost;
      host.BeginInit();
      host.Dock = DockStyle.Top;
      host.EndInit();
      mForm.Controls.Add(host);
      */

      // We can't build the CoolBar until after the window is visible
      mForm.VisibleChanged += new EventHandler(Build);
    }

Here is the call graph for this function:


Member Function Documentation

void Silverstone.Manticore.Toolkit.ToolbarBuilder.Build ( Object  sender,
EventArgs  e 
) [inline]

Definition at line 99 of file toolkit.toolbars.cs.

    {
      XmlTextReader reader;
      reader = new XmlTextReader(mToolbarFile);
      reader.WhitespaceHandling = WhitespaceHandling.None;
      reader.MoveToContent();

      bool shouldBuildNewRow = true;

      while (reader.Read()) 
      {
        if (reader.NodeType == XmlNodeType.Element) 
        {
          switch (reader.LocalName) 
          {
            case "toolstrip":
              // The next <toolbar/> we encounter should be created on a new row. 
              shouldBuildNewRow = true;
              break;
            case "toolbar":
              String[] tbvalues = new String[4] {"", "", "",  ""};
              String[] tbnames = new String[4] {"id", "label", "description", "visible"};
              for (int i = 0; i < tbnames.Length; ++i) 
              {
                if (reader.MoveToAttribute(tbnames[i]) &&
                  reader.ReadAttributeValue())
                  tbvalues[i] = reader.Value; // XXX need to handle entities
                reader.MoveToElement();
              }

              String key = tbvalues[0];
              String label = tbvalues[1];
              bool visible = tbvalues[3] == "true";
      
              // Create and add a new toolbar.
              mToolBar.Appearance = ToolBarAppearance.Flat;
              mToolBar.ButtonClick += new ToolBarButtonClickEventHandler(this.OnCommand);
              mForm.Controls.Add(mToolBar);

              //mCoolBar.Bands.Add(-1, key, label, new Object(), true, mToolBar, true);

              shouldBuildNewRow = false;
              break;
            case "toolbarseparator": 
            {
              if (mToolBar != null) 
              {
                ToolBarButton button = new ToolBarButton();
                button.Style = ToolBarButtonStyle.Separator;
                mToolBar.Buttons.Add(button);
              }
              break;
            }
            case "toolbarbutton":
            {
              if (mToolBar != null) 
              {
                String[] tbbvalues = new String[3] {"", "", ""};
                String[] tbbnames = new String[3] {"label", "icon", "command"};
                for (int i = 0; i < tbbnames.Length; ++i) 
                {
                  if (reader.MoveToAttribute(tbbnames[i]) &&
                    reader.ReadAttributeValue())
                    tbbvalues[i] = reader.Value; // XXX need to handle entities
                  reader.MoveToElement();
                }
         
                ToolBarButton button = new CommandButtonItem(tbbvalues[1]);
                button.Text = tbbvalues[0];
                mToolBar.Buttons.Add(button);
              }
              break;
            }
          }
        }
      }
    }

Here is the call graph for this function:

abstract void Silverstone.Manticore.Toolkit.ToolbarBuilder.OnCommand ( Object  sender,
ToolBarButtonClickEventArgs  e 
) [pure virtual]

Member Data Documentation

Definition at line 59 of file toolkit.toolbars.cs.

Definition at line 60 of file toolkit.toolbars.cs.

Definition at line 62 of file toolkit.toolbars.cs.

Definition at line 65 of file toolkit.toolbars.cs.

Definition at line 58 of file toolkit.toolbars.cs.


Property Documentation

Definition at line 67 of file toolkit.toolbars.cs.


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