Ejemplo n.º 1
0
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            this.CreateChildControls();

            for (int i = 0; i < _nbRegions; i++)
            {

                DesignerRegion r;

                if (_currentRegion == i)

                    r = new EditableDesignerRegion(this, i.ToString());

                else

                    r = new DesignerRegion(this, i.ToString());

                regions.Add(r);

            }

            if ((_currentRegion >= 0) && (_currentRegion < _nbRegions))

                regions[_currentRegion].Highlight = true;

            return base.GetDesignTimeHtml(regions);
        }
 public void Insert(int index, DesignerRegion region)
 {
     this.InternalList.Insert(index, region);
 }
 public bool Contains(DesignerRegion region)
 {
     return this.InternalList.Contains(region);
 }
Ejemplo n.º 4
0
 public void Remove(DesignerRegion region)
 {
     this.InternalList.Remove(region);
 }
Ejemplo n.º 5
0
 public int IndexOf(DesignerRegion region)
 {
     return(this.InternalList.IndexOf(region));
 }
Ejemplo n.º 6
0
 public int Add(DesignerRegion region)
 {
     return(this.InternalList.Add(region));
 }
Ejemplo n.º 7
0
 public void Insert(int index, DesignerRegion region)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 8
0
 public bool Contains(DesignerRegion region)
 {
     throw new NotImplementedException();
 }
 public DesignerRegionMouseEventArgs(DesignerRegion region, Point location)
 {
     this._location = location;
     this._region = region;
 }
Ejemplo n.º 10
0
 public DesignerRegionMouseEventArgs(DesignerRegion region, Point location)
 {
     throw new NotImplementedException();
 }
 public ViewEventArgs(ViewEvent eventType, DesignerRegion region, EventArgs eventArgs)
 {
     this.event_type = eventType;
     this.region     = region;
     this.event_args = eventArgs;
 }
Ejemplo n.º 12
0
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            if (CurrentControl.Tabs.Count == 0)
            {
                return GetEmptyDesignTimeHtml();
            }


            // 1. Add tabs title list
            StringBuilder sb = new StringBuilder();
            int tabIndex = 0;
            foreach (Tab tab in CurrentControl.Tabs)
            {
                HtmlNodeBuilder nb = new HtmlNodeBuilder("div");

                if (!String.IsNullOrEmpty(tab.Title))
                {
                    nb.InnerProperty = tab.Title;
                }
                else
                {
                    nb.InnerProperty = String.Format("[{0}]", tab.ID);
                }

                string styleStr = "padding:0 5px;margin-right:5px;display:inline;";
                if (CurrentControl.ActiveTabIndex == tabIndex)
                {
                    styleStr += "background-color:#666;";
                }
                nb.SetProperty("style", styleStr);

                nb.SetProperty(DesignerRegion.DesignerRegionAttributeName, tabIndex.ToString());

                DesignerRegion region = new DesignerRegion(this, "Tab_" + tabIndex, true);
                region.Properties["TabIndex"] = tabIndex.ToString();
                regions.Add(region);

                sb.Append(nb.ToString());
                tabIndex++;
            }
            string tabsHtml = sb.ToString();


            // 2. Add current active tab content
            // Note: Currently, we have add (CurrentControl.Tabs.Count - 1) items into regions,
            // So This editable region's index is CurrentControl.Tabs.Count.
            EditableDesignerRegion editableRegion = new EditableDesignerRegion(this, "Content", true);
            regions.Add(editableRegion);
            //editableRegion.Properties["ActiveTabIndex"] = CurrentControl.ActiveTabIndex.ToString();

            string contentHtml = String.Format("<div {0}='{1}'>{2}</div>",
                 DesignerRegion.DesignerRegionAttributeName, CurrentControl.Tabs.Count, GetEditableDesignerRegionContent(editableRegion));

            return String.Format(PANEL_TEMPLATE, tabsHtml, contentHtml);
        }
 public ViewEventArgs(ViewEvent eventType, DesignerRegion region, System.EventArgs eventArgs)
 {
     this._eventType = eventType;
     this._region = region;
     this._eventArgs = eventArgs;
 }
Ejemplo n.º 14
0
		public DesignerRegionMouseEventArgs (DesignerRegion region, Point location)
		{
			throw new NotImplementedException ();
		}
 public ViewEventArgs(ViewEvent eventType, DesignerRegion region, System.EventArgs eventArgs)
 {
     this._eventType = eventType;
     this._region    = region;
     this._eventArgs = eventArgs;
 }
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            if (regions == null)
            {
                throw new ArgumentNullException("regions");
            }

            if (TabContainer.ActiveTab != null)
            {
                // create the main editable region
                //
                EditableDesignerRegion region = new EditableDesignerRegion(this, String.Format(CultureInfo.InvariantCulture, "c{0}", TabContainer.ActiveTab.ID));
                
                regions.Add(region);

                // build out the content HTML.  We'll need this later.
                //
                string contentHtml = GetTabContent(TabContainer.ActiveTab, true);               

                StringBuilder clickRegions = new StringBuilder();

                // now build out the design time tab UI.
                //
                // we do this by looping through the tabs and either building a link for clicking, and a plain DesignerRegion, or,
                // we build a plain span an attach an EditableDesigner region to it.

                int count = 2; // start with two since we've already got two regions. these numbers need to correspond to the order in the regions collection
                foreach (TabPanel tp in TabContainer.Tabs)
                {
                    bool isActive = tp.Active;

                    string headerText = GetTabContent(tp, false);

                    // Build out the HTML for one of the tabs.  No, I don't usually write code like this, but this is just kind
                    // of icky no matter how you do it.  Nothing to see here.
                    //
                    clickRegions.AppendFormat(CultureInfo.InvariantCulture, ClickRegionHtml, 
                        DesignerRegion.DesignerRegionAttributeName, 
                        (isActive ? 1 : count), // if it's the editable one, it has to be index 1, see below
                        String.Format(CultureInfo.InvariantCulture, isActive ? ActiveTabLink : TabLink, headerText),
                        ColorTranslator.ToHtml(SystemColors.ControlText),
                        (isActive ? ColorTranslator.ToHtml(SystemColors.Window) : "transparent"),
                        (isActive ? "border-top:thin white outset;border-left:thin white outset;border-right:thin white outset;" : "")
                      );


                    // the region names are arbitrary.  for this purpose, we encode them by a letter - h or t for header or tab, respectively,
                    // and then pop on the tab ID.
                    //
                    if (isActive) {
                        // the editable header region is always to be 1, so we insert it there.
                        //
                        regions.Insert(1, new EditableDesignerRegion(this, String.Format(CultureInfo.InvariantCulture, "h{0}", tp.ID)));
                    }
                    else {
                        // otherwise, just create a plain region.
                        //
                        DesignerRegion clickRegion = new DesignerRegion(this, String.Format(CultureInfo.InvariantCulture, "t{0}", tp.ID));
                        clickRegion.Selectable = true;
                        count++;
                        regions.Add(clickRegion);
                    }
                }


                // OK build out the final full HTML for this control.
                //
                StringBuilder sb = new StringBuilder(1024);
                sb.Append(String.Format(CultureInfo.InvariantCulture,
                                        DesignTimeHtml,
                                        ColorTranslator.ToHtml(SystemColors.ControlText),
                                        ColorTranslator.ToHtml(SystemColors.ControlDark),
                                        TabContainer.ID,
                                        ColorTranslator.ToHtml(SystemColors.ControlText),
                                        ColorTranslator.ToHtml(SystemColors.Control),
                                        clickRegions.ToString(),
                                        contentHtml,
                                        TabContainer.Width,
                                        TabContainer.Height,
                                        DesignerRegion.DesignerRegionAttributeName,
                                        ColorTranslator.ToHtml(SystemColors.Window)
                                        ));
                return sb.ToString();                
            }
            else
            {
                // build the empty tab html.

                StringBuilder sb = new StringBuilder(512);

                sb.AppendFormat(CultureInfo.InvariantCulture, EmptyDesignTimeHtml,
                                        ColorTranslator.ToHtml(SystemColors.ControlText),
                                        ColorTranslator.ToHtml(SystemColors.ControlDark),
                                        TabContainer.ID,
                                        DesignerRegion.DesignerRegionAttributeName);

                // add a designer region for the "AddTab" UI.
                //
                DesignerRegion dr = new DesignerRegion(this, AddTabName);
                regions.Add(dr);
                return sb.ToString();                                        
            }
        }
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     string designTimeHtml = this.GetDesignTimeHtml();
     DetailsView viewControl = (DetailsView) base.ViewControl;
     int count = viewControl.Rows.Count;
     int selectedFieldIndex = this.SelectedFieldIndex;
     DetailsViewRowCollection rows = viewControl.Rows;
     for (int i = 0; i < viewControl.Fields.Count; i++)
     {
         string name = System.Design.SR.GetString("DetailsView_Field", new object[] { i.ToString(NumberFormatInfo.InvariantInfo) });
         string headerText = viewControl.Fields[i].HeaderText;
         if (headerText.Length == 0)
         {
             name = name + " - " + headerText;
         }
         if (i < count)
         {
             DetailsViewRow row = rows[i];
             for (int j = 0; j < row.Cells.Count; j++)
             {
                 TableCell cell1 = row.Cells[j];
                 if (j == 0)
                 {
                     DesignerRegion region = new DesignerRegion(this, name, true) {
                         UserData = i
                     };
                     if (i == selectedFieldIndex)
                     {
                         region.Highlight = true;
                     }
                     regions.Add(region);
                 }
                 else
                 {
                     DesignerRegion region2 = new DesignerRegion(this, i.ToString(NumberFormatInfo.InvariantInfo), false) {
                         UserData = -1
                     };
                     if (i == selectedFieldIndex)
                     {
                         region2.Highlight = true;
                     }
                     regions.Add(region2);
                 }
             }
         }
     }
     return designTimeHtml;
 }
Ejemplo n.º 18
0
 public int IndexOf(DesignerRegion region)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 19
0
		public bool Contains (DesignerRegion region)
		{
			throw new NotImplementedException ();
		}
Ejemplo n.º 20
0
 public void Remove(DesignerRegion region)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 21
0
		public int IndexOf (DesignerRegion region)
		{
			throw new NotImplementedException ();
		}
Ejemplo n.º 22
0
 public bool Contains(DesignerRegion region)
 {
     return(this.InternalList.Contains(region));
 }
Ejemplo n.º 23
0
		public void Insert (int index, DesignerRegion region)
		{
			throw new NotImplementedException ();
		}
Ejemplo n.º 24
0
 public void Insert(int index, DesignerRegion region)
 {
     this.InternalList.Insert(index, region);
 }
Ejemplo n.º 25
0
		public void Remove (DesignerRegion region)
		{
			throw new NotImplementedException ();
		}
 public int Add(DesignerRegion region)
 {
     return this.InternalList.Add(region);
 }
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     string designTimeHtml = this.GetDesignTimeHtml();
     GridView viewControl = (GridView) base.ViewControl;
     int count = viewControl.Columns.Count;
     GridViewRow headerRow = viewControl.HeaderRow;
     GridViewRow footerRow = viewControl.FooterRow;
     int selectedFieldIndex = this.SelectedFieldIndex;
     if (headerRow != null)
     {
         for (int j = 0; j < count; j++)
         {
             string name = System.Design.SR.GetString("GridView_Field", new object[] { j.ToString(NumberFormatInfo.InvariantInfo) });
             string headerText = viewControl.Columns[j].HeaderText;
             if (headerText.Length == 0)
             {
                 name = name + " - " + headerText;
             }
             DesignerRegion region = new DesignerRegion(this, name, true) {
                 UserData = j
             };
             if (j == selectedFieldIndex)
             {
                 region.Highlight = true;
             }
             regions.Add(region);
         }
     }
     for (int i = 0; i < viewControl.Rows.Count; i++)
     {
         GridViewRow row1 = viewControl.Rows[i];
         for (int k = 0; k < count; k++)
         {
             DesignerRegion region2 = new DesignerRegion(this, k.ToString(NumberFormatInfo.InvariantInfo), false) {
                 UserData = -1
             };
             if (k == selectedFieldIndex)
             {
                 region2.Highlight = true;
             }
             regions.Add(region2);
         }
     }
     if (footerRow != null)
     {
         for (int m = 0; m < count; m++)
         {
             DesignerRegion region3 = new DesignerRegion(this, m.ToString(NumberFormatInfo.InvariantInfo), false) {
                 UserData = -1
             };
             if (m == selectedFieldIndex)
             {
                 region3.Highlight = true;
             }
             regions.Add(region3);
         }
     }
     return designTimeHtml;
 }
 public int IndexOf(DesignerRegion region)
 {
     return this.InternalList.IndexOf(region);
 }
Ejemplo n.º 29
0
		public ViewEventArgs (ViewEvent eventType, DesignerRegion region, EventArgs eventArgs)
		{
			this.event_type = eventType;
			this.region = region;
			this.event_args = eventArgs;
		}
 public void Remove(DesignerRegion region)
 {
     this.InternalList.Remove(region);
 }
 public DesignerRegionMouseEventArgs(DesignerRegion region, Point location)
 {
     this._location = location;
     this._region   = region;
 }