Skip to content

Instantly share code, notes, and snippets.

@Otlowski
Last active May 18, 2018 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Otlowski/5275918c04a2c9d9137fb5027d564900 to your computer and use it in GitHub Desktop.
Save Otlowski/5275918c04a2c9d9137fb5027d564900 to your computer and use it in GitHub Desktop.
Parts
parts {
part { name: "elm.border";
type: IMAGE;
description { state: "default" 0.0;
min: WIDTH HEIGHT;  
max: WIDTH HEIGHT;  
        align: 0.5 0.5;
        color_class: border_color;
        image { normal: "circle_stroke.png"; }
     }
     description { state: "pressed" 0.0;
        inherit: "default" 0.0;
        color_class: border_color_pressed;
     }
  }
  part { name: "elm.icon";
     type: IMAGE;
     description { state: "default" 0.0;
        min: ICON_WIDTH ICON_HEIGHT;  
        max: ICON_WIDTH ICON_HEIGHT;  
        rel1 { to: ""elm.border; }
        rel2 { to: "elm.border"; }
        align: 0.5 0.55;
        color_class: icon_color_normal;
        image { normal: image_file; }
     }
     description { state: "pressed" 0.0;
        inherit: "default" 0.0;
        color_class: icon_color_pressed;
     }
  }
  textblock { name: "elm.text";
     description { state: "default" 0.0;
        max: 0 0;
        visible: 0;
     }
  }
  rect { "event";
     desc { "default";
        color: 0 0 0 0;
        min: WIDTH HEIGHT;  
        max: WIDTH HEIGHT;  
     }
     desc { "disabled";
        inherit: "default";
        visible: 0;
     }
  }
}
program {
  signal: "mouse,down,*";
  source: "event";
  action: SIGNAL_EMIT "elm,action,press" "elm";
  action: SIGNAL_EMIT "start.click" "";
  after: "button_click_anim";
}
program { "button_click_anim";
  script {
     set_state(PART:"elm.icon", "pressed", 0.0);
     set_state(PART:"elm.border", "pressed", 0.0);
  }
}
program { "button_unclick";
  signal: "mouse,up,*";
  source: "event";
  action: SIGNAL_EMIT "elm,action,unpress" "elm";
  action: SIGNAL_EMIT "stop.click" "";
  after: "button_unclick_anim";
}
program { "button_unclick_anim";
  script {
     set_state(PART:"elm.icon", "default", 0.0);
     set_state(PART:"elm.border", "default", 0.0);
  }
}
program {
  name: "clicked";
  signal: "mouse,clicked,*";
  source: "*";
  action: SIGNAL_EMIT "elm,action,click" "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment