Beispiel #1
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;
        }
Beispiel #2
0
 public NotebookTabList(IUIStyle style) : base(style)
 {
     activeTabChangedSupport = new EventSupport <EventArgs>();
     allowDragReorder        = true;
     notebookStyle           = StyleSystem.StylesFor <NotebookStyleDefinition>();
     DragState = new DragNDropState(this);
 }
Beispiel #3
0
 protected override void CreateSystems()
 {
     styleSystem       = new StyleSystem();
     layoutSystem      = new MockLayoutSystem(this);
     inputSystem       = new MockInputSystem(layoutSystem);
     renderSystem      = new MockRenderSystem(Camera, this);
     routingSystem     = new RoutingSystem();
     animationSystem   = new AnimationSystem();
     linqBindingSystem = new LinqBindingSystem();
 }
Beispiel #4
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;
        }
Beispiel #5
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;
        }
Beispiel #6
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);
        }
Beispiel #7
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);
        }
Beispiel #8
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;
        }
Beispiel #9
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;
        }
 public TestUIStyle(IContentLoader loader, Style style, bool acceptAll = true)
 {
     Style         = style;
     StyleSystem   = new StyleSystem(loader);
     StyleResolver = new TestStyleResolver(new StyleResolver(StyleSystem), acceptAll);
 }
Beispiel #11
0
 public UIStyle(IContentLoader contentLoader)
 {
     StyleSystem   = new StyleSystem(contentLoader);
     StyleResolver = new StyleResolver(StyleSystem);
 }
Beispiel #12
0
 public Image(IUIStyle style) : base(style)
 {
     imageStyle = StyleSystem.StylesFor <ImageStyleDefinition>();
 }
Beispiel #13
0
 public LineNumberWidget(IUIStyle style) : base(style)
 {
     textStyle           = StyleSystem.StylesFor <TextStyleDefinition>();
     cachedTextPositions = new List <Tuple <int, string> >();
 }