#include #ifndef __AVM_HUI_BUTTON_INTERNAL_H__ #define __AVM_HUI_BUTTON_INTERNAL_H__ enum button_event { // Nothing happened, just ignore button_event_none, // Button has been pressed down button_event_down, // Button has been released button_event_up, // Button has been cancelled button_event_cancelled, }; #define BUTTON_FLAG_IGNORE_LOCK BIT(1) #define BUTTON_FLAG_MULTI BIT(2) struct button; struct button_action; typedef void (*button_action_handler)(struct button *button, const struct button_action *, enum button_event event, unsigned long elapsed); struct button_action { int ms; int flags; // Generic handling button_action_handler handler; // Default handling int down; // Event to send on down int up; // Event to send on up }; struct button_def { const char *name; struct button_action *actions; }; struct button { struct kobject kobj; const struct button_action *actions; int current_action; unsigned long jiffies_down; }; #define to_button_obj(obj) container_of(obj, struct button, kobj) extern struct kobj_type button_ktype; #endif