/* vim: set sw=3 ts=3 sts=3 expandtab: */
group {
   name: "ecdb/combo/background";

   parts {
      part {
         name: "base";
         type: RECT;
         
         description {
            state: "default" 0.0;
            color: 0 0 0 0;
            min: 20 20;

            rel1 {
               relative: 0.0 0.0;
               offset: 0 0;
            }

            rel2 {
               relative: 1.0 1.0;
               offset: -1 -1;
            }
         }

         description {
            state: "active" 0.0;
            inherit: "default" 0.0;
            color: 0 0 0 90;
         }
      }
   }

   programs {
      program {
         name: "set_active";
         signal: "ecdb,combo,back,show";
         source: "ecdb";
         action: STATE_SET "active" 0.0;
         target: "base";
         transition: DECELERATE 0.2;
      }

      program {
         name: "set_default";
         signal: "ecdb,combo,back,hide";
         source: "ecdb";
         action: STATE_SET "default" 0.0;
         target: "base";
         transition: DECELERATE 0.2;
      }
   }

   program {
      name: "clicked_send";
      signal: "mouse,clicked,*";
      source: "*";
      action: SIGNAL_EMIT "ecdb,combo,back,dismiss" "ecdb";
   }
}

group {
   name: "ecdb/combo";

   parts {
      part {
         name: "base";
         type: IMAGE;
         mouse_events: 0;

         description {
            state: "default" 0.0;
            color: 255 255 255 178;
            min: 0 24;

            image {
               normal: "button_base.png";
               border: 7 7 7 7;
            }
         }
      }

      part {
         name: "focus_clip";
         type: RECT;
         mouse_events: 0;
   
         description {
            state: "default" 0.0;
            color: 255 255 255 0;

            rel1 {
               to: "combo_button";
            }

            rel2 {
               to: "combo_button";
            }
         }

         description {
            state: "clicked" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255;
         }
      }

      part {
         name: "focus";
         type: IMAGE;
         mouse_events: 0;
         clip_to: "focus_clip";

         description {
            state: "default" 0.0;
   
            rel1 {
               to: "combo_button";
            }

            rel2 {
               to: "combo_button";
            }

            image {
               normal: "combobox_focus.png";
               border: 7 7 7 7;
            }
         }
      }

      part {
         name: "combo_button";
         type: IMAGE;
   
         description {
            state: "default" 0.0;
            min: 0 22;
   
            rel1 {
               to: "base";
               relative: 0.0 0.0;
               offset: 3 1;
            }

            rel2 {
               to: "base";
               relative: 1.0 1.0;
               offset: -4 -3;
            }
   
            image {
               normal: "combobox_button.png";
               border: 7 23 7 7;
            }
         }

         description {
            state: "clicked" 0.0;
            inherit: "default" 0.0;

            image {
               normal: "combobox_button_clicked.png";
            }
         }

         description {
            state: "disabled" 0.0;
            inherit: "default" 0.0;

            image {
               normal: "combobox_button_disabled.png";
            }
         }
      }

      part {
         name: "combo_arrows";
         type: IMAGE;

         description {
            state: "default" 0.0;
            min: 9 13;
            max: 9 13;
            align: 1.0 0.5;

            rel1 {
               to: "combo_button";
               relative: 0.0 0.0;
               offset: 0 0;
            }

            rel2 {
               relative: 1.0 1.0;
               offset: -11 -1;
            }

            image {
               normal: "combo_arrow.png";
            }

            fill {
               smooth: 0;
            }
         }
      }

      part {
         name: "ecdb.header";
         type: TEXT;

         description {
            state: "default" 0.0;
            color: 60 60 60 255;
            align: 0.0 0.5;
            
            rel1 {
               to: "combo_button";
               relative: 0.0 0.0;
               offset: 9 0;
            }

            rel2 {
               to: "combo_button";
               relative: 1.0 1.0;
               offset: -1 -1;
            }

            text {
               text: "";
               font: "ecdb/default";
               min: 1 1;
               size: 11;
               align: 0.0 0.5;
            }
         }

         description {
            state: "deactivate" 0.0;
            inherit: "default" 0.0;
            color: 60 60 60 0;
         }
      }

      part {
         name: "ecdb.header.swallow";
         type: SWALLOW;
         
         description {
            state: "default" 0.0;
            align: 0.0 0.5;
            color: 255 255 255 0;

            rel1 {
               to: "combo_button";
               relative: 0.0 0.0;
               offset: 9 0;
            }

            rel2 {
               to: "combo_button";
               relative: 1.0 1.0;
               offset: -1 -1;
            }
         }

         description {
            state: "active" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255;
         }
      }

   }

   programs {
      program {
         name: "clicked";
         action: STATE_SET "clicked" 0.0;
         signal: "mouse,down,1";
         source: "*";
         target: "combo_button";
      }

      program {
         name: "focus_in,mouse";
         signal: "mouse,down,1";
         action: STATE_SET "clicked" 0.0;
         source: "*";
         target: "focus_clip";
         transition: DECELERATE 0.5;
      }

      program {
         name: "focus_in,ecdb";
         signal: "ecdb,focus,in";
         action: STATE_SET "clicked" 0.0;
         source: "*";
         target: "focus_clip";
         transition: DECELERATE 0.5;
      }

      program {
         name: "clicked_send";
         signal: "mouse,clicked,1";
         source: "*";
         action: SIGNAL_EMIT "ecdb,combo,clicked" "ecdb";
      }

      program {
         name: "collapse";
         signal: "ecdb,combo,default";
         source: "ecdb";
         action: STATE_SET "default" 0.0;
         target: "combo_button";
      }

      program {
         name: "expand";
         signal: "ecdb,combo,active";
         source: "ecdb";
         action: STATE_SET "clicked" 0.0;
         target: "combo_button";
      }

      program {
         name: "unclick2";
         signal: "mouse,up,1";
         source: "*";
         action: STATE_SET "default" 0.0;
         target: "combo_button";
      }

      program {
         name: "focus_out";
         signal: "ecdb,focus,out";
         action: STATE_SET "default" 0.0;
         source: "ecdb";
         target: "focus_clip";
         transition: DECELERATE 0.5;
      }

      program {
         name: "disable";
         signal: "ecdb,disable";
         action: STATE_SET "disabled" 0.0;
         source: "ecdb";
         target: "combo_button";
      }

      program {
         name: "enable";
         signal: "ecdb,enable";
         action: STATE_SET "default" 0.0;
         source: "ecdb";
         target: "combo_button";
      }

      program {
         name: "header_hide";
         signal: "ecdb,combo,header,swallow";
         source: "ecdb";
         action: STATE_SET "deactivate" 0.0;
         target: "ecdb.header";
         transition: DECELERATE 0.5;
      }

      program {
         name: "swallow_show";
         signal: "ecdb,combo,header,swallow";
         source: "ecdb";
         action: STATE_SET "active" 0.0;
         target: "ecdb.header.swallow";
         transition: DECELERATE 0.5;
      }
   }
}

group {
   name: "ecdb/combo/popup";

   parts {
      part {
         name: "ecdb.box";
         type: BOX;

         description {
            state: "default" 0.0;
            color: 255 255 255 0;

            rel1 {
               relative: 0.0 0.0;
               offset: 0 0;
            }

            rel2 {
               relative: 1.0 0.0;
               offset: -1 -1;
            }

            box {
               layout: "min_size";
               padding: 0 2;
               align: 0.0 0.5;
            }
         }

         description {
            state: "active" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255;

            rel1 {
               relative: 0.0 0.0;
               offset: 0 0;
            }

            rel2 {
               relative: 1.0 1.0;
               offset: -1 -1;
            }
         }
      }
   }

   programs {
      program {
         name: "expand";
         signal: "ecdb,combo,popup,show,*";
         source: "ecdb";
         action: STATE_SET "active" 0.0;
         target: "ecdb.box";
         transition: DECELERATE 0.2;
      }

      program {
         name: "collapse";
         signal: "ecdb,combo,popup,hide,*";
         source: "ecdb";
         action: STATE_SET "default" 0.0;
         target: "ecdb.box";
         transition: DECELERATE 0.2;
      }
   }
}

