Page 1 of 1

horizontal slider

Posted: Sat Feb 27, 2021 19:09
by orion
Hi All

any one got the code for the horizontal slider for the looknfeel i have attempetd to make one and it shows fine but it lags when using the thumb ie doesnt scroll correctly i tried looking at the windows looknfeel but cant really see where its diffrent than i have :(

any pointers welcomed

Re: horizontal slider

Posted: Wed Jan 19, 2022 08:02
by niello
Sorry for the late answer but I hope it is still useful for anyone. This is a slider I implemented for my project.

Slider code from the master branch handles it correctly, but 0.8.7 may need backporting, which souldn't be very hard, see:
https://github.com/cegui/cegui/blob/mas ... s/Slider.h
https://github.com/cegui/cegui/blob/mas ... Slider.cpp
https://github.com/cegui/cegui/blob/mas ... e/Slider.h
https://github.com/cegui/cegui/blob/mas ... Slider.cpp


Code: Select all

    <!--
    ***************************************************
        TaharezLook/SliderThumb
    ***************************************************
    -->
    <WidgetLook name="TaharezLook/HorizontalSliderThumb">
        <Property name="HorzFree" value="true" />
        <Property name="CursorInputPropagationEnabled" value="true" />
        <ImagerySection name="normal">
            <ImageryComponent>
                <Image name="TaharezLook/HorzSliderThumbNormal" />
                <VertFormat type="Stretched" />
                <HorzFormat type="Stretched" />
            </ImageryComponent>
        </ImagerySection>
        <ImagerySection name="hover">
            <ImageryComponent>
                <Image name="TaharezLook/HorzSliderThumbHover" />
                <VertFormat type="Stretched" />
                <HorzFormat type="Stretched" />
            </ImageryComponent>
        </ImagerySection>
        <StateImagery name="Normal">
            <Layer>
                <Section section="normal" />
            </Layer>
        </StateImagery>
        <StateImagery name="Hover">
            <Layer>
                <Section section="hover" />
            </Layer>
        </StateImagery>
        <StateImagery name="Pushed">
            <Layer>
                <Section section="hover" />
            </Layer>
        </StateImagery>
        <StateImagery name="Disabled">
            <Layer>
                <Section section="normal">
                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
                </Section>
            </Layer>
        </StateImagery>
    </WidgetLook>

    <!--
    ***************************************************
        TaharezLook/Slider
    ***************************************************
    -->
    <WidgetLook name="TaharezLook/HorizontalSlider">
        <Property name="VerticalSlider" value="false" />
        <Property name="CursorAutoRepeatEnabled" value="true" />
        <Property name="Size" value="{{0, 256}, {0, 16}}" />
        <NamedArea name="ThumbTrackArea" />
        <Child type="TaharezLook/HorizontalSliderThumb" nameSuffix="__auto_thumb__">
            <Area>
                <Dim type="Width" ><ImageDim name="TaharezLook/HorzSliderThumbNormal" dimension="Width" /></Dim>
            </Area>
        </Child>
        <ImagerySection name="main">
            <ImageryComponent>
                <Area>
                    <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
                    <Dim type="Height" ><UnifiedDim scale="1.0" offset="-6" type="Height" /></Dim>
                </Area>
                <Image name="TaharezLook/HorzSliderBody" />
                <VertFormat type="Stretched" />
                <HorzFormat type="Stretched" />
            </ImageryComponent>
        </ImagerySection>
        <StateImagery name="Enabled">
            <Layer>
                <Section section="main" />
            </Layer>
        </StateImagery>
        <StateImagery name="EnabledFocused">
            <Layer>
                <Section section="main" />
            </Layer>
        </StateImagery>
        <StateImagery name="Disabled">
            <Layer>
                <Section section="main">
                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
                </Section>
            </Layer>
        </StateImagery>
    </WidgetLook>