collections {

   group {
      name: "example/main";
      min: 400 400;

      parts {
         part {
            name: "bg";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
            }
         }

         part {
            name: "title";
            type: TEXT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 0 0 0 255;
               rel1 {
                  relative: 0.0 0.0;
                  offset: 0 0;
                  to: "bg";
               }
               rel2 {
                  relative: 1.0 0.2;
                  offset: -1 -1;
                  to: "bg";
               }
               text {
                  text: "Focus Example";
                  size: 16;
                  font: "sans";
                  min: 1 1;
               }
            }
         }

         part {
            name: "buttons";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               rel1.relative: 0.2 0.3;
               rel2.relative: 0.8 0.9;
               color: 255 255 255 0;
            }
         }

         part {
            name: "button_bg,1";
            type: RECT;
            mouse_events: 1;
            description {
               state: "default" 0.0;
               rel1 {
                  to: "buttons";
                  relative: 0.1 0.1;
               }
               rel2 {
                  to: "buttons";
                  relative: 0.45 0.45;
               }
               color: 200 200 200 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 190 120 120 255;
            }
         }

         part {
            name: "button,1";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               rel1 {
                  to: "button_bg,1";
                  offset: 10 10;
               }
               rel2 {
                  to: "button_bg,1";
                  offset: -11 -11;
               }
               color: 200 200 200 255;
            }
         }

         part {
            name: "button_bg,2";
            type: RECT;
            mouse_events: 1;
            description {
               state: "default" 0.0;
               rel1 {
                  to: "buttons";
                  relative: 0.55 0.1;
               }
               rel2 {
                  to: "buttons";
                  relative: 0.9 0.45;
               }
               color: 200 200 200 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 190 120 120 255;
            }
         }

         part {
            name: "button,2";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               rel1 {
                  to: "button_bg,2";
                  offset: 10 10;
               }
               rel2 {
                  to: "button_bg,2";
                  offset: -11 -11;
               }
               color: 200 200 200 255;
            }
         }

         part {
            name: "button_bg,3";
            type: RECT;
            mouse_events: 1;
            description {
               state: "default" 0.0;
               rel1 {
                  to: "buttons";
                  relative: 0.1 0.55;
               }
               rel2 {
                  to: "buttons";
                  relative: 0.45 0.9;
               }
               color: 200 200 200 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 190 120 120 255;
            }
         }

         part {
            name: "button,3";
            type: SWALLOW;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               rel1 {
                  to: "button_bg,3";
                  offset: 10 10;
               }
               rel2 {
                  to: "button_bg,3";
                  offset: -11 -11;
               }
            }
         }

         part {
            name: "button_bg,4";
            type: RECT;
            mouse_events: 1;
            description {
               state: "default" 0.0;
               rel1 {
                  to: "buttons";
                  relative: 0.55 0.55;
               }
               rel2 {
                  to: "buttons";
                  relative: 0.9 0.9;
               }
               color: 200 200 200 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 190 120 120 255;
            }
         }

         part {
            name: "button,4";
            type: SWALLOW;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               rel1 {
                  to: "button_bg,4";
                  offset: 10 10;
               }
               rel2 {
                  to: "button_bg,4";
                  offset: -11 -11;
               }
            }
         }
      }

      programs {
         program {
            name: "button,clicked,1";
            signal: "mouse,clicked,1";
            source: "button_bg,1";
            action: FOCUS_SET;
            target: "button,1";
            after: "unfocus,objects";
         }

         program {
            name: "button,clicked,2";
            signal: "mouse,clicked,1";
            source: "button_bg,2";
            action: FOCUS_SET;
            target: "button,2";
            after: "unfocus,objects";
         }

         program {
            name: "unfocus,objects";
            action: FOCUS_OBJECT;
         }

         program {
            name: "button,clicked,3";
            signal: "mouse,clicked,1";
            source: "button_bg,3";
            action: FOCUS_OBJECT;
            target: "button,3";
            after: "unset,part";
         }

         program {
            name: "button,clicked,4";
            signal: "mouse,clicked,1";
            source: "button_bg,4";
            action: FOCUS_OBJECT;
            target: "button,4";
            after: "unset,part";
         }

         program {
            name: "unset,part";
            action: FOCUS_SET;
         }

         program {
            name: "button,focused,1";
            signal: "focus,part,in";
            source: "button,1";
            action: STATE_SET "focused" 0.0;
            target: "button_bg,1";
         }

         program {
            name: "button,focused,2";
            signal: "focus,part,in";
            source: "button,2";
            action: STATE_SET "focused" 0.0;
            target: "button_bg,2";
         }

         program {
            name: "button,focused,3";
            signal: "focus,part,in";
            source: "button,3";
            action: STATE_SET "focused" 0.0;
            target: "button_bg,3";
         }

         program {
            name: "button,focused,4";
            signal: "focus,part,in";
            source: "button,4";
            action: STATE_SET "focused" 0.0;
            target: "button_bg,4";
         }

         program {
            name: "button,unfocused,1";
            signal: "focus,part,out";
            source: "button,1";
            action: STATE_SET "default" 0.0;
            target: "button_bg,1";
         }

         program {
            name: "button,unfocused,2";
            signal: "focus,part,out";
            source: "button,2";
            action: STATE_SET "default" 0.0;
            target: "button_bg,2";
         }

         program {
            name: "button,unfocused,3";
            signal: "focus,part,out";
            source: "button,3";
            action: STATE_SET "default" 0.0;
            target: "button_bg,3";
         }

         program {
            name: "button,unfocused,4";
            signal: "focus,part,out";
            source: "button,4";
            action: STATE_SET "default" 0.0;
            target: "button_bg,4";
         }
      }
   }
}
