public IWidget[] GetWidgets()
        {
            var widgets = new IWidget[_dictionary.Values.Count];
            _dictionary.Values.CopyTo(widgets, 0);

            return widgets;
        }
Exemplo n.º 2
0
 private void RemoveWidgetFromList(IWidget widget)
 {
     if (widget.IsVisible)
         widgets.Remove(widget);
     else
         notVisibleWidgets.Remove(widget);
 }
        private static void VerifyLanguageTokens(Dictionary<IWidgetFile, Dictionary<string, MissingResourceInfo>> problems,
		                                       IWidget parent,
		                                       IWidgetFile widget,
		                                       IEnumerable<string> tokens)
        {
            foreach (string token in tokens)
            {
                foreach (string languageName in parent.Languages.Keys)
                {
                    if (parent.Languages[languageName].Keys.Contains(token) == false)
                    {
                        if (!problems.ContainsKey(parent))
                        {
                            problems.Add(parent, new Dictionary<string, MissingResourceInfo>());
                        }
                        problems[parent][languageName] = new MissingResourceInfo
                            {
                                FileName = widget.FileName,
                                LanguageName = languageName,
                                ResourceName = token
                            };
                    }
                }
            }
        }
 public WidgetPanoramaItem(SpriteBatch sb, IWidget button)
 {
     _sb = sb;
     _button = button;
     _centerOffset = new Vector2(sb.GraphicsDevice.Viewport.Width, sb.GraphicsDevice.Viewport.Height)/2f;
     SetDrawOffset(Vector2.Zero);
 }
Exemplo n.º 5
0
 /// <summary>
 /// PopupMenu生成
 /// </summary>
 /// <param name="parent">親</param>
 /// <returns></returns>
 public override int Create(IWidget parent)
 {
     if( !IsAvailable ) {
         this.CreateMotifWidget(Native.Motif.CreateSymbol.XmCreatePopupMenu, parent, ToolkitResources);
     }
     return base.Create (parent);
 }
Exemplo n.º 6
0
 public CamerasTimeline(IWidget widget)
     : base(widget)
 {
     secondsPerPixel = 0.1;
     Accuracy = Constants.TIMELINE_ACCURACY;
     SelectionMode = MultiSelectionMode.MultipleWithModifier;
 }
Exemplo n.º 7
0
            /**
             * Override the AddChild function
             */
            public override void AddChild(IWidget child)
            {
                if (child is Screen)
                {
                    MoSync.Util.RunActionOnMainThreadSync(() =>
                        {
                            mAddChildDelegate = delegate()
                            {
                                if (mPage.Children.Count > 0)
                                {
                                    mPage.Children.RemoveAt(mPage.Children.Count - 1);
                                }

                                mPage.Children.Add((child as Screen).View);
                                Grid.SetColumn(mPage.Children[mPage.Children.Count - 1] as Grid, 0);
                                Grid.SetRow(mPage.Children[mPage.Children.Count - 1] as Grid, 0);

                                ToggleApplicationBar((child as Screen));
                            };

                            MoSyncScreenTransitions.doScreenTransition(mAddChildDelegate, mPushTransitionType);
                        });

                    /**
                     * Manualy add the child to the children array
                     */
                    mChildren.Add(child);
                    (child as Screen).SetParent(this);
                }
            }
Exemplo n.º 8
0
 /// <summary>
 /// Widgetの配列から
 /// </summary>
 /// <param name="tabs">Tab配列</param>
 public WidgetList(IWidget[] tabs)
 {
     widgetList = new List<IWidget>();
     for (int i=0; i < tabs.Length; i++) {
         widgetList.Add(tabs[i]);
     }
 }
Exemplo n.º 9
0
        public TextWidget(IWidget attachedWidget)
        {
            this.attachedWidget = attachedWidget;

            Canvas.SetLeft(this, 0);
            Canvas.SetTop(this, 0);
        }
Exemplo n.º 10
0
        private bool Contains(IWidget widget)
        {
            if (widget == null)
                return false;

            return widgets.Contains(widget) || notVisibleWidgets.Contains(widget);
        }
Exemplo n.º 11
0
 public override int Create( IWidget parent )
 {
     if( !IsAvailable ) {
         this.CreateMotifWidget(Native.Motif.CreateSymbol.XmCreateBulletinBoardDialog, parent, ToolkitResources);
     }
     return base.Create (parent);
 }
Exemplo n.º 12
0
 public PositionTagger(IWidget widget)
     : base(widget)
 {
     Accuracy = VASDrawing.Constants.TAGGER_POINT_SIZE + 3;
     EmitSignals = true;
     SelectionMode = MultiSelectionMode.MultipleWithModifier;
     BackgroundColor = App.Current.Style.PaletteBackground;
 }
Exemplo n.º 13
0
 public CamerasTimeline(IWidget widget)
     : base(widget)
 {
     secondsPerPixel = 0.1;
     Accuracy = VAS.Drawing.Constants.TIMELINE_ACCURACY;
     SelectionMode = MultiSelectionMode.MultipleWithModifier;
     currentTime = new Time (0);
 }
Exemplo n.º 14
0
        public void RemoveWidget(IWidget widget)
        {
            if (!Contains(widget))
                return;

            RemoveWidgetFromList(widget);
            widget.VisibilityChanged -= VisibilityChangedHandler;
        }
        public void can_override_array()
        {
            var array = new IWidget[0];
            container.Inject(array);

            container.GetInstance<IWidget[]>()
                .ShouldBeTheSameAs(array);
        }
Exemplo n.º 16
0
 public TimersTimeline(IWidget widget)
     : base(widget)
 {
     secondsPerPixel = 0.1;
     Accuracy = VASDrawing.Constants.TIMELINE_ACCURACY;
     SelectionMode = MultiSelectionMode.MultipleWithModifier;
     HeightRequest = VASDrawing.Constants.TIMER_HEIGHT;
 }
Exemplo n.º 17
0
 public void Setup(IWidget widget, FlexibleLayoutEditorContext context, IEditorService edsvc)
 {
     _widget = widget;
     _xml = _widget.ToXml();
     _widgetInfo = context.GetWidgetInfo(widget.Type);
     btnWidgetInfo.Enabled = (_widgetInfo != null);
     txtXmlContent.Text = _xml;
 }
Exemplo n.º 18
0
		public void Insert(IWidget widget, int index)
		{
			if(index <= m_ChildWidgets.Count)
			{
				m_ChildWidgets.Insert(index, widget);
			}
			//probably want to throw an indexoutofrange type of exception
		}
Exemplo n.º 19
0
        public WidgetMenuButton(
			string name,
			string iconFilePath,
			IWidget widget) : base(iconFilePath)
		{
			this.Description = name;
            m_widget = widget;
		}
Exemplo n.º 20
0
 public override int Create( IWidget parent )
 {
     if( !IsAvailable ) {
         AddInternalEventHandler();
         this.CreateMotifWidget(Native.Motif.CreateSymbol.XmCreateSimpleOptionMenu, parent, ToolkitResources);
     }
     return base.Create (parent);
 }
Exemplo n.º 21
0
 public WidgetEventDispatcher()
 {
     m_mousePosition = new Point2d();
     m_rootWidgetGroup = null;
     m_mouseOverIWidget = null;
     m_mouseDownIWidget = null;
     m_mouseIsDragging = false;
     m_mouseWasDown = false;
 }
Exemplo n.º 22
0
 public WidgetHash(IWidget widget, IList<String> encodedOptions, IList<WidgetEvent> events, Control targetControl)
 {
     WidgetName = widget.WidgetName;
     WidgetUniqueId = widget.UniqueID;
     TargetControl = targetControl;
     Options = widget.WidgetOptions;
     EncodedOptions = encodedOptions;
     Events = events;
 }
Exemplo n.º 23
0
		public WidgetViewModel(IWidget widget, object data)
		{
			if (widget == null) throw new ArgumentNullException("widget");
			if (data == null) throw new ArgumentNullException("data");
			if ((!data.GetType().IsGenericType) || (data.GetType().GetGenericTypeDefinition() != typeof(WidgetData<>))) throw new ArgumentException("Data should be WidgetData<>.");

			_widget = widget;
			_data = data;
		}
Exemplo n.º 24
0
        /// <summary>
        /// Gets the editor for widget.
        /// </summary>
        /// <param name="widget">The widget.</param>
        /// <param name="context">The context.</param>
        /// <param name="edsvc">The edsvc.</param>
        /// <returns></returns>
        public static IWidgetEditor GetEditorForWidget(IWidget widget, FlexibleLayoutEditorContext context, IEditorService edsvc)
        {
            Check.NotNull(widget, "widget"); //NOXLATE
            Check.NotNull(context, "context"); //NOXLATE
            Check.NotNull(edsvc, "edsvc"); //NOXLATE

            IWidgetEditor ed = new GenericWidgetCtrl();
            ed.Setup(widget, context, edsvc);
            return ed;
        }
Exemplo n.º 25
0
            /**
             * AddChild implementation
             * @param child IWidget the "child" widget that needs to be added
             */
            public override void AddChild(IWidget child)
            {
                base.AddChild(child);
                MoSync.Util.RunActionOnMainThreadSync(() =>
                {
                    WidgetBaseWindowsPhone widget = (child as WidgetBaseWindowsPhone);

                    mPanel.Children.Add(widget.View);
                });
            }
Exemplo n.º 26
0
 public SportDashboardCanvas(IWidget widget)
     : base(widget)
 {
     Accuracy = 5;
     Mode = DashboardMode.Edit;
     FitMode = FitMode.Fit;
     CurrentTime = new Time (0);
     AddTag = new Tag ("", "");
     BackgroundColor = App.Current.Style.PaletteBackground;
 }
Exemplo n.º 27
0
        public PositionTagger(IWidget widget, ProjectLongoMatch project, List<TimelineEventLongoMatch> plays,
		                       Image background, FieldPositionType position)
            : base(widget)
        {
            Project = project;
            Background = background;
            Plays = plays;
            FieldPosition = position;
            BackgroundColor = App.Current.Style.PaletteBackground;
        }
Exemplo n.º 28
0
        /// <summary>
        /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
        /// </summary>
        /// <returns>
        /// true if <paramref name="widget"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. 
        /// This method also returns false if <paramref name="widget"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>.
        /// </returns>
        /// <param name="widget">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
        public bool Remove(IWidget widget)
        {
            var index = InnerList.IndexOf(widget);

            if (index != -1)
            {
                InnerList.RemoveAt(index);
            }

            return index != -1;
        }
Exemplo n.º 29
0
 public PlaysTimeline(IWidget widget)
     : base(widget)
 {
     eventsTimelines = new Dictionary<EventType, CategoryTimeline> ();
     timelineToFilter = new Dictionary<TimelineObject, object> ();
     secondsPerPixel = 0.1;
     Accuracy = Constants.TIMELINE_ACCURACY;
     SelectionMode = MultiSelectionMode.MultipleWithModifier;
     SingleSelectionObjects.Add (typeof(TimerTimeNodeObject));
     currentTime = new Time (0);
 }
Exemplo n.º 30
0
 /**
  * Override the AddChild function
  */
 public override void AddChild(IWidget child)
 {
     MoSync.Util.RunActionOnMainThreadSync(() =>
         {
             mPage.Content = (child as NativeUI.WidgetBaseWindowsPhone).View;
         });
     /**
      * Manualy add the child to the children array
      */
     mChildren.Add(child);
 }
Exemplo n.º 31
0
 public AttributedThing(IWidget widget)
 {
     CorrectCtorWasUsed = true;
 }
Exemplo n.º 32
0
        public void WillUnmount(IWidget widget)
        {
            OnWillUnmount();

            widget.ParentAsNativeControlContainer().RemoveChild(widget, _nativeControl);
        }
Exemplo n.º 33
0
 /*
  * Ads a widget to the widgets array.
  * @param adControl The widget to be added.
  */
 public int AddWidget(IWidget widget)
 {
     mWidgets.Add(widget);
     return(mWidgets.Count - 1);
 }
Exemplo n.º 34
0
 public Wrapper(string key, IWidget child)
 {
     Key   = key;
     Child = child;
 }
Exemplo n.º 35
0
 public ClassWithMultipleConstructors(IGateway gateway, IService service, IWidget widget)
 {
     CtorUsed = "Three Args";
 }
Exemplo n.º 36
0
 public Thing2(IWidget widget) : base(widget)
 {
 }
Exemplo n.º 37
0
 public BaseThing(IWidget widget)
 {
     CorrectCtorWasUsed = true;
 }
 public override void AddChild(IWidget widget, UIElement child)
 {
     _nativeControl.Children.Add(child);
 }
Exemplo n.º 39
0
 public void BindTo(IWidget widget)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 40
0
 public WidgetUserThatOnlyLikesBlue(IWidget widget)
 {
     _widget = widget;
 }
Exemplo n.º 41
0
 public void AddChild(IWidget widget, Framework.UIElement child)
 {
     _nativeControl.Content = child;
     HasContent             = child != null;
 }
Exemplo n.º 42
0
 public void Getter(IWidget widget)
 {
     Console.WriteLine("This Widget has: {0} gears and {1} springs and {2} levers", _gearsCount, _springsCount, _leversCount);
     Console.WriteLine(" ");
 }
Exemplo n.º 43
0
 public ThingThatBlowsUp(IWidget widget)
 {
     throw new DivideByZeroException();
 }
Exemplo n.º 44
0
 public void Update(IWidget widget)
 {
     _widget = (I)widget;
     OnUpdate();
 }
Exemplo n.º 45
0
 public Thing2(IWidget widget, IService service) : base(widget, service)
 {
 }
Exemplo n.º 46
0
 public virtual void RemoveChild(IWidget widget, object child)
 {
     _nativeControl.Children.Remove((UIElement)child);
 }
Exemplo n.º 47
0
 public virtual void AddChild(IWidget widget, object child)
 {
     _nativeControl.Children.Add((UIElement)child);
 }
Exemplo n.º 48
0
 public static void ApplyPropsOnTree(IWidget widgetTree)
 {
     ApplyToTreeFromLeaves(widgetTree, w => w.ApplyProps());
 }
Exemplo n.º 49
0
 public BaseThing(IWidget widget, IService service)
 {
     Assert.True(false, "I should not have been called");
 }
Exemplo n.º 50
0
        public void Init(Ioctls ioctls, Core core, Runtime runtime)
        {
            mNativeUI = new NativeUI.NativeUIWindowsPhone();
            //mWidgets.Add(null); // why?

            ioctls.maWidgetCreate = delegate(int _widgetType)
            {
                String  widgetType = core.GetDataMemory().ReadStringAtAddress(_widgetType);
                IWidget widget     = mNativeUI.CreateWidget(widgetType);
                if (widget == null)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_TYPE_NAME);
                }

                widget.SetRuntime(runtime);

                for (int i = 0; i < mWidgets.Count; i++)
                {
                    if (mWidgets[i] == null)
                    {
                        widget.SetHandle(i);
                        mWidgets[i] = widget;
                        return(i);
                    }
                }

                mWidgets.Add(widget);
                widget.SetHandle(mWidgets.Count - 1);
                return(mWidgets.Count - 1);
            };

            ioctls.maWidgetDestroy = delegate(int _widget)
            {
                if (_widget < 0 || _widget >= mWidgets.Count)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_HANDLE);
                }
                IWidget widget = mWidgets[_widget];
                if (widget != null)
                {
                    widget.RemoveFromParent();
                    mWidgets[_widget] = null;
                }
                return(MoSync.Constants.MAW_RES_OK);
            };

            ioctls.maWidgetAddChild = delegate(int _parent, int _child)
            {
                if (_parent < 0 || _parent >= mWidgets.Count)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_HANDLE);
                }
                IWidget parent = mWidgets[_parent];
                if (_child < 0 || _child >= mWidgets.Count)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_HANDLE);
                }
                IWidget child = mWidgets[_child];
                child.SetParent(parent);
                parent.AddChild(child);
                return(MoSync.Constants.MAW_RES_OK);
            };

            ioctls.maWidgetRemoveChild = delegate(int _child)
            {
                if (_child < 0 || _child >= mWidgets.Count)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_HANDLE);
                }
                IWidget child = mWidgets[_child];
                child.RemoveFromParent();
                return(MoSync.Constants.MAW_RES_OK);
            };

            ioctls.maWidgetInsertChild = delegate(int _parent, int _child, int index)
            {
                if (_parent < 0 || _parent >= mWidgets.Count)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_HANDLE);
                }
                IWidget parent = mWidgets[_parent];
                if (_child < 0 || _child >= mWidgets.Count)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_HANDLE);
                }
                IWidget child = mWidgets[_child];
                parent.InsertChild(child, index);
                return(MoSync.Constants.MAW_RES_OK);
            };

            ioctls.maWidgetStackScreenPush = delegate(int _stackScreen, int _newScreen)
            {
                IScreen stackScreen = (IScreen)mWidgets[_stackScreen];
                IScreen newScreen   = (IScreen)mWidgets[_newScreen];
                (stackScreen as MoSync.NativeUI.StackScreen).Push(newScreen);
                return(MoSync.Constants.MAW_RES_OK);
            };

            ioctls.maWidgetStackScreenPop = delegate(int _stackScreen)
            {
                IScreen stackScreen = (IScreen)mWidgets[_stackScreen];
                (stackScreen as MoSync.NativeUI.StackScreen).Pop();
                return(MoSync.Constants.MAW_RES_OK);
            };

            ioctls.maWidgetSetProperty = delegate(int _widget, int _property, int _value)
            {
                String property = core.GetDataMemory().ReadStringAtAddress(_property);
                String value    = core.GetDataMemory().ReadStringAtAddress(_value);
                if (_widget < 0 || _widget >= mWidgets.Count)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_HANDLE);
                }
                IWidget widget = mWidgets[_widget];
                try
                {
                    widget.SetProperty(property, value);
                }
                catch (InvalidPropertyNameException)
                {
                    MoSync.Util.Log(widget.GetType().ToString() + " invalid property name: " + property);
                    return(MoSync.Constants.MAW_RES_INVALID_PROPERTY_NAME);
                }
                catch (InvalidPropertyValueException e)
                {
                    MoSync.Util.Log(e);
                    return(MoSync.Constants.MAW_RES_INVALID_PROPERTY_VALUE);
                }

                return(MoSync.Constants.MAW_RES_OK);
            };

            ioctls.maWidgetGetProperty = delegate(int _widget, int _property, int _value, int _bufSize)
            {
                String property = core.GetDataMemory().ReadStringAtAddress(_property);
                if (_widget < 0 || _widget >= mWidgets.Count)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_HANDLE);
                }
                IWidget widget = mWidgets[_widget];
                try
                {
                    String value = widget.GetProperty(property);
                    core.GetDataMemory().WriteStringAtAddress(_value, value, _bufSize);
                }
                catch (InvalidPropertyNameException e)
                {
                    MoSync.Util.Log(e);
                    return(MoSync.Constants.MAW_RES_INVALID_PROPERTY_NAME);
                }

                return(MoSync.Constants.MAW_RES_OK);
            };

            ioctls.maWidgetScreenShow = delegate(int _screenHandle)
            {
                if (_screenHandle < 0 || _screenHandle >= mWidgets.Count)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_HANDLE);
                }
                IScreen screen = (IScreen)mWidgets[_screenHandle];
                screen.Show();
                return(MoSync.Constants.MAW_RES_OK);
            };

            /*
             * Implementation for maWidgetScreenAddOptionsMenuItem
             *
             * @param _widget the widget handle
             * @param _title the option menu item title
             * @param _iconPath the option menu item path
             *        Note: if the _iconPredefined param is 1 then the _iconPath
             *              will store a code representing the name of the icon file,
             *              without extension. Otherwise it should contain the name of the
             *              file. (e.g. "applicationBarIcon1.png")
             * @param _iconPredefined if the value is 1 it means that we expect a predefined icon
             *        otherwise it will create the path using the _iconPath as it was previously
             *        explained
             */
            ioctls.maWidgetScreenAddOptionsMenuItem = delegate(int _widget, int _title, int _iconPath, int _iconPredefined)
            {
                //This represents the hardcoded folder name for the application bar icons
                String applicationBarIconsFolder = "/AppBar.Icons/";

                //if _widget < 0 => no screen parent
                if (_widget < 0 || _widget >= mWidgets.Count)
                {
                    return(MoSync.Constants.MAW_RES_INVALID_HANDLE);
                }

                IScreen screen = (IScreen)mWidgets[_widget];

                //Read the icon path
                string iconPath = core.GetDataMemory().ReadStringAtAddress(_iconPath);

                //If the iconPath is not empty and we don't have a predefined icon
                //then we have an ApplicationBarButton object with a given icon and text.
                if (!iconPath.Equals("") && 0 == _iconPredefined && screen.GetApplicationBar().Buttons.Count < 5)
                {
                    //Read the text
                    string buttonText = core.GetDataMemory().ReadStringAtAddress(_title);

                    //Create the native object.
                    Microsoft.Phone.Shell.ApplicationBarIconButton btn = new Microsoft.Phone.Shell.ApplicationBarIconButton();

                    //Create the icon path.
                    btn.IconUri = new Uri(applicationBarIconsFolder + iconPath, UriKind.RelativeOrAbsolute);
                    btn.Text    = buttonText;

                    //Associate an index to the native object.
                    int btnIndex = screen.AddApplicationBarItemIndex(btn);

                    btn.Click += new EventHandler(
                        delegate(object from, EventArgs target)
                    {
                        Memory eventData = new Memory(12);
                        const int MAWidgetEventData_eventType    = 0;
                        const int MAWidgetEventData_widgetHandle = 4;
                        const int MAWidgetEventData_itemIndex    = 8;
                        eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_OPTIONS_MENU_ITEM_SELECTED);
                        eventData.WriteInt32(MAWidgetEventData_widgetHandle, _widget);
                        eventData.WriteInt32(MAWidgetEventData_itemIndex, btnIndex);
                        //Posting a CustomEvent
                        runtime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
                    });

                    screen.GetApplicationBar().Buttons.Add(btn);
                    screen.EnableApplicationBar();
                    return(btnIndex);
                }
                //If the iconPath is not empty and we have a predefined icon
                //then we have an ApplicationBarButton object with a predefined icon and text.
                else if (!iconPath.Equals("") && _iconPredefined > 0 && screen.GetApplicationBar().Buttons.Count < 5)
                {
                    //Read the text.
                    string buttonText = core.GetDataMemory().ReadStringAtAddress(_title);

                    //Create the native object.
                    Microsoft.Phone.Shell.ApplicationBarIconButton btn = new Microsoft.Phone.Shell.ApplicationBarIconButton();

                    //Create the icon path.
                    btn.IconUri = new Uri(applicationBarIconsFolder + iconPath + ".png", UriKind.RelativeOrAbsolute);
                    btn.Text    = buttonText;

                    //Associate an index to the native object.
                    int btnIndex = screen.AddApplicationBarItemIndex(btn);

                    btn.Click += new EventHandler(
                        delegate(object from, EventArgs target)
                    {
                        Memory eventData = new Memory(12);
                        const int MAWidgetEventData_eventType    = 0;
                        const int MAWidgetEventData_widgetHandle = 4;
                        const int MAWidgetEventData_itemIndex    = 8;
                        eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_OPTIONS_MENU_ITEM_SELECTED);
                        eventData.WriteInt32(MAWidgetEventData_widgetHandle, _widget);
                        eventData.WriteInt32(MAWidgetEventData_itemIndex, btnIndex);
                        //Posting a CustomEvent
                        runtime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
                    });

                    screen.GetApplicationBar().Buttons.Add(btn);
                    screen.EnableApplicationBar();

                    //Return the index associated to the item.
                    return(btnIndex);
                }
                //If the iconPath is empty then we have an ApplicationBarMenuItem.
                else
                {
                    //Read the text.
                    string menuItemText = core.GetDataMemory().ReadStringAtAddress(_title);

                    //Create the native object.
                    Microsoft.Phone.Shell.ApplicationBarMenuItem menuItem = new Microsoft.Phone.Shell.ApplicationBarMenuItem();
                    menuItem.Text = menuItemText;

                    //Associate an index to the native object.
                    int menuIndex = screen.AddApplicationBarItemIndex(menuItem);

                    menuItem.Click += new EventHandler(
                        delegate(object from, EventArgs target)
                    {
                        Memory eventData = new Memory(12);
                        const int MAWidgetEventData_eventType    = 0;
                        const int MAWidgetEventData_widgetHandle = 4;
                        const int MAWidgetEventData_itemIndex    = 8;
                        eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_OPTIONS_MENU_ITEM_SELECTED);
                        eventData.WriteInt32(MAWidgetEventData_widgetHandle, _widget);
                        eventData.WriteInt32(MAWidgetEventData_itemIndex, menuIndex);
                        //Posting a CustomEvent
                        runtime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
                    });

                    screen.GetApplicationBar().MenuItems.Add(menuItem);
                    screen.EnableApplicationBar();

                    //Return the index associated to the item.
                    return(menuIndex);
                }
            };
        }
Exemplo n.º 51
0
 public Thingie(IWidget widget)
 {
     CorrectCtorWasUsed = true;
 }
Exemplo n.º 52
0
 public void RemoveChild(IWidget widget, Framework.UIElement child)
 {
     _nativeControl.Content = null;
     HasContent             = false;
 }
Exemplo n.º 53
0
 public void AddWidget(IWidget w)
 {
     collapsible_.Add(w);
 }
Exemplo n.º 54
0
 public FillCanvas(IWidget widget) : base(widget)
 {
 }
Exemplo n.º 55
0
 public ScrollDecorator(IWidget w) : base(w)
 {
 }
Exemplo n.º 56
0
 /// <summary>
 /// Add a widget to this canvas.
 /// </summary>
 public void AddWidget(IWidget widget)
 {
     _widgets.Add(widget);
 }
 public override void RemoveChild(IWidget widget, UIElement child)
 {
     _nativeControl.Children.Remove(child);
 }
Exemplo n.º 58
0
 /// <summary>
 /// Show a widget in the window
 /// </summary>
 /// <param name="id">A unique id for the widget.</param>
 /// <param name="widget">The widget to be displayed in the window.</param>
 /// <param name="pose">Pose of the widget.</param>
 public void ShowWidget(String id, IWidget widget, Affine3d pose = null)
 {
     using (CvString cvsId = new CvString(id))
         CvInvoke.cveViz3dShowWidget(_ptr, cvsId, widget.GetWidget, pose);
 }
Exemplo n.º 59
0
 public Button(IWidget parent, int x, int y, int width, int height) : base(parent, x, y, width, height)
 {
 }
Exemplo n.º 60
0
            /**
             * AddChild function override
             * @param child IWidget the "child" widget that needs to be added
             */
            public override void AddChild(IWidget child)
            {
                base.AddChild(child);
                MoSync.Util.RunActionOnMainThreadSync(() =>
                {
                    // The logic behind this layout system is to create a stack panel for each
                    // MoSync widget. The stack panel is used for wrapping and filling size policies.
                    // When the widget size policy states that it should fill on both horizontal and
                    // vertical axis the stack panel is not used in the structure but added to the
                    // grid for future usage.
                    //
                    // Wrap V & Fill H :
                    //  - column.width (1 x star)
                    //  - row.Height (1 x star)
                    //  - stack panel  (yes)
                    //  - orientation  (vertical)
                    //
                    // Wrap V & Wrap H :
                    //  - column.width (1 x auto)
                    //  - row.Height (1 x star)
                    //  - stack panel  (yes)
                    //  - orientation  (vertical)
                    //
                    // Fill V & Wrap H :
                    //  - column.width (1 x auto)
                    //  - row.Height (1 x star)
                    //  - stack panel  (yes)
                    //  - orientation  (horizontal)
                    //
                    // Fill V & Fill H :
                    //  - column.width (1 x star)
                    //  - row.Height (1 x star)
                    //  - stack panel  (No)
                    //  - orientation  (none)
                    WidgetBaseWindowsPhone widget = (child as WidgetBaseWindowsPhone);
                    ColumnDefinition columnDef    = new ColumnDefinition(); //The column definition for the widget

                    // Adding a new container
                    mStackPanels.Add(new StackPanel());

                    int stackPanelIndex     = mStackPanels.Count - 1;
                    bool stackPanelRequired = true;

                    // The column for the widget has the default GridUnitType set on 1 x Auto
                    // meaning that it will "wrap" around the widget forcing it to wrap around
                    // its content on the horizontal axis
                    columnDef.Width = new System.Windows.GridLength(1, System.Windows.GridUnitType.Auto);

                    if (widget.FILL_SPACE_H) //Fill space Horizontally
                    {
                        // The column for the widget gets the Width value set on 1 x Star
                        // meaning that it will "fill" the space available on the horizontal
                        // axis forcing the widget to do the same
                        columnDef.Width = new System.Windows.GridLength(1, System.Windows.GridUnitType.Star);

                        // FILL_SPACE_V && FILL_SPACE_H
                        if (widget.FILL_SPACE_V)
                        {
                            // If this gets set on false the widget will not get added
                            // to the stack panel container for the time being.
                            stackPanelRequired = false;
                        }
                        // FILL_SPACE_H && WRAP_CONT_V
                        else if (widget.WRAP_CONT_V)
                        {
                            mStackPanels[stackPanelIndex].Orientation = Orientation.Vertical;
                        }
                    }
                    // WRAP_CONT_H
                    else if (widget.WRAP_CONT_H)
                    {
                        mStackPanels[mStackPanels.Count - 1].Orientation = Orientation.Vertical;
                        // WRAP_CONT_V && WRAP_CONT_H
                        if (widget.FILL_SPACE_V)
                        {
                            mStackPanels[mStackPanels.Count - 1].Orientation = Orientation.Horizontal;
                        }
                    }

                    //Adding the children to the visible structure

                    mGrid.ColumnDefinitions.Insert(mGrid.ColumnDefinitions.Count - 1, columnDef);

                    if (stackPanelRequired)
                    {
                        // If the stack panel container is required the widget gets added to that container
                        // and then this goes to the grid. Read above for the logical explanation.
                        mStackPanels[stackPanelIndex].Children.Add((widget.View as System.Windows.FrameworkElement));
                        Grid.SetRow(mStackPanels[stackPanelIndex], 1);
                        Grid.SetColumn(mStackPanels[stackPanelIndex], mGrid.ColumnDefinitions.Count - 2);
                        mGrid.Children.Add(mStackPanels[stackPanelIndex]);
                    }
                    else
                    {
                        // If the stack panel container is not required the widget is added directly
                        // to the grid. Also the stack panel is added to the parent grid for future
                        // posible use. (in case the size policy changes after the child widget
                        // was added to the parent.
                        Grid.SetRow((widget.View as FrameworkElement), 1);
                        Grid.SetColumn(mStackPanels[stackPanelIndex], mGrid.ColumnDefinitions.Count - 2);
                        Grid.SetColumn((widget.View as FrameworkElement), mGrid.ColumnDefinitions.Count - 2);
                        mGrid.Children.Add(widget.View);
                        mGrid.Children.Add(mStackPanels[stackPanelIndex]);
                    }

                    widget.ColumnNumber = mGrid.ColumnDefinitions.Count - 2;
                    widget.RowNumber    = 1;
                });
            }