<plugin id="Tuto14Gui" >

    <requirement id="sight::module::ui::base" />
    <requirement id="sight::module::ui::qt" />
    <requirement id="sight::module::service" />

    <extension implements="::sight::service::extension::AppConfig" >
    <id>Tuto14Gui_AppCfg</id>
        <config>

        <!-- ******************************* Objects declaration ****************************** -->

        <object uid="text" type="sight::data::String" >
            <value>
            <![CDATA[
                This is a STextStatus
            ]]>
            </value>
        </object>

        <!-- ******************************* UI declaration *********************************** -->

        <service uid="mainFrame" type="sight::module::ui::base::SFrame" >
            <gui>
                <menuBar />
                <toolBar >
                    <toolBitmapSize height= "32" width="32" />
                </toolBar>
                <frame>
                    <name>Tuto14Gui</name>
                    <icon>Tuto14Gui/tuto.ico</icon>
                    <minSize width="800" height="600" />
                </frame>
            </gui>
            <registry>
                <menuBar sid="menuBarView" start="true" />
                <toolBar sid="toolBarView" start="true" />
                <view sid="backgroundView" start="true" />
            </registry>
        </service>

        <service uid="menuBarView" type="sight::module::ui::base::SMenuBar" >
            <gui>
                <layout>
                    <menu name="My Menu" />
                    <menu name="My Menu 2" />
                    <menu name="My Menu 3" />
                </layout>
            </gui>
            <registry>
                <menu sid="menu1View" start="true" />
                <menu sid="menu2View" start="true" />
            </registry>
        </service>

        <service uid="menu1View" type="sight::module::ui::base::SMenu" >
            <gui>
                <layout>
                    <menuItem name="Item 1" shortcut="1" style="check" />
                    <separator />
                    <menuItem name="Item 2" shortcut="2" style="radio" />
                    <menuItem name="Item 3" shortcut="3" style="radio" />
                    <separator />
                    <menuItem name="Item A" shortcut="A" style="radio" />
                    <menuItem name="Item B" shortcut="B" style="radio" />
                    <separator />
                    <menuItem name="Quit" shortcut="Ctrl+Q" specialAction="QUIT" />
                </layout>
            </gui>
            <registry>
                <menuItem sid="item1Act" start="false" />
                <menuItem sid="item2Act" start="false" />
                <menuItem sid="item3Act" start="false" />
                <menuItem sid="item4Act" start="false" />
                <menuItem sid="item5Act" start="false" />
                <menuItem sid="quitAct" start="false" />
            </registry>
        </service>

        <service uid="menu2View" type="sight::module::ui::base::SMenu" >
            <gui>
                <layout>
                    <menuItem name="Item 1" style="check" />
                    <separator />
                    <menuItem name="start 2-3 / stop A-B" style="radio" />
                    <menuItem name="start A-B / stop 2-3" style="radio" />
                </layout>
            </gui>
            <registry>
                <menuItem sid="item1Act" start="false" />
                <menuItem sid="item16Act" start="false" />
                <menuItem sid="item17Act" start="false" />
            </registry>
        </service>

        <service uid="toolBarView" type="sight::module::ui::base::SToolBar" >
            <gui>
                <layout style="ToolButtonTextUnderIcon" >
                    <menuItem name="start" icon="sight::module::ui::flaticons/GreenStart.svg" />
                    <menuItem name="pause" icon="sight::module::ui::flaticons/OrangePause.svg" />
                    <menuItem name="stop"  icon="sight::module::ui::flaticons/RedStop.svg" />
                    <separator />
                    <menuItem name="Item 1" style="check" icon="Tuto14Gui/icons/important.png" />
                    <separator />
                    <menuItem name="Item 2" style="radio" icon="sight::module::ui::flaticons/BlueParameters.svg" />
                    <menuItem name="Item 3" style="radio" icon="sight::module::ui::flaticons/BlueParameters.svg" />
                    <separator />
                    <menuItem name="Item A" style="radio" icon="Tuto14Gui/icons/monkey.png" />
                    <menuItem name="Item B" style="radio" icon="Tuto14Gui/icons/monkey.png" />
                    <separator />
                    <menuItem name="start 2-3 / stop A-B" style="radio" icon="Tuto14Gui/icons/important.png" />
                    <menuItem name="start A-B / stop 2-3" style="radio" icon="Tuto14Gui/icons/important.png" />
                    <menuItem name="logo visibility (inverted)" style="check" icon="Tuto14Gui/icons/monkey.png" />
                    <spacer/>
                    <menu name="Test Hide/Show" start="true" />
                    <menuItem name="Quit" icon="sight::module::ui::flaticons/RedCross.svg" />
                </layout>
            </gui>
            <registry>
                <menuItem sid="startAct" start="true" />
                <menuItem sid="pauseAct" start="true" />
                <menuItem sid="stopAct" start="true" />
                <menuItem sid="item1Act" start="true" />
                <menuItem sid="item2Act" start="false" />
                <menuItem sid="item3Act" start="false" />
                <menuItem sid="item4Act" start="false" />
                <menuItem sid="item5Act" start="false" />
                <menuItem sid="item16Act" start="true" />
                <menuItem sid="item17Act" start="true" />
                <menuItem sid="view5VisibilityAct" start="true" />
                <menu sid="testHideShowView" start="true" />
                <menuItem sid="quitAct" start="true" />
            </registry>
        </service>

        <service uid="testHideShowView" type="sight::module::ui::base::SMenu" >
            <gui>
                <layout>
                    <menuItem name="start" icon="sight::module::ui::flaticons/GreenStart.svg" />
                    <menuItem name="pause" icon="sight::module::ui::flaticons/OrangePause.svg" />
                    <menuItem name="stop"  icon="sight::module::ui::flaticons/RedStop.svg" />
                </layout>
            </gui>
            <registry>
                <menuItem sid="startAct" start="false" />
                <menuItem sid="pauseAct" start="false" />
                <menuItem sid="stopAct" start="false" />
            </registry>
        </service>

        <service uid="backgroundView" type="sight::module::ui::base::SView" >
            <gui>
                <layout type="sight::ui::base::LineLayoutManager" >
                    <orientation value="vertical" />
                    <view proportion="1" backgroundColor="#2E2F30" />
                </layout>
            </gui>
            <registry>
                <view sid="containerView" start="true" />
            </registry>
        </service>

        <service uid="containerView" type="sight::module::ui::base::SView" >
            <gui>
                <layout type="sight::ui::base::LineLayoutManager" >
                    <orientation value="vertical" />
                    <view proportion="2" />
                    <view proportion="1" />
                </layout>
            </gui>
            <registry>
                <view wid="subWidView" />
                <view sid="sub2View" start="true" />
            </registry>
        </service>

        <service uid="sub1View" type="sight::module::ui::base::SView" >
            <gui>
                <layout type="sight::ui::base::LineLayoutManager" >
                    <orientation value="horizontal" />
                    <view proportion="1" toolTip="View with tabs inside" backgroundColor="#36393E" />
                    <view proportion="1" toolTip="Empty view" backgroundColor="#36393E" />
                    <view proportion="1" backgroundColor="#36393E" />
                </layout>
            </gui>
            <registry>
                <parent wid="subWidView" />
                <view sid="sub3View" start="true" />
                <view sid="sub4View" start="true" />
                <view sid="sub5View" start="true" />
            </registry>
        </service>

        <service uid="sub2View" type="sight::module::ui::base::SView" >
            <gui>
                <layout type="sight::ui::base::CardinalLayoutManager" >
                    <view align="center" backgroundColor="#36393E" />
                    <view caption="CardinalView2" align="right" minWidth="400" />
                    <view caption="CardinalView3" align="right" minWidth="400" />
                </layout>
            </gui>
            <registry>
                <view sid="view12" start="true" />
            </registry>
        </service>

        <service uid="sub3View" type="sight::module::ui::base::SView" >
            <gui>
                <layout type="sight::ui::base::TabLayoutManager" >
                    <view caption="TabView1"  />
                    <view caption="TabView2" selected="true" />
                    <view caption="TabView3" />
                </layout>
            </gui>
            <registry/>
        </service>

        <service uid="sub4View" type="sight::module::ui::base::SView" >
        <gui>
            <layout type="sight::ui::base::LineLayoutManager" >
                <orientation value="horizontal" />
                <spacer/>
                <view proportion="0" />
                <spacer/>
            </layout>
        </gui>
         <registry>
            <view sid="textStatusSrv" start="true" />
        </registry>
        </service>

        <service uid="sub5View" type="sight::module::ui::base::SView" >
            <gui>
                <layout type="sight::ui::base::LineLayoutManager" >
                    <orientation value="horizontal" />
                    <spacer/>
                    <view proportion="0" />
                    <spacer/>
                </layout>
            </gui>
             <registry>
                <view sid="ircadIHULogoSrv" start="true" />
            </registry>
        </service>

        <service uid="view12" type="sight::module::ui::base::SView" >
            <gui>
                <layout type="sight::ui::base::LineLayoutManager" >
                    <orientation value="horizontal" />
                    <view toolTip="This is a nice tooltip"  />
                    <view toolTip="You can put some useful information here"  />
                    <view toolTip="This button is check/unchecked by clicking on 'Click' or 'Me'"  />
                </layout>
                <toolBar />
            </gui>
            <registry>
                <view sid="clickSrv" start="true" />
                <view sid="meSrv" start="true" />
                <view sid="checkableSrv" start="true" />
                <toolBar sid="toolbar2View" start="true" />
            </registry>
        </service>

        <service uid="toolbar2View" type="sight::module::ui::base::SToolBar" >
            <gui>
                <layout>
                    <menuItem name="Item 2" style="radio" icon="sight::module::ui::flaticons/BlueParameters.svg" />
                    <menuItem name="Item 3" style="radio" icon="sight::module::ui::flaticons/BlueParameters.svg" />
                    <separator />
                    <menuItem name="Item A" style="radio" icon="Tuto14Gui/icons/monkey.png" />
                    <menuItem name="Item B" style="radio" icon="Tuto14Gui/icons/monkey.png" />
                </layout>
            </gui>
            <registry>
                <menuItem sid="item2Act" />
                <menuItem sid="item3Act" />
                <menuItem sid="item4Act" />
                <menuItem sid="item5Act" />
            </registry>
        </service>

        <!-- ******************************* Actions ****************************************** -->

        <service uid="item1Act" type="sight::module::ui::base::SDefaultAction" >
            <state active="true" />
        </service>

        <service uid="item2Act" type="sight::module::ui::base::SDefaultAction" >
            <state active="true" />
        </service>

        <service uid="item3Act" type="sight::module::ui::base::SDefaultAction" />

        <service uid="item4Act" type="sight::module::ui::base::SDefaultAction" >
            <state active="false" />
        </service>

        <service uid="item5Act" type="sight::module::ui::base::SDefaultAction" >
            <state active="true" />
        </service>

        <service uid="startAct" type="sight::module::ui::base::com::SSlotCaller" >
            <slots>
                <slot>startAct/hide</slot>
                <slot>stopAct/setExecutable</slot>
                <slot>pauseAct/show</slot>
            </slots>
        </service>

        <service uid="stopAct" type="sight::module::ui::base::com::SSlotCaller" >
            <state executable="false" />
            <slots>
                <slot>startAct/show</slot>
                <slot>stopAct/setInexecutable</slot>
                <slot>pauseAct/hide</slot>
            </slots>
        </service>

        <service uid="pauseAct" type="sight::module::ui::base::com::SSlotCaller" >
            <state active="true" visible="false" />
            <slots>
                <slot>startAct/show</slot>
                <slot>pauseAct/hide</slot>
            </slots>
        </service>

        <service uid="view5VisibilityAct" type="sight::module::ui::base::com::SBooleanSlotCaller" >
            <state active="true" inverse="true" />
            <slots>
                <slot>sub5View/setVisible</slot>
            </slots>
        </service>

        <service uid="item16Act" type="sight::module::ui::base::com::SStarter" >
            <state active="true" />
            <start uid="item2Act" />
            <start uid="item3Act" />
            <stop uid="item4Act" />
            <stop uid="item5Act" />
        </service>

        <service uid="item17Act" type="sight::module::ui::base::com::SStarter" >
            <stop uid="item2Act" />
            <stop uid="item3Act" />
            <start uid="item4Act" />
            <start uid="item5Act" />
        </service>

        <!-- ******************************* Services ***************************************** -->

        <service uid="clickSrv" type="sight::module::ui::qt::com::SSignalButton" >
            <config>
                <text>Click</text>
            </config>
        </service>

        <service uid="meSrv" type="sight::module::ui::qt::com::SSignalButton" >
            <config>
                <text>Me</text>
            </config>
        </service>

        <service uid="checkableSrv" type="sight::module::ui::qt::com::SSignalButton" >
            <config>
                <checkable>true</checkable>
                <icon>sight::module::ui::flaticons/GreenStart.svg</icon>
                <icon2>sight::module::ui::flaticons/RedStop.svg</icon2>
                <text>Check</text>
            </config>
        </service>

        <service uid="ircadIHULogoSrv" type="sight::module::ui::qt::image::SImage" >
            <path>flaticons/IrcadIHU.svg</path>
            <height>70</height>
        </service>

        <service uid="textStatusSrv" type="sight::module::ui::qt::STextStatus" >
             <in key="string" uid="text" />
             <label>Text status</label>
             <color>#6997BB</color>
         </service>

        <service uid="quitAct" type="sight::module::ui::base::SQuit" />

        <!-- ******************************* Connections ***************************************** -->

        <!-- check button "Check" when button "Click" is clicked  -->
        <connect>
            <signal>clickSrv/clicked</signal>
            <slot>checkableSrv/check</slot>
        </connect>

        <!-- uncheck button "Check" when button "Me" is clicked  -->
        <connect>
            <signal>meSrv/clicked</signal>
            <slot>checkableSrv/uncheck</slot>
        </connect>

        <!-- ******************************* Start services ***************************************** -->

        <start uid="mainFrame" />
        <start uid="sub1View" />

        </config>
    </extension>
</plugin>
