コード例 #1
0
        public override bool OnClick(UIEvent clickEvent)
        {
            if (!clickEvent.heldDown && Element.MouseWasDown())
            {
                Element.Focus();

                // Move the cursor to the click point:
                int localClickX = clickEvent.clientX - Element.Style.Computed.OffsetLeft + Element.Style.Computed.ScrollLeft;
                int localClickY = clickEvent.clientY - Element.Style.Computed.OffsetTop + Element.Style.Computed.ScrollTop;

                int index = 0;

                if (Element.childNodes.Count > 1)
                {
                    // Note: If it's equal to 1, ele[0] is the cursor.
                    TextElement text = (TextElement)(Element.childNodes[0]);
                    if (text != null)
                    {
                        index = text.LetterIndex(localClickX, localClickY);
                    }
                }

                MoveCursor(index, true);
            }

            base.OnClick(clickEvent);
            clickEvent.stopPropagation();

            return(true);
        }
コード例 #2
0
		public override bool OnClick(UIEvent clickEvent){
			
			// No bubbling:
			clickEvent.stopPropagation();
			
			return true;
		}
コード例 #3
0
        public override bool OnClick(UIEvent clickEvent)
        {
            // No bubbling:
            clickEvent.stopPropagation();

            return(true);
        }
コード例 #4
0
        public override bool OnClick(UIEvent clickEvent)
        {
            base.OnClick(clickEvent);
            clickEvent.stopPropagation();

            return(true);
        }
コード例 #5
0
		public override bool OnClick(UIEvent clickEvent){
			
			// No bubbling:
			clickEvent.stopPropagation();
			
			if(clickEvent.heldDown || Dropdown==null){
				return true;
			}
			
			Dropdown.SetSelected(Element);
			Dropdown.Hide();
			
			return true;
		}
コード例 #6
0
        public override bool OnClick(UIEvent clickEvent)
        {
            // No bubbling:
            clickEvent.stopPropagation();

            if (clickEvent.heldDown || Dropdown == null)
            {
                return(true);
            }

            Dropdown.SetSelected(Element);
            Dropdown.Hide();

            return(true);
        }
コード例 #7
0
		public override bool OnClick(UIEvent clickEvent){
			// Who wants the click? That's the for element:
			Element forElement=GetFor();
			
			if(forElement!=null){
				// Prevent any propagation - we sure don't want it clicking this element again (which may occur if
				// forElement is one of this elements kids and it propagated upwards).
				clickEvent.stopPropagation();
				// Click it:
				forElement.GotClicked(clickEvent);
			}
			// Run this elements onmousedown/up etc.
			base.OnClick(clickEvent);
			
			return true;
		}
コード例 #8
0
        public override bool OnClick(UIEvent clickEvent)
        {
            // Who wants the click? That's the for element:
            Element forElement = GetFor();

            if (forElement != null)
            {
                // Prevent any propagation - we sure don't want it clicking this element again (which may occur if
                // forElement is one of this elements kids and it propagated upwards).
                clickEvent.stopPropagation();
                // Click it:
                forElement.GotClicked(clickEvent);
            }
            // Run this elements onmousedown/up etc.
            base.OnClick(clickEvent);

            return(true);
        }
コード例 #9
0
        public override bool OnClick(UIEvent clickEvent)
        {
            if (!clickEvent.heldDown && Element.MouseWasDown())
            {
                if (Dropped)
                {
                    Hide();
                }
                else
                {
                    Drop();
                }
            }

            base.OnClick(clickEvent);
            clickEvent.stopPropagation();

            return(true);
        }
コード例 #10
0
		public override bool OnClick(UIEvent clickEvent){
			
			if(!clickEvent.heldDown && Element.MouseWasDown()){
				
				if(Dropped){
					Hide();
				}else{
					Drop();
				}
				
			}
			
			base.OnClick(clickEvent);
			clickEvent.stopPropagation();
			
			return true;
		}
コード例 #11
0
ファイル: a.cs プロジェクト: KMarshland/ChildrensHospitalApp
        public override bool OnClick(UIEvent clickEvent)
        {
            base.OnClick(clickEvent);

            if (!clickEvent.heldDown)
            {
                // Time to go to our Href.

                                #if MOBILE || UNITY_METRO
                // First, look for <source> elements.

                // Grab the kids:
                List <Element> kids = Element.childNodes;

                if (kids != null)
                {
                    // For each child, grab it's src value. Favours the most suitable protocol for this platform (e.g. market:// on android).

                    foreach (Element child in kids)
                    {
                        if (child.Tag != "source")
                        {
                            continue;
                        }

                        // Grab the src:
                        string childSrc = child["src"];

                        if (childSrc == null)
                        {
                            continue;
                        }

                        // Get the optional type - it can be Android,W8,IOS,Blackberry:
                        string type = child["type"];

                        if (type != null)
                        {
                            type = type.Trim().ToLower();
                        }

                                                #if UNITY_ANDROID
                        if (type == "android" || childSrc.StartsWith("market:"))
                        {
                            Href = childSrc;
                        }
                                                #elif UNITY_WP8 || UNITY_METRO
                        if (type == "w8" || type == "wp8" || type == "windows" || childSrc.StartsWith("ms-windows-store:"))
                        {
                            Href = childSrc;
                        }
                                                #elif UNITY_IPHONE
                        if (type == "ios" || childSrc.StartsWith("itms:") || childSrc.StartsWith("itms-apps:"))
                        {
                            Href = childSrc;
                        }
                                                #endif
                    }
                }
                                #endif


                if (!string.IsNullOrEmpty(Href))
                {
                    FilePath path = new FilePath(Href, Element.Document.basepath, false);

                    // Do we have a file protocol handler available?
                    FileProtocol fileProtocol = path.Handler;

                    if (fileProtocol != null)
                    {
                        fileProtocol.OnFollowLink(Element, path);
                    }
                }

                clickEvent.stopPropagation();
            }

            return(true);
        }
コード例 #12
0
		public override bool OnClick(UIEvent clickEvent){
			
			base.OnClick(clickEvent);
			clickEvent.stopPropagation();
			
			return true;
		}
コード例 #13
0
		public override bool OnClick(UIEvent clickEvent){
			
			// Did the mouse go up, and was the element clicked down on too?
			if(!clickEvent.heldDown && Element.MouseWasDown()){
				
				// Focus it:
				Element.Focus();
				
				if(Type==InputType.Submit){
					// Find the form and then attempt to submit it.
					FormTag form=Element.form;
					if(form!=null){
						form.submit();
					}
				}else if(IsScrollInput()){
					// Clicked somewhere on a scrollbar:
					// Figure out where the click was, and scroll there.
				}else if(Type==InputType.Radio){
					Select();
				}else if(Type==InputType.Checkbox){
					
					if(Checked){
						Unselect();
					}else{
						Select();
					}
					
				}else if(IsTextInput()){
					// Move the cursor to the click point:
					int localClick=clickEvent.clientX-Element.Style.Computed.OffsetLeft + Element.Style.Computed.ScrollLeft;
					int index=0;
					
					if(Element.childNodes.Count>1){
						// Note: If it's equal to 1, ele[0] is the cursor.
						TextElement text=(TextElement)(Element.childNodes[0]);
						if(text!=null){
							index=text.LetterIndex(localClick);
						}
					}
					
					MoveCursor(index,true);
				}
				
			}
			
			base.OnClick(clickEvent);
			clickEvent.stopPropagation();
			
			return true;
		}
コード例 #14
0
ファイル: a.cs プロジェクト: KMarshland/ChildrensHospitalApp
		public override bool OnClick(UIEvent clickEvent){
			base.OnClick(clickEvent);
			
			if(!clickEvent.heldDown){
				// Time to go to our Href.
				
				#if MOBILE || UNITY_METRO
				
				// First, look for <source> elements.
				
				// Grab the kids:
				List<Element> kids=Element.childNodes;
				
				if(kids!=null){
					// For each child, grab it's src value. Favours the most suitable protocol for this platform (e.g. market:// on android).
					
					foreach(Element child in kids){
						
						if(child.Tag!="source"){
							continue;
						}
						
						// Grab the src:
						string childSrc=child["src"];
						
						if(childSrc==null){
							continue;
						}
						
						// Get the optional type - it can be Android,W8,IOS,Blackberry:
						string type=child["type"];
						
						if(type!=null){
							type=type.Trim().ToLower();
						}
						
						#if UNITY_ANDROID
							
							if(type=="android" || childSrc.StartsWith("market:")){
								
								Href=childSrc;
								
							}
							
						#elif UNITY_WP8 || UNITY_METRO
						
							if(type=="w8" || type=="wp8" || type=="windows" || childSrc.StartsWith("ms-windows-store:")){
								
								Href=childSrc;
								
							}
							
						#elif UNITY_IPHONE
							
							if(type=="ios" || childSrc.StartsWith("itms:") || childSrc.StartsWith("itms-apps:")){
								
								Href=childSrc;
								
							}
							
							
						#endif
						
					}
					
				}
				
				#endif
					
				
				if(!string.IsNullOrEmpty(Href)){
					FilePath path=new FilePath(Href,Element.Document.basepath,false);
					
					// Do we have a file protocol handler available?
					FileProtocol fileProtocol=path.Handler;
					
					if(fileProtocol!=null){
						fileProtocol.OnFollowLink(Element,path);
					}
				}
				
				clickEvent.stopPropagation();
			}
			
			return true;
		}
コード例 #15
0
        public override bool OnClick(UIEvent clickEvent)
        {
            // Did the mouse go up, and was the element clicked down on too?
            if (!clickEvent.heldDown && Element.MouseWasDown())
            {
                // Focus it:
                Element.Focus();

                if (Type == InputType.Submit)
                {
                    // Find the form and then attempt to submit it.
                    FormTag form = Element.form;
                    if (form != null)
                    {
                        form.submit();
                    }
                }
                else if (IsScrollInput())
                {
                    // Clicked somewhere on a scrollbar:
                    // Figure out where the click was, and scroll there.
                }
                else if (Type == InputType.Radio)
                {
                    Select();
                }
                else if (Type == InputType.Checkbox)
                {
                    if (Checked)
                    {
                        Unselect();
                    }
                    else
                    {
                        Select();
                    }
                }
                else if (IsTextInput())
                {
                    // Move the cursor to the click point:
                    int localClick = clickEvent.clientX - Element.Style.Computed.OffsetLeft + Element.Style.Computed.ScrollLeft;
                    int index      = 0;

                    if (Element.childNodes.Count > 1)
                    {
                        // Note: If it's equal to 1, ele[0] is the cursor.
                        TextElement text = (TextElement)(Element.childNodes[0]);
                        if (text != null)
                        {
                            index = text.LetterIndex(localClick);
                        }
                    }

                    MoveCursor(index, true);
                }
            }

            base.OnClick(clickEvent);
            clickEvent.stopPropagation();

            return(true);
        }
コード例 #16
0
		public override bool OnClick(UIEvent clickEvent){
			if(!clickEvent.heldDown && Element.MouseWasDown()){
				Element.Focus();
				
				// Move the cursor to the click point:
				int localClickX=clickEvent.clientX-Element.Style.Computed.OffsetLeft + Element.Style.Computed.ScrollLeft;
				int localClickY=clickEvent.clientY-Element.Style.Computed.OffsetTop + Element.Style.Computed.ScrollTop;
				
				int index=0;
				
				if(Element.childNodes.Count>1){
					// Note: If it's equal to 1, ele[0] is the cursor.
					TextElement text=(TextElement)(Element.childNodes[0]);
					if(text!=null){
						index=text.LetterIndex(localClickX,localClickY);
					}
				}
				
				MoveCursor(index,true);
			}
			
			base.OnClick(clickEvent);
			clickEvent.stopPropagation();
			
			return true;
		}