/* vim: set sw=3 ts=3 sts=3 expandtab: */
group {
   name: "ecdb/button";
   alias: "ecdb/combo_item";

   data {
      item: "ecdb/combo_item/minw" 50;
      item: "ecdb/combo_item/minh" 30;
   }
   
   parts {
      part {
         name: "base";
         type: IMAGE;
         mouse_events: 1;

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

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

      part {
         name: "button_clip";
         type: RECT;
         mouse_events: 1;

         description {
            state: "default" 0.0;
            color: 255 255 255 255;
   
            rel1 { 
               to: "base"; 
               relative: 0.0 0.0; 
               offset: 3 1; 
            }

            rel2 { 
               to: "base"; 
               relative: 1.0 1.0; 
               offset: -4 -2; 
            }
         }
      }

      part {
         name: "focus_clip";
         type: RECT;
         mouse_events: 1;

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

            rel1 { 
               to: "button"; 
               offset: -1 0; 
            }

            rel2 { 
               to: "button";
               offset: 0 -1; 
            }
         }

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

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

         description {
            state: "default" 0.0;

            rel1 { 
               to: "focus_clip"; 
            }

            rel2 { 
               to: "focus_clip"; 
            }

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

      part {
         name: "button";
         type: IMAGE;
         mouse_events: 1;
         clip_to: "button_clip";

         description {
            state: "default" 0.0;
            min: 0 24;

            rel1 {
               to: "button_clip";
            }

            rel2 {
               to: "button_clip";
            }
            
            image {
               normal: "button.png";
               border: 7 7 7 7;
            }
         }

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

            image {
               normal: "button_disabled.png";
               border: 11 11 10 10;
            }
         }
      }

      part {
         name: "shadow";
         type: IMAGE;
         mouse_events: 1;
         clip_to: "button_clip";

         description {
            state: "default" 0.0;
            min: 0 24;
            color: 255 255 255 0;
            
            rel1 { 
               to: "button_clip"; 
            }

            rel2 { 
               to: "button_clip"; 
            }
            
            image {
               normal: "button_shadow.png";
               border: 6 6 0 6;
            }
         }

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

      part {
         name: "shadow_overlay";
         type: IMAGE;
         mouse_events: 1;
         clip_to: "button_clip";

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

            rel1 { 
               to: "button_clip"; 
            }

            rel2 { 
               to: "button_clip"; 
            }
            
            image {
               normal: "button_shadow_overlay.png";
               border: 6 6 6 13;
            }
         }

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

      part {
         name: "minimum.size.hack";
         type: RECT;
         mouse_events: 1;
         clip_to: "button_clip";

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

            rel1 { 
               to: "button_clip"; 
            }

            rel2 { 
               to: "button_clip"; 
            }
         }
      }

      part {
         name: "ecdb.label";
         type: TEXT;
         mouse_events: 1;
         
         description {
            state: "default" 0.0;
            align: 0.0 0.5;
            color: 60 60 60 255;
            fixed: 1 1;
            
            rel1 {
               to: "ecdb.swallow.icon";
               offset: 40 0;
            }

            rel2 {
               to: "ecdb.swallow.icon";
            }

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

      part {
         name: "ecdb.swallow.icon";
         type: SWALLOW;
         mouse_events: 1;

         description {
            state: "default" 0.0;
            max: 32 32;
            align: 0.0 0.5;

            rel1 {
               to: "button_clip";
               offset: 15 0;
            }

            rel2 {
               to: "button_clip";
            }
         }
      }
   }

   programs {
      program {
         name: "clicked";
         action: STATE_SET "clicked" 0.0;
         signal: "mouse,down,1";
         source: "*";
         target: "shadow_overlay";
         target: "shadow";
         transition: DECELERATE 0.2;
      }

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

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

      program {
         name: "unclick";
         signal: "mouse,clicked,1";
         signal: "mouse,up,1";
         action: STATE_SET "default" 0.0;
         source: "*";
         target: "shadow_overlay";
         target: "shadow";
         transition: DECELERATE 0.2;
      }

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

      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: "button";
      }

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


