/* vim: set sw=3 ts=3 sts=3 expandtab: */
group {
   name: "ecdb/capacity";
   max: 999999 20;

   script {
      public message(Msg_Type:type, id, ...) {
         if ((type == MSG_FLOAT) && (id == 1)) {
            new Float:freq;
            freq = getfarg(2);
            set_drag(PART:"draggie", freq, 0.0);
         }
      }
   }

   parts {
      part {
         name: "confine";
         mouse_events: 0;
         type: RECT;

         description {
            state: "default" 0.0;
            min: 0 17;
            fixed: 1 1;

            rel1 {
               relative: 0.0 0.0;
               offset: 2 1;
            }

            rel2 {
               relative: 1.0 1.0;
               offset: -2 -3;
            }
         }
      }

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

         description {
            state: "default" 0.0;
            fixed: 1 1;

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

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

            image {
               normal: "progress_trough.png";
               border: 3 3 3 4;
            }

            fill {
               smooth: 0;
            }
         }
      }

      part {
         name: "progress_left";
         type: IMAGE;
         clip_to: "confine";

         description {
            state: "default" 0.0;
            fixed: 1 1;
            min: 2 17;
            max: 2 17;

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

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

            image {
               normal: "progress_bar_left.png";
            }

            fill {
               smooth: 0;
            }
         }
      }

      part {
         name: "draggie";
         type: RECT;
         clip_to: "confine";

         dragable {
            confine: "confine";
            x: 1 1 0;
            y: 0 0 0;
         }

         description {
            state: "default" 0.0;
            min: 1 21;
            fixed: 1 1;
            color: 0 0 0 0;
            
            rel1 {
               relative: 0.0 0.0;
            }

            rel2 {
               relative: 0.0 1.0;
            }
         }
      }

      part {
         name: "fill";
         type: IMAGE;
         mouse_events: 0;
         clip_to: "confine";

         description {
            state: "default" 0.0;
            fixed: 1 1;

            rel1 {
               relative: 1.0 0.0;
               offset: 0 0;
               to: "progress_left";
            }

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

            image {
               normal: "progress_bar_fill_0.png";
            }

            fill {
               smooth: 1;
               size {
                  relative: 0.0 0.0;
                  offset: 28 17;
               }
            }
         }
      }

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

         description {
            state: "default" 0.0;
            fixed: 1 1;
            min: 2 17;
            max: 2 17;

            rel1 {
               to: "fill";
               relative: 1.0 0.0;
            }

            rel2 {
               to: "fill";
               relative: 1.0 1.0;
            }

            image {
               normal: "progress_bar_right.png";
            }

            fill {
               smooth: 0;
            }
         }
      }
   }
}

