Beispiel #1
0
        public GenericItemContainer()
        {
			// We contain other controls
			m_IsContainer=true;
			m_PaddingLeft=1;
			m_PaddingTop=1;
			m_PaddingBottom=1;
			m_PaddingRight=1;
			m_ItemSpacing=0;
			m_BackgroundColor=Color.Empty;
			m_BorderType=eBorderType.None;
			m_WrapItems=false;
			m_MoreItems=null;
			m_EqualButtonSize=false;
			//m_Stretch=false;
			m_MoreItemsOnMenu=false;
			m_SystemContainer=false;
			this.AccessibleRole=System.Windows.Forms.AccessibleRole.Grouping;
        }
Beispiel #2
0
		/// <summary>
		/// Recalculate Size of this item
		/// </summary>
		private void RecalcSizeToolbar()
		{
			if(this.SuspendLayout)
				return;

            bool isRightToLeft = false;
            Control containerControl = this.ContainerControl as Control;
            if (containerControl != null)
                isRightToLeft = (containerControl.RightToLeft == RightToLeft.Yes);

			// This object for now have only border but it will have more potentially
			int iX=0, iY=0, iMaxItem=0, iMaxItemWidth=0, iMaxItemHeight=0;
			int iWidth=0, iHeight=0;
			int iGroupLineSize=3;
			int iLines=0;
			bool bDisplayed=true;
			bool bAdjustSize=false, bSetSize=false;  // If horizontal orientation we need to make sure that Height of all items is same
			int iDisplayed=0;
			BaseItem objItem=null;
			ArrayList FarAlignLines=null;
			Stack FarAlignItems=null;
			ArrayList StretchLines=null;
			ArrayList StretchLinesISCount=null;  // Holds the count of number of items stretched per line
			ArrayList ItemsToStretch=null;

			if(m_MoreItems!=null && m_MoreItems.Expanded)
				m_MoreItems.Expanded=false;

            if (EffectiveStyle == eDotNetBarStyle.Office2000)
				iGroupLineSize=6;

			iX=m_PaddingLeft+m_Rect.Left;
			iY=m_PaddingTop+m_Rect.Top;

			int iVisibleCount=this.VisibleSubItems;
			int iVisible=0;

			if(m_SubItems!=null)
			{
				bool bRepeat=false;
				int iRepeatCount=0;
				
				if(m_WrapItems || this.Stretch)
					FarAlignLines=new ArrayList(3);

				if(this.Stretch)
				{
					StretchLines=new ArrayList(3);
					StretchLinesISCount=new ArrayList(3);
				}

                bool callRecalcSize = OnBeforeLayout();

				do
				{
					iDisplayed=0;
					for (int iCurrentItem=0;iCurrentItem<m_SubItems.Count;iCurrentItem++)
					{
						objItem=m_SubItems[iCurrentItem] as BaseItem;
						if(objItem!=null && objItem.Visible)
						{
							iVisible++;
							if((objItem.SupportedOrientation==eSupportedOrientation.Horizontal && m_Orientation==eOrientation.Vertical) || (objItem.SupportedOrientation==eSupportedOrientation.Vertical && m_Orientation==eOrientation.Horizontal))
							{
								objItem.Displayed=false;
								continue;
							}

                            int itemSpacing = (iDisplayed > 1 || m_FirstItemSpacing == 0) ? m_ItemSpacing : m_FirstItemSpacing;

                            if(callRecalcSize)
							    objItem.RecalcSize();
							if(bSetSize)
							{
								if(m_Orientation==eOrientation.Vertical)
									objItem.WidthInternal=iMaxItemWidth;
								else
									objItem.HeightInternal=iMaxItemHeight;
							}

							switch(m_Orientation)
							{
								case eOrientation.Horizontal:
								{
									// Wrap to next line if needed
									if(m_WrapItems)
									{
										if(objItem.BeginGroup && iDisplayed>0)
											iX+=iGroupLineSize;
                                        if (iX + objItem.WidthInternal + itemSpacing > m_Rect.Right && iX > m_PaddingLeft + m_Rect.Left)
										{
                                            iY += (iMaxItem + itemSpacing);
											if(objItem.BeginGroup)
												iY+=iGroupLineSize;
											iX=m_PaddingLeft+m_Rect.Left;
											iMaxItem=0;
											iLines++;

											if(FarAlignItems!=null)
												FarAlignItems=null;
											if(ItemsToStretch!=null)
												ItemsToStretch=null;
										}
									}
									else if(bDisplayed)
									{
										if(objItem.BeginGroup && iDisplayed>0)
											iX+=iGroupLineSize;
										// If not wrapping then make sure that items fits into one line, otherwise we need to display the mark that lets them see the rest
                                        if (iX + objItem.WidthInternal + itemSpacing > m_Rect.Right - m_PaddingRight && iX > m_PaddingLeft + m_Rect.Left || (iX + objItem.WidthInternal + itemSpacing + DisplayMoreItem.FixedSize > m_Rect.Right && iCurrentItem + 1 < m_SubItems.Count && iVisible < iVisibleCount))
										{
											if(iCurrentItem==0)
												iMaxItem=objItem.HeightInternal;
											// Items don't fit any more the rest won't be visible
                                            iX += (itemSpacing + DisplayMoreItem.FixedSize);
					                        bDisplayed=false;
										}
									}
									
									if(bDisplayed)
									{
										if(iDisplayed>0)
                                            iX += itemSpacing;
                                        objItem.LeftInternal = GetItemLayoutX(objItem, iX);
                                        objItem.TopInternal = GetItemLayoutY(objItem, iY);
										//iX+=objItem.WidthInternal+m_ItemSpacing;
										iX+=GetItemLayoutWidth(objItem);
										if(objItem.HeightInternal>iMaxItem)
										{
											iMaxItem=objItem.HeightInternal;
										}
									}
									break;
								}
								case eOrientation.Vertical:
								{
									// Wrap to next line if needed
									if(m_WrapItems)
									{
										if(objItem.BeginGroup && iDisplayed>0)
											iY+=iGroupLineSize;
                                        if (iY + objItem.HeightInternal + itemSpacing > m_Rect.Bottom && iY > m_PaddingTop + m_Rect.Top)
										{
                                            iX += (iMaxItem + itemSpacing);
											if(objItem.BeginGroup)
												iX+=iGroupLineSize;
											iY=m_PaddingTop+m_Rect.Top;
											iMaxItem=0;
											iLines++;

											if(FarAlignItems!=null)
												FarAlignItems=null;
											if(ItemsToStretch!=null)
												ItemsToStretch=null;
										}
									}
									else if(bDisplayed)
									{
										if(objItem.BeginGroup && iDisplayed>0)
											iY+=iGroupLineSize;
										// If not wrapping then make sure that items fits into one line, otherwise we need to display the mark that lets them see the rest
                                        if (iY + objItem.HeightInternal + itemSpacing > m_Rect.Bottom && iY > m_PaddingTop + m_Rect.Top || (iY + objItem.HeightInternal + itemSpacing + DisplayMoreItem.FixedSize > m_Rect.Bottom && iCurrentItem + 1 < m_SubItems.Count && iVisible < iVisibleCount))
										{
											if(iCurrentItem==0)
												iMaxItem=objItem.WidthInternal;
											// Items don't fit any more the rest won't be visible
                                            iY += (itemSpacing + DisplayMoreItem.FixedSize);
					                        bDisplayed=false;
										}
									}
									if(bDisplayed)
									{
										if(iDisplayed>0)
                                            iY += itemSpacing;
										objItem.LeftInternal=iX;
										objItem.TopInternal=iY;
										iY+=GetItemLayoutHeight(objItem);
										if(objItem.WidthInternal>iMaxItem)
										{
											iMaxItem=objItem.WidthInternal;
										}
									}
									break;
								}
								default:
									break;
							}

							if(bDisplayed)
							{
								if(objItem.WidthInternal!=iMaxItemWidth)
								{
									if(m_Orientation==eOrientation.Vertical && iMaxItemWidth!=0 && !bSetSize)
										bAdjustSize=true;
									if(objItem.WidthInternal>iMaxItemWidth)
										iMaxItemWidth=objItem.WidthInternal;
								}
								if(objItem.HeightInternal!=iMaxItemHeight)
								{
									if(m_Orientation==eOrientation.Horizontal && iMaxItemHeight!=0 && !bSetSize)
										bAdjustSize=true;
									if(objItem.HeightInternal>iMaxItemHeight)
										iMaxItemHeight=objItem.HeightInternal;
								}
								iDisplayed++;
							}

							objItem.Displayed=bDisplayed;

							// Save right (Far) aligned items so we can adjust thiere position at the end
							if(bDisplayed && FarAlignLines!=null && objItem.ItemAlignment==eItemAlignment.Far || FarAlignItems!=null)
							{
								if(FarAlignItems==null)
								{
									FarAlignItems=new Stack();
									FarAlignLines.Add(FarAlignItems);
								}
								FarAlignItems.Push(objItem);
								// no stretch after item has been far aligned
								StretchLines=null;
							}

							// Save Items that we need to stretch
							if(bDisplayed && objItem.Stretch && StretchLines!=null || ItemsToStretch!=null)
							{
								if(ItemsToStretch==null)
								{
									ItemsToStretch=new ArrayList(5);
									StretchLines.Add(ItemsToStretch);
									StretchLinesISCount.Add(0);
								}
								ItemsToStretch.Add(objItem);
								if(objItem.Stretch)
									StretchLinesISCount[StretchLinesISCount.Count-1]=(int)StretchLinesISCount[StretchLinesISCount.Count-1]+1;
							}


							// Track the size if this container
							if(iX>iWidth)
								iWidth=iX;
							if(iY>iHeight)
								iHeight=iY;
						}
						else if(objItem!=null)
							objItem.Displayed=false;
					}
					// Check do we have to repeat the process
					// This is needed if container is in wrap mode and some items do not fit
					// This is done to ensure the minimum size of the container for example
					// if container with is smaller than width of one single item inside the
					// container width has to be set to widest item in the list and then the
					// size has to be recalculated again.
					if(m_WrapItems && iLines>0 && iRepeatCount<1)
					{
						if(m_Orientation==eOrientation.Horizontal && (iWidth>m_Rect.Width || bAdjustSize))
						{
							bRepeat=true;
							m_Rect.Width=iWidth+m_PaddingLeft+m_PaddingRight;
							iX=m_PaddingLeft+m_Rect.Left;
							iY=m_PaddingTop+m_Rect.Top;
							iWidth=0;
							iHeight=0;
						}
						else if(m_Orientation==eOrientation.Vertical && (iHeight>m_Rect.Height || bAdjustSize))
						{
							bRepeat=true;
							m_Rect.Height=iHeight+m_PaddingTop+m_PaddingBottom;
							iX=m_PaddingLeft+m_Rect.Left;
							iY=m_PaddingTop+m_Rect.Top;
							iWidth=0;
							iHeight=0;
						}
						if(bAdjustSize)
						{
							if(m_EventHeight)
								bSetSize=true;
							bAdjustSize=false;
						}
						// Reset alignment collections since new iteration can cause different lines
						if(bRepeat && iRepeatCount+1<2)
						{
							if(FarAlignLines!=null && FarAlignLines.Count>0)
								FarAlignLines=new ArrayList(3);
							// Reset stretch collection for same reason
							if(StretchLines!=null && StretchLines.Count>0)
							{
								StretchLines=new ArrayList(3);
								StretchLinesISCount=new ArrayList(3);
							}
						}
					}
					iRepeatCount++;
				} while (bRepeat && iRepeatCount<2);
			}

			if(m_EqualButtonSize)
			{
				// Make all buttons same width, do the same thing as loop above
				iX=m_PaddingLeft+m_Rect.Left;
				iY=m_PaddingTop+m_Rect.Top;
				iWidth=0;
				iHeight=0;
				bDisplayed=true;
				iLines=0;
				bAdjustSize=false;  // Size will be adjusted reset
				iDisplayed=0;

				// Reset alignment collections since new iteration can cause different lines
				if(FarAlignLines!=null && FarAlignLines.Count>0)
					FarAlignLines=new ArrayList(3);
				// Reset stretch collection for same reason
				if(StretchLines!=null && StretchLines.Count>0)
				{
					StretchLines=new ArrayList(3);
					StretchLinesISCount=new ArrayList(3);
				}

				for (int iCurrentItem=0;iCurrentItem<m_SubItems.Count;iCurrentItem++)
				{
					objItem=m_SubItems[iCurrentItem] as BaseItem;
					if(objItem!=null && objItem.Visible)
					{
						if((objItem.SupportedOrientation==eSupportedOrientation.Horizontal && m_Orientation==eOrientation.Vertical) || (objItem.SupportedOrientation==eSupportedOrientation.Vertical && m_Orientation==eOrientation.Horizontal))
						{
							objItem.Displayed=false;
							continue;
						}
                        int itemSpacing = (iDisplayed > 1 || m_FirstItemSpacing == 0) ? m_ItemSpacing : m_FirstItemSpacing;
						if(objItem.SystemItem)
						{
							if(m_Orientation==eOrientation.Vertical)
								objItem.WidthInternal=iMaxItemWidth;
							else
								objItem.HeightInternal=iMaxItemHeight;
						}
						else
						{
							objItem.WidthInternal=iMaxItemWidth;
							objItem.HeightInternal=iMaxItemHeight;
						}

						switch(m_Orientation)
						{
							case eOrientation.Horizontal:
							{
								// Wrap to next line if needed
								if(m_WrapItems)
								{
									if(objItem.BeginGroup)
										iX+=iGroupLineSize;
                                    if (iX + objItem.WidthInternal + itemSpacing > m_Rect.Right && iX > m_PaddingLeft + m_PaddingRight)
									{
                                        iY += (iMaxItem + itemSpacing);
										if(objItem.BeginGroup)
											iY+=iGroupLineSize;
										iX=m_PaddingLeft+m_Rect.Left;
										iMaxItem=0;
										iLines++;

										if(FarAlignItems!=null)
											FarAlignItems=null;
										if(ItemsToStretch!=null)
											ItemsToStretch=null;
									}
								}
								else if(bDisplayed)
								{
									if(objItem.BeginGroup)
										iX+=iGroupLineSize;
									// If not wrapping then make sure that items fits into one line, otherwise we need to display the mark that lets them see the rest
                                    if (iX + objItem.WidthInternal + itemSpacing > m_Rect.Right && iX > m_PaddingLeft + m_Rect.Left || (iX + objItem.WidthInternal + itemSpacing + DisplayMoreItem.FixedSize > m_Rect.Right && iCurrentItem + 1 < m_SubItems.Count && iVisible < iVisibleCount))
									{
										// Items don't fit any more the rest won't be visible
                                        iX += (itemSpacing + DisplayMoreItem.FixedSize);
                                        bDisplayed=false;
									}
								}
								
								if(bDisplayed)
								{
									objItem.LeftInternal=iX;
									objItem.TopInternal=iY;
                                    iX += objItem.WidthInternal + itemSpacing;
									if(objItem.HeightInternal>iMaxItem)
									{
										iMaxItem=objItem.HeightInternal;
									}
								}
								break;
							}
							case eOrientation.Vertical:
							{
								// Wrap to next line if needed
								if(m_WrapItems)
								{
                                    if (iY + objItem.HeightInternal + itemSpacing > m_Rect.Bottom && iY > m_PaddingTop + m_PaddingBottom)
									{
                                        iX += (iMaxItem + itemSpacing);
										iY=m_PaddingTop+m_Rect.Top;
										iMaxItem=0;
										iLines++;

										if(FarAlignItems!=null)
											FarAlignItems=null;
										if(ItemsToStretch!=null)
											ItemsToStretch=null;
									}
								}
								else if(bDisplayed)
								{
									// If not wrapping then make sure that items fits into one line, otherwise we need to display the mark that lets them see the rest
                                    if (iY + objItem.HeightInternal + itemSpacing > m_Rect.Bottom && iY > m_PaddingTop + m_Rect.Top || (iY + objItem.HeightInternal + itemSpacing + DisplayMoreItem.FixedSize > m_Rect.Bottom && iCurrentItem + 1 < m_SubItems.Count && iVisible < iVisibleCount))
									{
										// Items don't fit any more the rest won't be visible
                                        iY += (itemSpacing + DisplayMoreItem.FixedSize);
                                        bDisplayed=false;
									}
								}
								
								if(bDisplayed)
								{
									objItem.LeftInternal=iX;
									objItem.TopInternal=iY;
                                    iY += objItem.HeightInternal + itemSpacing;
									if(objItem.WidthInternal>iMaxItem)
									{
										iMaxItem=objItem.WidthInternal;
									}
								}
								break;
							}
							default:
								break;
						}
						objItem.Displayed=bDisplayed;
						if(bDisplayed)
							iDisplayed++;

						// Save right (Far) aligned items so we can adjust thiere position at the end
						if(bDisplayed && FarAlignLines!=null && objItem.ItemAlignment==eItemAlignment.Far || FarAlignItems!=null)
						{
							if(FarAlignItems==null)
							{
								FarAlignItems=new Stack();
								FarAlignLines.Add(FarAlignItems);
							}
							FarAlignItems.Push(objItem);
							// no stretch after item has been far aligned
							StretchLines=null;
						}

						// Save Items that we need to stretch, but not after item is far aligned
						if(bDisplayed && objItem.Stretch && StretchLines!=null || ItemsToStretch!=null)
						{
							if(ItemsToStretch==null)
							{
								ItemsToStretch=new ArrayList(5);
								StretchLines.Add(ItemsToStretch);
								StretchLinesISCount.Add(0);
							}
							ItemsToStretch.Add(objItem);
							if(objItem.Stretch)
								StretchLinesISCount[StretchLinesISCount.Count-1]=(int)StretchLinesISCount[StretchLinesISCount.Count-1]+1;
						}

						// Track the size if this container
						if(iX>iWidth)
							iWidth=iX;
						if(iY>iHeight)
							iHeight=iY;
					}
				}
			}

			m_DisplayedItems=iDisplayed;

            if (_FillsContainerControl)
            {
                if (m_Orientation == eOrientation.Vertical)
                    iMaxItemWidth = m_Rect.Width - m_PaddingLeft;
                else
                    iMaxItemHeight = m_Rect.Height - m_PaddingTop;
                bAdjustSize = true;
            }

            if (bAdjustSize)
			{
				if(m_Orientation==eOrientation.Vertical)
				{
					foreach(BaseItem objTmp in this.SubItems)
					{
						if(m_EventHeight)
							objTmp.WidthInternal=iMaxItemWidth;
                        else if (m_ToolbarItemsAlign == eContainerVerticalAlignment.Bottom)
							objTmp.LeftInternal+=(iMaxItemWidth-objTmp.WidthInternal);
                        else if (m_ToolbarItemsAlign == eContainerVerticalAlignment.Middle)
                            objTmp.LeftInternal += (iMaxItemWidth - objTmp.WidthInternal) / 2;
					}
				}
				else
				{
					foreach(BaseItem objTmp in this.SubItems)
					{
                        if (m_EventHeight)
                            objTmp.HeightInternal = iMaxItemHeight;
                        else if (m_ToolbarItemsAlign == eContainerVerticalAlignment.Bottom)
                            objTmp.TopInternal += (iMaxItemHeight - objTmp.HeightInternal);
                        else if (m_ToolbarItemsAlign == eContainerVerticalAlignment.Middle && iMaxItemHeight != objTmp.HeightInternal)
                            objTmp.TopInternal += (int)Math.Ceiling((float)(iMaxItemHeight - objTmp.HeightInternal) / 2) /*+ 1*/;
					}
				}
			}

			// Add max width or height depending on arrange type...
			switch(m_Orientation)
			{
				case eOrientation.Horizontal:
				{
					iHeight+=iMaxItem;
					break;
				}
				case eOrientation.Vertical:
				{
					iWidth+=iMaxItem;
					break;
				}
				default:
					break;
			}

			if(this.Stretch)
			{
				if(m_Orientation==eOrientation.Horizontal)
				{
					m_Rect.Height=iHeight+m_PaddingBottom-m_Rect.Top;

					// Only if suggested Width is less than our width change it
					// This will disable stretchable items support for wrapable containers, every line width
					// would have to be tracked so stretchable items can work
					if(StretchLines!=null && StretchLines.Count>0)
						StretchItems(StretchLines,StretchLinesISCount,iWidth+m_PaddingRight-m_Rect.Left);
					if(m_Rect.Width<iWidth+m_PaddingRight-m_Rect.Left)
						m_Rect.Width=iWidth+m_PaddingRight-m_Rect.Left;
					//else if(StretchLines!=null && StretchLines.Count>0)
					//	StretchItems(StretchLines,StretchLinesISCount,iWidth+m_PaddingRight-m_Rect.Left);
				}
				else if(m_Orientation==eOrientation.Vertical)
				{
					m_Rect.Width=iWidth+m_PaddingRight-m_Rect.Left;

					if(StretchLines!=null && StretchLines.Count>0)
						StretchItems(StretchLines,StretchLinesISCount,iHeight+m_PaddingBottom-m_Rect.Top);
					// Only if suggested Height is less than our height change it
					if(m_Rect.Height<iHeight+m_PaddingBottom-m_Rect.Top)
						m_Rect.Height=iHeight+m_PaddingBottom-m_Rect.Top;
					//else if(StretchLines!=null && StretchLines.Count>0)
					//	StretchItems(StretchLines,StretchLinesISCount,iHeight+m_PaddingBottom-m_Rect.Top);
				}
				else
				{
					m_Rect.Width=iWidth+m_PaddingRight-m_Rect.Left;
					m_Rect.Height=iHeight+m_PaddingBottom-m_Rect.Top;
				}
			}
			else
			{
				// If all items did not fit and we are not wrapping take suggested sizes
				if(!m_WrapItems && !bDisplayed)
				{
					// Horizontal, just adjust Height, we will honor width
					if(m_Orientation==eOrientation.Horizontal)
						m_Rect.Height=iHeight+m_PaddingBottom-m_Rect.Top;
					else if(m_Orientation==eOrientation.Vertical)
						m_Rect.Width=iWidth+m_PaddingRight-m_Rect.Left;
				}
				else
				{
					// If there are no items take suggested width by container control
					if(m_DisplayedItems>0)
					{
						m_Rect.Width=iWidth+m_PaddingRight-m_Rect.Left;
						m_Rect.Height=iHeight+m_PaddingBottom-m_Rect.Top;
					}
					/*else
					{
						m_Rect.Width=m_PaddingLeft+m_PaddingRight;
						m_Rect.Height=m_PaddingTop+m_PaddingBottom;
					}*/
				}
			}

			// If we don't wrap and there are items left to display
			if(!m_WrapItems && !bDisplayed && m_UseMoreItemsButton)
				CreateMoreItemsButton(isRightToLeft);
			else if(m_MoreItems!=null)
			{
				// Clean up, we don't need this anymore
				m_MoreItems.Dispose();
				m_MoreItems=null;
			}

			// Align Items if needed
			if(FarAlignLines!=null && FarAlignLines.Count>0)
				AlignItemsFar(FarAlignLines);

            if (isRightToLeft && m_Orientation == eOrientation.Horizontal)
                MirrorPositionItems();
			
			m_NeedRecalcSize=false;
			if(m_Parent!=null)
			{
				m_Parent.SubItemSizeChanged(this);
			}
		}
Beispiel #3
0
		private void RecalcSizeTaskList()
		{
			int iX=m_Rect.Left+m_PaddingLeft, iY=m_Rect.Top+m_PaddingTop, iMaxItemWidth=0, iMaxItemHeight=0;
			int iWidth=0, iHeight=0;
			int iGroupLineSize=3;
			bool bDisplayed=true;
			int iDisplayed=0;
			Stack FarAlignItems=null;

            if (EffectiveStyle == eDotNetBarStyle.Office2000)
				iGroupLineSize=6;

			if(m_EqualButtonSize)
			{
				foreach(BaseItem item in m_SubItems)
				{
					item.Orientation=eOrientation.Horizontal;
					item.RecalcSize();
					if(item.WidthInternal>iMaxItemWidth)
						iMaxItemWidth=item.WidthInternal;
					if(item.HeightInternal>iMaxItemHeight)
						iMaxItemHeight=item.HeightInternal;
				}
			}

            for(int iCurrentItem=0;iCurrentItem<m_SubItems.Count;iCurrentItem++)
			{
				BaseItem objItem=m_SubItems[iCurrentItem] as BaseItem;
				objItem.Orientation=eOrientation.Horizontal;
				if(objItem==null || !objItem.Visible)
					continue;

				if(!m_EqualButtonSize)
					objItem.RecalcSize();
				
				if(objItem.BeginGroup && iDisplayed>0)
					iY+=iGroupLineSize;

				if(!m_EqualButtonSize)
				{
					if(objItem.WidthInternal>iMaxItemWidth)
						iMaxItemWidth=objItem.WidthInternal;
					if(objItem.HeightInternal>iMaxItemHeight)
						iMaxItemHeight=objItem.HeightInternal;
				}
				else
				{
					objItem.WidthInternal=iMaxItemWidth;
					objItem.HeightInternal=iMaxItemHeight;
				}

				objItem.TopInternal=iY;
				objItem.LeftInternal=iX;
				iY+=objItem.HeightInternal;
				objItem.Displayed=bDisplayed;
				if(!bDisplayed)
					continue;

				if(iY>m_Rect.Bottom)
				{
					bDisplayed=false;
					FarAlignItems=null;
					objItem.Displayed=false;
					continue;
				}

				if(FarAlignItems!=null && FarAlignItems.Count>0)
					FarAlignItems.Push(objItem);

				iDisplayed++;
				if(objItem.ItemAlignment==eItemAlignment.Far)
				{
					if(FarAlignItems==null)
						FarAlignItems=new Stack(10);
					FarAlignItems.Push(objItem);
				}
			}
			iWidth=iMaxItemWidth+m_PaddingLeft+m_PaddingRight;
			iHeight=iY+m_PaddingBottom-m_Rect.Top;
			m_DisplayedItems=iDisplayed;
			if(this.Stretch)
			{
				if(bDisplayed && FarAlignItems!=null && FarAlignItems.Count>0)
				{
					// We need to move "far" align items to the appropriate position at the bottom
					AlignItemsFar(FarAlignItems, eOrientation.Vertical); // Vertical becouse this is "vertical layout"
				}
				Bar bar=this.ContainerControl as Bar;
				if(bar==null || bar!=null && bar.DockSide!=eDockSide.Top && bar.DockSide!=eDockSide.Bottom)
					m_Rect.Width=iWidth;
				if(m_Rect.Height<iHeight)
				{
					if(m_Rect.Height<36)
						m_Rect.Height=36;
					// We need to scroll content
					m_Scroll=true;
					RepositionItems();
				}
				else
				{
					m_Scroll=false;
					m_ScrollTopPosition=0;
				}
			}
			else
			{
				m_Rect.Width=iWidth;
				if(m_Rect.Height>iHeight && bDisplayed)
					m_Rect.Height=iHeight;
				if(!bDisplayed)
				{
					if(m_Rect.Height<36)
						m_Rect.Height=36;
					// We need to scroll content
					m_Scroll=true;
					RepositionItems();
				}
				else
				{
					m_Scroll=false;
					m_ScrollTopPosition=0;
				}
			}

			if(m_MoreItems!=null)
			{
				m_MoreItems.Dispose();
				m_MoreItems=null;
			}
            
			SetupScrollButtons();
		}
Beispiel #4
0
        protected virtual void CreateMoreItemsButton(bool isRightToLeft)
		{
			if(m_MoreItems==null)
			{
				m_MoreItems=new DisplayMoreItem();
				m_MoreItems.Style=m_Style;
				m_MoreItems.SetParent(this);
				m_MoreItems.ThemeAware=this.ThemeAware;
			}
			if(m_MoreItemsOnMenu)
				m_MoreItems.PopupType=ePopupType.Menu;
			else
                m_MoreItems.PopupType=ePopupType.ToolBar;
			m_MoreItems.Orientation=m_Orientation;
			m_MoreItems.Displayed=true;

			if(m_Orientation==eOrientation.Vertical)
			{
				m_MoreItems.WidthInternal=m_Rect.Width-(m_PaddingLeft+m_PaddingRight);
				m_MoreItems.RecalcSize();
			}
			else
			{
				m_MoreItems.HeightInternal=m_Rect.Height-(m_PaddingTop+m_PaddingBottom);
				m_MoreItems.RecalcSize();
			}

            Point loc = GetMoreItemsLocation(isRightToLeft);
            m_MoreItems.LeftInternal = loc.X;
            m_MoreItems.TopInternal = loc.Y;
		}
Beispiel #5
0
		/// <summary>
		/// Returns copy of DisplayMoreItem item
		/// </summary>
		public override BaseItem Copy()
		{
			DisplayMoreItem objCopy=new DisplayMoreItem();
			this.CopyToItem(objCopy);
			return objCopy;
		}