コード例 #1
0
        /// <summary>
        /// Constructs a <see cref="MainTitleIconControlVWG"/>
        /// </summary>
        public MainTitleIconControlVWG(IControlFactory controlFactory)
        {
            if (controlFactory == null) throw new ArgumentNullException("controlFactory");
            _controlFactory = controlFactory;
            _panel = _controlFactory.CreatePanel();
            ((PanelVWG)_panel).BackgroundImage = @"Images.headergradient.png";
            
            _panel.BackColor = Color.Transparent;
            _panel.Dock = Habanero.Faces.Base.DockStyle.Top;
            
            _panel.Height = 23;
            this.Size = new Size(_panel.Width,_panel.Height);
            _icon = _controlFactory.CreateLabel();
            ((LabelVWG)_icon).BackgroundImage = "";
            _icon.BackColor = Color.Transparent;
            ((LabelVWG)_icon).BackgroundImageLayout = ImageLayout.Center;
            _icon.Dock = Habanero.Faces.Base.DockStyle.Left;
            _icon.Size = new Size(20, 20);

            _title = _controlFactory.CreateLabel();
            _title.Font = new Font("Verdana", 10);
            _title.Dock = Habanero.Faces.Base.DockStyle.Fill;
            _title.BackColor = Color.Transparent;
            _title.TextAlign = ContentAlignment.MiddleLeft;
            _title.ForeColor = Color.White;

            _panel.Controls.Add(_title);
            _panel.Controls.Add(_icon);

            this.Dock = DockStyleVWG.GetDockStyle(DockStyle.Top);
            this.Controls.Add((PanelVWG)_panel);
            this.Height = 23;
        }
コード例 #2
0
		public override void Start()
		{
			base.Start();

			IStack stack = Platform.Current.Create<IStack>();

			cmdShow = Platform.Current.Create<IButton>();
			cmdShow.Text = "Show/Hide";
			cmdShow.Click += CmdShow_Click;
			cmdShow.BackgroundColor = new Color(1, 255, 0, 0);
			cmdShow.FontColor = new Color(1, 255, 255, 255);
			stack.Children.Add(cmdShow);

			lbltext = Platform.Current.Create<ILabel>();
			lbltext.Text = "I'm visible, i want an ice-cream";
			lbltext.Visible = false;
			
			stack.Children.Add(lbltext);

			IButton cmdClose = Platform.Current.Create<IButton>();
			cmdClose.Text = "Close";
			cmdClose.Click += CmdClose_Click;
			stack.Children.Add(cmdClose);

			Platform.Current.Page.Title = "Test label";
			Platform.Current.Page.Content = stack;
		}
コード例 #3
0
		public override void Start()
		{
			base.Start();

			IStack stack = Platform.Current.Create<IStack>();

			lblLabel = Platform.Current.Create<ILabel>();
			lblLabel.Text = "Select 1 day";
			lblLabel.Height = 30;
			stack.Children.Add(lblLabel);

			calendar = Platform.Current.Create<ICalendar>();
			calendar.Name = "calendar";
			//calendar.BackgroundColor = new Color(1,0,0,255);
			calendar.Bold = true;
			stack.Children.Add(calendar);

			IButton cmdChange = Platform.Current.Create<IButton>();
			cmdChange.Text = "Change";
			cmdChange.Click += CmdChange_Click;
			stack.Children.Add(cmdChange);

			IButton cmdClose = Platform.Current.Create<IButton>();
			cmdClose.Text = "Close";
			cmdClose.Click += CmdClose_Click;
			stack.Children.Add(cmdClose);

			Platform.Current.Page.Title = "Test label";
			Platform.Current.Page.Content = stack;
		}
コード例 #4
0
 /// <summary>
 /// Learns from the given example.
 /// </summary>
 /// <param name="example">The example to learn.</param>
 /// <param name="label">The label for this <paramref name="example"/>.</param>
 public void Learn(object example, ILabel label)
 {
     using (var ex = GetOrCreateSerializer(example.GetType()).Serialize(example, label))
     {
         this.vw.Learn(ex);
     }
 }
コード例 #5
0
        ///<summary>
        /// Constructor for <see cref="CollapsiblePanelManager"/>
        ///</summary>
        ///<param name="collapsiblePanel"></param>
        ///<param name="controlFactory"></param>
        public CollapsiblePanelManager(ICollapsiblePanel collapsiblePanel, IControlFactory controlFactory)
        {
            _controlFactory = controlFactory;
            _collapsiblePanel = collapsiblePanel;
            _collapseButton = _controlFactory.CreateButtonCollapsibleStyle();


            _collapseButton.Click += delegate { Collapsed = !Collapsed; };
            _pinLabel = controlFactory.CreateLabelPinOffStyle();
            _pinLabel.Click += delegate { Pinned = !Pinned; };

            IPanel buttonPanel = _controlFactory.CreatePanel();
            BorderLayoutManager buttonLayoutManager =
                _controlFactory.CreateBorderLayoutManager(buttonPanel);
            buttonPanel.Height = _collapseButton.Height;

            buttonLayoutManager.AddControl(_collapseButton, BorderLayoutManager.Position.Centre);
            buttonLayoutManager.AddControl(_pinLabel, BorderLayoutManager.Position.East);

            _layoutManager = _controlFactory.CreateBorderLayoutManager(collapsiblePanel);
            _layoutManager.AddControl(buttonPanel, BorderLayoutManager.Position.North);


            _collapseButton.BackColor = System.Drawing.Color.Transparent;
            _collapseButton.ForeColor = System.Drawing.Color.Transparent;
        }
コード例 #6
0
		/// <summary>
		/// Start this instance.
		/// <para xml:lang="es">
		/// Inicia la instancia del boton.
		/// </para>
		/// </summary>
		public override void Start()
		{
			base.Start();

			// Create an stack
			IStack stack = Platform.Current.Create<IStack>();

			// Creates the button with text, size and specific color, with the event also click and adds it to the stack
			cmdShow = Platform.Current.Create<IButton>();
			cmdShow.Text = "Show/Hide";
			cmdShow.Click += CmdShow_Click;
			cmdShow.BackgroundColor = new Color(1, 255, 0, 0);
			cmdShow.FontColor = new Color(1, 255, 255, 255);
			stack.Children.Add(cmdShow);

			// Create an Label with text specific, not visible and adds it to the stack
			lbltext = Platform.Current.Create<ILabel>();
			lbltext.Text = "I'm visible, i want an ice-cream";
			lbltext.Visible = false;
			stack.Children.Add(lbltext);

			// Create another button with a specific text with your event click and adds it to the stack
			IButton cmdClose = Platform.Current.Create<IButton>();
			cmdClose.Text = "Close";
			cmdClose.Click += CmdClose_Click;
			stack.Children.Add(cmdClose);

			// Establishes the content and title of the page
			Platform.Current.Page.Title = "Test label";
			Platform.Current.Page.Content = stack;
		}
コード例 #7
0
		/// <summary>
		/// Start this instance.
		/// <para xml:lang="es">
		/// Inicia la instancia del objeto Calendar.
		/// </para>
		/// </summary>
		public override void Start()
		{
			base.Start();

			// Create an Stack
			IStack stack = Platform.Current.Create<IStack>();

			// Creates an Label with text and a specific size and adds it to the stack.
			lblLabel = Platform.Current.Create<ILabel>();
			lblLabel.Text = "Select 1 day";
			lblLabel.Height = 30;
			stack.Children.Add(lblLabel);

			// Creates an Calendar with text specific and adds it to the stack.
			calendar = Platform.Current.Create<ICalendar>();
			calendar.Name = "calendar";
			calendar.Bold = true;
			stack.Children.Add(calendar);

			// Creates the Button cmdChange with text specific, with the event also click and adds it to the stack.
			IButton cmdChange = Platform.Current.Create<IButton>();
			cmdChange.Text = "Change";
			cmdChange.Click += CmdChange_Click;
			stack.Children.Add(cmdChange);

			// Creates the Button cmdClose with text specific, with the event also click and adds it to the stack.
			IButton cmdClose = Platform.Current.Create<IButton>();
			cmdClose.Text = "Close";
			cmdClose.Click += CmdClose_Click;
			stack.Children.Add(cmdClose);

			// Establishes the content and title of the page
			Platform.Current.Page.Title = "Test label";
			Platform.Current.Page.Content = stack;
		}
コード例 #8
0
 /// <summary>
 /// Learns from the given example.
 /// </summary>
 /// <param name="example">The example to learn.</param>
 /// <param name="label">The optional label for this <paramref name="example"/>.</param>
 /// <param name="index">The optional index of the example, the <paramref name="label"/> should be attributed to.</param>
 public void Learn(object example, ILabel label = null, int? index = null)
 {
     using (var ex = GetOrCreateSerializer(example.GetType()).Serialize(example, label, index))
     {
         ex.Learn();
     }
 }
コード例 #9
0
		/// <summary>
		/// Start this instance.
		/// <para xml:lang="es">
		/// Inicia la instancia del objeto CheckBox.
		/// </para>
		/// </summary>
		public override void Start()
		{
			base.Start();

			// Create a Stack
			IStack stack = Platform.Current.Create<IStack>();

			// Creates an Label with text and a specific size and adds it to the stack.
			lblLabel = Platform.Current.Create<ILabel>();
			lblLabel.Text = "Click on the checkbox";
			lblLabel.Height = 30;
			stack.Children.Add(lblLabel);

			// Creates an CheckBox selected with the event also click and adds it to the stack.
			checkBox = Platform.Current.Create<ICheckBox>();
			checkBox.Value = true;
			checkBox.ValueChanged += checkBox_ValueChanged;
			stack.Children.Add(checkBox);

			// Creates the Button cmdClose with text specific, with the event also click and adds it to the stack.
			IButton cmdClose = Platform.Current.Create<IButton>();
			cmdClose.Text = "Close";
			cmdClose.Click += CmdClose_Click;
			stack.Children.Add(cmdClose);

			// Establishes the content and title of the page
			Platform.Current.Page.Title = "Test checkbox";
			Platform.Current.Page.Content = stack;
		}
コード例 #10
0
        public UnnamedConcreteDependency(ILabel regent, int regentIndex, ILabel dependent, int dependentIndex) :
            base(regent, dependent)
        {

            headIndex = regentIndex;
            depIndex = dependentIndex;
        }
コード例 #11
0
        /// <summary>
        /// Constructs a <see cref="MainTitleIconControlWin"/>
        /// </summary>
        public MainTitleIconControlWin(IControlFactory controlFactory)
        {
            if (controlFactory == null) throw new ArgumentNullException("controlFactory");
            _controlFactory = controlFactory;
            _panel = _controlFactory.CreatePanel();
            ((PanelWin)_panel).BackgroundImage = CollapsiblePanelResource.headergradient;
            _panel.BackColor = Color.Transparent;
            _panel.Dock = Habanero.Faces.Base.DockStyle.Top;

            _panel.Height = 23;

            _icon = _controlFactory.CreateLabel();
            ((LabelWin)_icon).BackgroundImage = CollapsiblePanelResource.headergradient;
            _icon.BackColor = Color.Transparent;
            ((LabelWin)_icon).BackgroundImageLayout = ImageLayout.Center;
            _icon.Dock = Habanero.Faces.Base.DockStyle.Left;
            _icon.Size = new Size(20, 20);

            _title = _controlFactory.CreateLabel();
            _title.Dock = Habanero.Faces.Base.DockStyle.Fill;
            _title.BackColor = Color.Transparent;
            _title.TextAlign = ContentAlignment.MiddleLeft;
            _title.ForeColor = Color.White;

            _panel.Controls.Add(_title);
            _panel.Controls.Add(_icon);
            _panel.MaximumSize = new Size(2000, 23);
            this.Dock = DockStyleWin.GetDockStyle(DockStyle.Top);
            this.Controls.Add((PanelWin)_panel);
            this.Height = 23;
        }
コード例 #12
0
ファイル: LabelShape.cs プロジェクト: zyouhua/nvwa
 public LabelShape()
 {
     mRectShapes = new List<RectShape>();
     mPullPoint = new Point2I(default(int), default(int));
     mLabelStream = null;
     mLabel = null;
 }
コード例 #13
0
 /// <summary>
 /// Parses the example.
 /// </summary>
 /// <param name="json">The example to parse.</param>
 /// <param name="label">
 /// Optional label, taking precedence over "_label" property found in <paramref name="json"/>.
 /// If null, <paramref name="json"/> will be inspected and the "_label" property used as label.
 /// </param>
 /// <returns>The VowpalWabbit native example.</returns>
 public VowpalWabbitExample Parse(string json, ILabel label = null)
 {
     using (var textReader = new JsonTextReader(new StringReader(json)))
     {
         return this.Parse(textReader, label);
     }
 }
コード例 #14
0
		public override void Start()
		{
			base.Start();

			IStack stack = Platform.Current.Create<IStack>();

			lblLabel = Platform.Current.Create<ILabel>();
			lblLabel.Text = "This is a label";
			lblLabel.Height = 30;
			stack.Children.Add(lblLabel);

			cbxColor = Platform.Current.Create<ICheckBox>();
			cbxColor.Name = "color";
			cbxColor.Value = true;
			stack.Children.Add(cbxColor);

			IButton cmdChange = Platform.Current.Create<IButton>();
			cmdChange.Text = "Change";
			cmdChange.Click += CmdChange_Click;
			stack.Children.Add(cmdChange);

			IButton cmdClose = Platform.Current.Create<IButton>();
			cmdClose.Text = "Close";
			cmdClose.Click += CmdClose_Click;
			stack.Children.Add(cmdClose);

			Platform.Current.Page.Title = "Test label";
			Platform.Current.Page.Content = stack;
		}
コード例 #15
0
ファイル: TaggedWord.cs プロジェクト: gblosser/OpenNlp
 /// <summary>
 /// Create a new <code>TaggedWord</code>.
 /// </summary>
 /// <param name="oldLabel">
 /// A Label.  If it implements the HasWord and/or HasTag interface, then the corresponding value will be set
 /// </param>
 public TaggedWord(ILabel oldLabel) : base(oldLabel.Value())
 {
     if (oldLabel is IHasTag)
     {
         this.vTag = ((IHasTag) oldLabel).Tag();
     }
 }
コード例 #16
0
ファイル: LabelState.cs プロジェクト: mdjabirov/C1Decompiled
        public LabelState(ILabel label)
        {
            Point = label.Point; Position = label.Position; Size = label.Size;
              IsVisible = label.IsVisible; IsMovable = label.IsMovable; PlotCenter = label.PlotCenter;

              if (label is LabelState)
            Energy = ((LabelState)label).Energy;
        }
コード例 #17
0
 public void Validate(string line, string json, IVowpalWabbitLabelComparator labelComparator = null, ILabel label = null)
 {
     using (var jsonSerializer = new VowpalWabbitJsonSerializer(this.vw))
     using (var jsonExample = jsonSerializer.ParseAndCreate(json, label))
     {
         this.Validate(line, jsonExample, labelComparator, label);
     }
 }
コード例 #18
0
ファイル: HotspotLabel.cs プロジェクト: tzachshabtay/MonoAGS
		public HotspotLabel(IGame game, ILabel label)
		{
			_label = label;
			_events = game.Events;
			_input = game.Input;
			_state = game.State;
			_game = game;
		}
コード例 #19
0
ファイル: LabelShape.cs プロジェクト: zyouhua/weilai
 public LabelShape()
 {
     mRectShapes = new List<RectShape>();
     mPullPoint = new Point2I(default(int), default(int));
     mPullState = PullState_.mNone_;
     mMoveState = MoveState_.mNone_;
     mLabelStream = null;
     mLabel = null;
 }
コード例 #20
0
        internal static bool Intersect(ILabel label1, ILabel label2)
        {
            var rect1 = label1.RectFromLabel();

              var rect2 = label2.RectFromLabel();
              rect1.Intersect(rect2);

              return (!rect1.IsEmpty);
        }
コード例 #21
0
 public LabelViewModel(ILabel model, MainViewModel main)
     : base(main)
 {
     if (model == null)
         throw new ArgumentNullException("model");
     this.model = model;
     main.RegisterViewModel(model, this);
     LoadViewModels();
 }
コード例 #22
0
ファイル: StringLabel.cs プロジェクト: gblosser/OpenNlp
 /// <summary>
 /// Create a new <code>StringLabel</code> with the
 /// <code>value()</code> of another label as its label.
 /// </summary>
 /// <param name="label">The other label</param>
 public StringLabel(ILabel label)
 {
     this.str = label.Value();
     if (label is IHasOffset)
     {
         var ofs = (IHasOffset) label;
         SetBeginPosition(ofs.BeginPosition());
         SetEndPosition(ofs.EndPosition());
     }
 }
コード例 #23
0
        public GenericGridFilterControlWin(IGridBase grid)
        {
            var ds = grid.DataSource as DataView;
            if (ds != null) this._originalView = ds;
            (grid as DataGridView).DataSourceChanged += this.DataSourceChanged;

            this._lastForcedEvents = DateTime.Now;
            this.Grid = grid;
            this._timer = new Timer()
            {
                Enabled = true,
                Interval = 500,
            };
            this._timer.Tick += (sender, e) => 
            {
                if ((this._filterRequired) && (this._lastFilterChanged.AddMilliseconds(this._timer.Interval) < DateTime.Now))
                {
                    if (this._inFilter)
                        this._cancelCurrentFilter = true;
                    this._filterRequired = false;
                    this.DoFilter();
                }
            };

            var factory = new ControlFactoryWin();
            this._filterLabel = factory.CreateLabel("Filter:");
            this._filterTextBox = factory.CreateTextBox();
            var txt = this._filterTextBox as TextBox;
            txt.TextChanged += (sender, e) =>
                {
                    if (txt.Text == this._lastFilterText) return;
                    this._lastFilterChanged = DateTime.Now;
                    this._filterRequired = true;
                };
            var manager = factory.CreateBorderLayoutManager(this);
            manager.AddControl(this._filterLabel, BorderLayoutManager.Position.West);
            manager.AddControl(this._filterTextBox, BorderLayoutManager.Position.Centre);
            var vgap = manager.VerticalGapSize + manager.BorderSize;
            this.Height = this._filterTextBox.Height + 2 * vgap;

            this.FilterStarted += (sender, e) =>
                {
                    this.SetUIState(true);
                };
            this.FilterCompleted += (sender, e) =>
                {
                    this.SetUIState(false);
                };
            var wingrid = Grid as DataGridView;
            if (wingrid != null)
            {
                this._gridOriginalAlternatingStyle = wingrid.AlternatingRowsDefaultCellStyle;
                wingrid.AlternatingRowsDefaultCellStyleChanged += this.RecordGridAltStyle;
            }
        }
コード例 #24
0
 public virtual ILabel NewLabel(ILabel oldLabel)
 {
     if (oldLabel is IHasTag)
     {
         return new WordTag(oldLabel.Value(), ((IHasTag)oldLabel).Tag());
     }
     else
     {
         return new WordTag(oldLabel.Value());
     }
 }
コード例 #25
0
 public LabelViewModel GetViewModel(ILabel model)
 {
     LabelViewModel vm;
     if (labelViewModels.ContainsKey(model.ID))
     {
         vm = labelViewModels[model.ID];
         vm.Model = model;
     }
     else
     {
         vm = new LabelViewModel(model, this);
     }
     return vm;
 }
コード例 #26
0
        public void Validate(string line, string json, IVowpalWabbitLabelComparator labelComparator = null, ILabel label = null)
        {
            using (var strExample = this.vw.ParseLine(line))
            using (var jsonSerializer = new VowpalWabbitJsonSerializer(this.vw))
            using (var jsonExample = (VowpalWabbitSingleLineExampleCollection)jsonSerializer.ParseAndCreate(json, label))
            using (var strJsonExample = this.vw.ParseLine(jsonExample.Example.VowpalWabbitString))
            {
                var diff = strExample.Diff(this.vw, jsonExample.Example, labelComparator);
                Assert.IsNull(diff, diff + " generated string: '" + jsonExample.Example.VowpalWabbitString + "'");

                diff = strExample.Diff(this.vw, strJsonExample, labelComparator);
                Assert.IsNull(diff, diff);
            }
        }
コード例 #27
0
		//Parameter names for speakOption and showOnce are used in the factory, changing the names requires factory code change as well
		public AGSDialogOption(IDialogActions actions, ICharacter player, ILabel label, bool exitDialogOnFinish = false, 
                               bool speakOption = true, bool showOnce = false, ITextConfig hoverConfig = null, ITextConfig hasBeenChosenConfig = null)
		{
			_actions = actions;
			_player = player;
			Label = label;
			_normalConfig = label.TextConfig;
			HoverConfig = hoverConfig;
            HasBeenChosenConfig = hasBeenChosenConfig;
			ExitDialogWhenFinished = exitDialogOnFinish;
			SpeakOption = speakOption;
			ShowOnce = showOnce;
			label.MouseEnter.Subscribe(onMouseEnter);
			label.MouseLeave.Subscribe(onMouseLeave);
		}
コード例 #28
0
        public void Validate(string[] lines, string json, IVowpalWabbitLabelComparator labelComparator = null, ILabel label = null, int? index = null, VowpalWabbitJsonExtension extension = null)
        {
            VowpalWabbitExample[] strExamples = new VowpalWabbitExample[lines.Count()];

            try
            {
                for (int i = 0; i < lines.Length; i++)
                    strExamples[i] = this.vw.ParseLine(lines[i]);

                using (var jsonSerializer = new VowpalWabbitJsonSerializer(this.vw))
                {
                    if (extension != null)
                        jsonSerializer.RegisterExtension(extension);

                    using (var jsonExample = (VowpalWabbitMultiLineExampleCollection)jsonSerializer.ParseAndCreate(json, label, index))
                    {
                        var jsonExamples = new List<VowpalWabbitExample>();

                        if (jsonExample.SharedExample != null)
                            jsonExamples.Add(jsonExample.SharedExample);

                        jsonExamples.AddRange(jsonExample.Examples);

                        Assert.AreEqual(strExamples.Length, jsonExamples.Count);

                        for (int i = 0; i < strExamples.Length; i++)
                        {
                            using (var strJsonExample = this.vw.ParseLine(jsonExamples[i].VowpalWabbitString))
                            {
                                var diff = strExamples[i].Diff(this.vw, jsonExamples[i], labelComparator);
                                Assert.IsNull(diff, diff + " generated string: '" + jsonExamples[i].VowpalWabbitString + "'");

                                diff = strExamples[i].Diff(this.vw, strJsonExample, labelComparator);
                                Assert.IsNull(diff, diff);
                            }
                        }
                    }
                }
            }
            finally
            {
                foreach (var ex in strExamples)
                    if (ex != null)
                        ex.Dispose();
            }
        }
コード例 #29
0
        public void Validate(string line, VowpalWabbitExampleCollection example, IVowpalWabbitLabelComparator labelComparator = null, ILabel label = null)
        {
            Assert.IsNotNull(example);

            var jsonExample = example as VowpalWabbitSingleLineExampleCollection;
            Assert.IsNotNull(jsonExample);

            using (var strExample = this.vw.ParseLine(line))
            using (var strJsonExample = this.vw.ParseLine(jsonExample.Example.VowpalWabbitString))
            {
                var diff = strExample.Diff(this.vw, jsonExample.Example, labelComparator);
                Assert.IsNull(diff, diff + " generated string: '" + jsonExample.VowpalWabbitString + "'");

                diff = strExample.Diff(this.vw, strJsonExample, labelComparator);
                Assert.IsNull(diff, diff);
            }
        }
コード例 #30
0
        public override void Init(IEntity entity)
        {
            base.Init(entity);
            _textComponent = entity.GetComponent<ITextComponent>();
            _imageComponent = entity.GetComponent<IImageComponent>();
            _uiEvents = entity.GetComponent<IUIEvents>();
            _tree = entity.GetComponent<IInObjectTree>();
            _room = entity.GetComponent<IHasRoom>();

            _caretFlashCounter = (int)CaretFlashDelay;
            _withCaret = _game.Factory.UI.GetLabel(entity.ID + " Caret", "|", 1f, 1f, 0f, 0f, new AGSTextConfig(autoFit: AutoFit.LabelShouldFitText));
            _withCaret.Anchor = new PointF(0f, 0f);

            _game.Events.OnBeforeRender.Subscribe(onBeforeRender);
            _uiEvents.MouseDown.Subscribe(onMouseDown);
            _uiEvents.LostFocus.Subscribe(onMouseDownOutside);
        }
コード例 #31
0
 /// <summary>
 /// Create a new <code>Dependency</code>.
 /// </summary>
 public IDependency <ILabel, ILabel, Object> NewDependency(ILabel regent, ILabel dependent)
 {
     return(NewDependency(regent, dependent, null));
 }
コード例 #32
0
 /// <inheritdoc />
 protected override bool IsHit(IInputModeContext context, PointD location, ILabel label)
 {
     return(Style.Renderer.GetHitTestable(label, Style).IsHit(context, location));
 }
コード例 #33
0
 /// <summary>
 /// Create a new <code>Dependency</code>.
 /// </summary>
 public IDependency <ILabel, ILabel, Object> NewDependency(ILabel regent, ILabel dependent, Object name)
 {
     return(new UnnamedDependency(regent, dependent));
 }
コード例 #34
0
ファイル: TextBlockExtensions.cs プロジェクト: Myzzx666/maui
 public static void UpdatePadding(this TextBlock nativeControl, ILabel label) =>
 nativeControl.UpdateProperty(TextBlock.PaddingProperty, label.Padding.ToNative());
コード例 #35
0
 public Constituent NewConstituent(int start, int end, ILabel label, double score)
 {
     return(new SimpleConstituent(start, end));
 }
コード例 #36
0
 /// <inheritdoc />
 protected override Visual UpdateVisual(IRenderContext context, Visual oldVisual, ILabel label)
 {
     return(Style.Renderer.GetVisualCreator(label, Style).UpdateVisual(context, oldVisual));
 }
コード例 #37
0
 /// <inheritdoc />
 protected override Visual CreateVisual(IRenderContext context, ILabel label)
 {
     return(Style.Renderer.GetVisualCreator(label, Style).CreateVisual(context));
 }
コード例 #38
0
 protected override SizeD GetPreferredSize(ILabel label)
 {
     // delegate preferred size calculation to wrapped renderer
     return(wrapped.Renderer.GetPreferredSize(label, wrapped));
 }
コード例 #39
0
 protected override RectD GetBounds(ICanvasContext context, ILabel label)
 {
     return(wrapped.Renderer.GetBoundsProvider(label, wrapped).GetBounds(context));
 }
コード例 #40
0
 /// <summary>
 /// Create a new leaf node with the given label
 /// </summary>
 /// <param name="label">the label for the leaf node</param>
 /// <returns>A new tree leaf</returns>
 public override Tree NewLeaf(ILabel label)
 {
     return(new LabeledScoredTreeNode(_lf.NewLabel(label)));
 }
コード例 #41
0
 /// <summary>
 /// Create a new non-leaf tree node with the given label
 /// </summary>
 /// <param name="parentLabel">The label for the node</param>
 /// <param name="children">
 /// A <code>List</code> of the children of this node,
 /// each of which should itself be a <code>LabeledScoredTree</code>
 /// </param>
 /// <returns>A new internal tree node</returns>
 public override Tree NewTreeNode(ILabel parentLabel, List <Tree> children)
 {
     return(new LabeledScoredTreeNode(_lf.NewLabel(parentLabel), children));
 }
コード例 #42
0
 public User(ILabel label)
 {
     Name       = label.Name;
     UserImages = new HashSet <UserImage>();
 }
コード例 #43
0
 /// <summary>
 /// Adds <see cref="IOptionItem"/>s that are bound to the label's <see cref="ILabel.LayoutParameter"/>
 /// and the associated <see cref="ILabelModelParameter.Model"/>.
 /// property to the builder.
 /// </summary>
 /// <param name="context">The context to use for building.</param>
 /// <param name="label">The current label instance.</param>
 protected virtual void AddLabelLayoutParameterItems(IOptionBuilderContext context, ILabel label)
 {
     if (label.LayoutParameter != null)
     {
         IOptionBuilder modelBuilder = GetLabelModelOptionBuilder(context, label.LayoutParameter.Model);
         if (modelBuilder != null)
         {
             modelBuilder.AddItems(context.CreateChildContext("Model"), label.LayoutParameter.Model.GetType(), label.LayoutParameter.Model);
         }
     }
 }
コード例 #44
0
 /// <summary>
 /// Calculates the preferred size for the given label if this style is used for the rendering.
 /// </summary>
 /// <remarks>
 /// The size is calculated from the label's text.
 /// </remarks>
 protected override SizeD GetPreferredSize(ILabel label)
 {
     return(new SizeD(80, 15));
 }
コード例 #45
0
 public PageHeaderEditLabelHelper(SimpleLabel label, ICanvasObject labelCanvasObject)
 {
     this.label             = label;
     this.labelCanvasObject = labelCanvasObject;
 }
コード例 #46
0
 protected override bool IsVisible(ICanvasContext context, RectD rectangle, ILabel label)
 {
     return(wrapped.Renderer.GetVisibilityTestable(label, wrapped).IsVisible(context, rectangle));
 }
コード例 #47
0
 public PageHeaderVisualCreator(ILabel label)
 {
     this.label = label;
 }
コード例 #48
0
 public static Rect RectFromLabel(this ILabel label)
 {
     return(new Rect(label.Position, label.Size));
 }
コード例 #49
0
            private void ConfigureTextEditorInputMode(IInputModeContext context, TextEditorInputMode mode, ILabel label)
            {
                var oldBackground = mode.TextBox.BackColor;
                var oldVisual     = labelCanvasObject.Visible;

                // We know that this label helper is only used once this demo is properly set up.
                var graphEditorInputMode = (GraphEditorInputMode)context.CanvasControl.InputMode;
                var textEditorInputMode  = ((LabelEditingForm.DemoTextEditorInputMode)graphEditorInputMode.TextEditorInputMode);

                mode.TextBox.BackColor = Color.White;
                var oldFont = mode.TextBox.Font;

                mode.TextBox.Font = new Font(oldFont.FontFamily, 20, oldFont.Style);

                // Make sure that the text box location matches the one of the zoom invariant page header label
                textEditorInputMode.ShowInViewCoordinates = true;
                mode.Location = new DynamicViewPoint((GraphControl)context.CanvasControl, 5, 35);
                mode.Anchor   = new PointD(0, 1);

                // Hide this label during editing if the corresponding setting is enabled.
                // This is only necessary since this label is not part of the graph.
                if (graphEditorInputMode.HideLabelDuringEditing)
                {
                    labelCanvasObject.Visible = false;
                    context.CanvasControl.Invalidate();
                }

                // Restore after editing
                EventHandler <TextEventArgs> afterEditing = null;

                afterEditing = delegate {
                    labelCanvasObject.Visible = oldVisual;
                    mode.TextBox.BackColor    = oldBackground;
                    mode.TextBox.Font         = oldFont;
                    context.CanvasControl.Invalidate();
                    mode.TextEdited      -= afterEditing;
                    mode.EditingCanceled -= afterEditing;
                };
                mode.TextEdited      += afterEditing;
                mode.EditingCanceled += afterEditing;
            }
コード例 #50
0
        protected override VisualGroup UpdateVisual(IRenderContext context, VisualGroup oldVisual, ILabel label)
        {
            var labelLayout = label.GetLayout();
            var container   = oldVisual;
            // update wrapped visual
            var wrappedVisual = wrapped.Renderer.GetVisualCreator(label, wrapped).UpdateVisual(context, container.Children[0]);

            // set new child only if wrapped visual instance has been switched
            if (container.Children[0] != wrappedVisual)
            {
                container.Children[0] = wrappedVisual;
            }
            VisualGroup innerContainer = (VisualGroup)container.Children[1];
            // update visual decorators
            Line decorator1 = (Line)innerContainer.Children[0];
            Line decorator2 = (Line)innerContainer.Children[1];

            decorator1.X2 = labelLayout.Width;
            decorator2.Y1 = labelLayout.Height;
            decorator2.X2 = labelLayout.Width;
            decorator2.Y2 = labelLayout.Height;
            // arrange inner container
            ArrangeByLayout(context, innerContainer, labelLayout, false);

            return(container);
        }
コード例 #51
0
ファイル: TextBlockExtensions.cs プロジェクト: Myzzx666/maui
 public static void UpdateCharacterSpacing(this TextBlock nativeControl, ILabel label)
 {
     nativeControl.CharacterSpacing = label.CharacterSpacing.ToEm();
 }
コード例 #52
0
 protected override object Lookup(ILabel label, Type type)
 {
     return(wrapped.Renderer.GetContext(label, wrapped).Lookup(type));
 }
コード例 #53
0
 /// <summary>Create a new <code>TaggedWord</code>.</summary>
 /// <param name="word">This word is passed to the supertype constructor</param>
 /// <param name="tag">
 /// The <code>value()</code> of this label is set as the
 /// tag of this Label
 /// </param>
 public TaggedWord(ILabel word, ILabel tag)
     : base(word)
 {
     this.tag = tag.Value();
 }
コード例 #54
0
        /// <summary>
        /// Re-renders the label using the old visual for performance reasons.
        /// </summary>
        protected override VisualGroup UpdateVisual(IRenderContext context, VisualGroup oldVisual, ILabel label)
        {
            // get the data with which the old visual was created
            RenderDataCache oldCache = oldVisual.GetRenderDataCache <RenderDataCache>();
            // get the data for the new visual
            RenderDataCache newCache    = CreateRenderDataCache(context, label, Typeface);
            var             labelLayout = label.GetLayout();

            if (!oldCache.Equals(newCache))
            {
                // something changed - re-render the visual
                oldVisual.Children.Clear();
                Render(context, label, oldVisual, labelLayout, newCache);
            }
            // nothing changed, return the old visual
            // arrange because the layout might have changed
            ArrangeByLayout(context, oldVisual, labelLayout, true);
            return(oldVisual);
        }
コード例 #55
0
 /// <inheritdoc />
 protected override RectD GetBounds(ICanvasContext context, ILabel label)
 {
     return(Style.Renderer.GetBoundsProvider(label, Style).GetBounds(context));
 }
コード例 #56
0
 protected override SizeD GetPreferredSize(ILabel label)
 {
     return(label.PreferredSize);
 }
コード例 #57
0
 protected override IVisual CreateVisual(IRenderContext context, ILabel label)
 {
     return(new ButtonVisual(label, Button, Icon, BackgroundColor, ForegroundColor));
 }
コード例 #58
0
 /// <inheritdoc />
 protected override SizeD GetPreferredSize(ILabel label)
 {
     return(Style.Renderer.GetPreferredSize(label, Style));
 }
コード例 #59
0
 /// <inheritdoc />
 protected override bool IsInBox(IInputModeContext context, RectD rectangle, ILabel label)
 {
     return(Style.Renderer.GetMarqueeTestable(label, Style).IsInBox(context, rectangle));
 }
コード例 #60
0
        /// <summary>
        /// Creates the visual appearance of a label
        /// </summary>
        private void Render(IRenderContext context, ILabel label, VisualGroup container, IOrientedRectangle labelLayout, RenderDataCache cache)
        {
            // store information with the visual on how we created it
            container.SetRenderDataCache(cache);

            // background rectangle
            System.Windows.Shapes.Rectangle rect = new System.Windows.Shapes.Rectangle
            {
                Width           = labelLayout.Width,
                Height          = labelLayout.Height,
                RadiusX         = labelLayout.Width / 10,
                RadiusY         = labelLayout.Height / 10,
                Stroke          = Brushes.SkyBlue,
                Fill            = fillBrush,
                StrokeThickness = 1
            };
            container.Add(rect);

            // TextBlock with label text
            TextBlock textBlock = new TextBlock
            {
                Text        = cache.LabelText,
                FontFamily  = cache.Typeface.FontFamily,
                FontStretch = cache.Typeface.Stretch,
                FontStyle   = cache.Typeface.Style,
                FontWeight  = cache.Typeface.Weight,
                Foreground  = Brushes.Black,
            };

            textBlock.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));

            // if edit button is visible align left, otherwise center
            double textPositionLeft = cache.ButtonVisibility == Visibility.Visible
                                  ? HorizontalInset
                                  : (labelLayout.Width - textBlock.DesiredSize.Width) / 2;

            textBlock.SetCanvasArrangeRect(new Rect(textPositionLeft,
                                                    (labelLayout.Height - textBlock.DesiredSize.Height) / 2,
                                                    textBlock.DesiredSize.Width,
                                                    textBlock.DesiredSize.Height
                                                    ));
            container.Add(textBlock);

            if (cache.ButtonVisibility == Visibility.Visible)
            {
                // get style for edit button from XAML resources

                // create edit button
                Button editLabelButton = new Button
                {
                    Style = editButtonStyle
                };
                editLabelButton.SetCanvasArrangeRect(new Rect(labelLayout.Width - HorizontalInset - ButtonSize, VerticalInset, ButtonSize, ButtonSize));

                // set button command
                editLabelButton.Command          = GraphCommands.EditLabel;
                editLabelButton.CommandParameter = label;
                editLabelButton.CommandTarget    = context.CanvasControl;

                container.Add(editLabelButton);
            }
        }