示例#1
0
 public NotebookTabList(IUIStyle style) : base(style)
 {
     activeTabChangedSupport = new EventSupport <EventArgs>();
     allowDragReorder        = true;
     notebookStyle           = StyleSystem.StylesFor <NotebookStyleDefinition>();
     DragState = new DragNDropState(this);
 }
示例#2
0
        public ListView(IUIStyle style) : base(style)
        {
            selectionChangedSupport = new EventSupport <ListSelectionEventArgs>();
            listViewStyle           = StyleSystem.StylesFor <ListViewStyleDefinition>();

            selectedIndex = -1;

            InternalContent = new ScrollPanel <BoxGroup>(UIStyle)
            {
                Content = new BoxGroup(UIStyle)
                {
                    Orientation = Orientation.Vertical
                }
            };

            DataItems = new ObservableCollection <T>();
            DataItems.CollectionChanged += (s, e) =>
            {
                RebuildDataRenderers();
                InvalidateLayout();
            };

            CreateRenderer = ListView.DefaultCreateRenderer;

            MinHeight = 0;
            MaxHeight = int.MaxValue;
        }
示例#3
0
        protected TextWidgetBase(IUIStyle style, IDocumentEditor <TView, TDocument> editor) : base(style)
        {
            textStyles = StyleSystem.StylesFor <TextStyleDefinition>();

            ChildrenChanged += HandleOnChildrenChanged;

            DocumentEditor = editor;
            Content        = DocumentEditor.CreateDocumentView(AnchoredRect.CreateTopAnchored());

            WrapText = WrapText.Auto;
        }
示例#4
0
        public Notebook(IUIStyle style) : base(style)
        {
            notebookStyle = StyleSystem.StylesFor <NotebookStyleDefinition>();

            Tabs = new NotebookTabList(UIStyle);
            Tabs.ActiveTabChanged += (s, e) => { panel.Content = Tabs.ActiveTab?.Content; };
            Tabs.AddNotify(this);
            RaiseChildAdded(0, Tabs);

            panel = new ScrollPanel(UIStyle);
            panel.AddNotify(this);
            RaiseChildAdded(1, panel);

            KeyPressed += OnKeyPressed;
        }
示例#5
0
        public Scrollbar(IUIStyle style) : base(style)
        {
            scrollbarPositionChangedSupport = new EventSupport <EventArgs>();
            scrollbarStyle = StyleSystem.StylesFor <ScrollbarStyleDefinition>();

            ScrollUnit = 50 / 120f;
            lerpOffset = new LerpValue(0, 0, 0.5f, AnimationLoop.NoLoop);

            MouseDragged += OnMouseDragged;
            MouseWheel   += OnMouseWheel;
            MouseUp      += OnMouseUp;
            MouseDown    += OnMouseDown;
            MouseClicked += OnMouseClick;

            Thumb = new ScrollbarThumb(UIStyle);
        }
示例#6
0
        public IconLabel(IUIStyle style) : base(style)
        {
            iconLabelStyle = StyleSystem.StylesFor <IconLabelStyleDefinition>();

            Image = new Image(style)
            {
                Padding = new Insets(), Enabled = false
            };
            Image.AddNotify(this);
            RaiseChildAdded(0, Image);

            Label = new Label(style)
            {
                Padding = new Insets(), Enabled = false
            };
            Label.AddNotify(this);
            RaiseChildAdded(1, Label);
        }
示例#7
0
        public ButtonBase(IUIStyle style) : base(style)
        {
            buttonStyle             = StyleSystem.StylesFor <ButtonStyleDefinition>();
            actionPerformedSupport  = new EventSupport <EventArgs>();
            selectionChangedSupport = new EventSupport <EventArgs>();

            pressedAnimation = new SmoothValue(1f, 0f, 0.1f);
            pressedAnimation.FinishAnimation();

            Focusable = true;

            FocusedChanged += (sender, args) => ResetPressState();

            MouseDown    += OnMouseDown;
            MouseUp      += OnMouseUp;
            MouseClicked += OnMouseClick;
            KeyPressed   += OnKeyPressed;
            KeyReleased  += OnKeyReleased;
        }
示例#8
0
        public Caret(IUIStyle style, TView textInformation) : base(style)
        {
            if (textInformation == null)
            {
                throw new ArgumentNullException(nameof(textInformation));
            }

            styleDefinition = StyleSystem.StylesFor <TextStyleDefinition>();

            TextInformation = textInformation;
            TextInformation.Document.DocumentModified += UpdatePositions;
            startPosition = null;
            endPosition   = TextInformation.Document.CreatePosition(0, Bias.Backward);

            selectionHighlight = new Highlight <TDocument>(startPosition, endPosition, Style);
            textInformation.Highlighter.AddHighlight(selectionHighlight);

            blinkAnimation = new StepValue(0, 1)
            {
                Duration = 1, Loop = AnimationLoop.Loop
            };

            Style.ValueChanged += OnStyleChanged;
        }
示例#9
0
 public Image(IUIStyle style) : base(style)
 {
     imageStyle = StyleSystem.StylesFor <ImageStyleDefinition>();
 }
示例#10
0
 public LineNumberWidget(IUIStyle style) : base(style)
 {
     textStyle           = StyleSystem.StylesFor <TextStyleDefinition>();
     cachedTextPositions = new List <Tuple <int, string> >();
 }