Initial support for scalable gfxmenu

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-29 17:31:02 +01:00
parent a2b4c09b1c
commit 9a17588459
13 changed files with 368 additions and 437 deletions

View file

@ -55,14 +55,13 @@ struct grub_gui_component_ops
grub_gui_container_t (*get_parent) (void *self);
void (*set_bounds) (void *self, const grub_video_rect_t *bounds);
void (*get_bounds) (void *self, grub_video_rect_t *bounds);
void (*get_preferred_size) (void *self, int *width, int *height);
void (*get_minimal_size) (void *self, unsigned *width, unsigned *height);
grub_err_t (*set_property) (void *self, const char *name, const char *value);
void (*repaint) (void *self, int second_pass);
};
struct grub_gui_container_ops
{
struct grub_gui_component_ops component;
void (*add) (void *self, grub_gui_component_t comp);
void (*remove) (void *self, grub_gui_component_t comp);
void (*iterate_children) (void *self,
@ -71,24 +70,78 @@ struct grub_gui_container_ops
struct grub_gui_list_ops
{
struct grub_gui_component_ops component_ops;
void (*set_view_info) (void *self,
const char *theme_path,
grub_gfxmenu_model_t menu);
};
typedef grub_uint32_t grub_fixed_unsigned_t;
#define GRUB_FIXED_1 0x10000
static inline unsigned
grub_fixed_ufu_divide (grub_uint32_t a, grub_fixed_unsigned_t b)
{
return (a << 16) / b;
}
static inline grub_fixed_unsigned_t
grub_fixed_fuf_divide (grub_fixed_unsigned_t a, grub_uint32_t b)
{
return a / b;
}
static inline unsigned
grub_fixed_ufu_multiply (grub_uint32_t a, grub_fixed_unsigned_t b)
{
return (a * b) >> 16;
}
static inline unsigned
grub_fixed_to_unsigned (grub_fixed_unsigned_t in)
{
return in >> 16;
}
static inline grub_fixed_unsigned_t
grub_unsigned_to_fixed (unsigned in)
{
return in << 16;
}
struct grub_gui_component
{
struct grub_gui_component_ops *ops;
int isxfrac:1;
int isyfrac:1;
int iswfrac:1;
int ishfrac:1;
union {
unsigned x;
grub_fixed_unsigned_t xfrac;
};
union {
unsigned y;
grub_fixed_unsigned_t yfrac;
};
union {
unsigned w;
grub_fixed_unsigned_t wfrac;
};
union {
unsigned h;
grub_fixed_unsigned_t hfrac;
};
};
struct grub_gui_container
{
struct grub_gui_component component;
struct grub_gui_container_ops *ops;
};
struct grub_gui_list
{
struct grub_gui_component component;
struct grub_gui_list_ops *ops;
};

View file

@ -34,6 +34,4 @@ int grub_gui_get_named_color (const char *name, grub_gui_color_t *color);
grub_err_t grub_gui_parse_color (const char *s, grub_gui_color_t *color);
grub_err_t grub_gui_parse_2_tuple (const char *s, int *px, int *py);
#endif /* GRUB_GUI_STRING_UTIL_HEADER */

View file

@ -160,10 +160,10 @@ struct grub_video_mode_info
/* A 2D rectangle type. */
struct grub_video_rect
{
int x;
int y;
int width;
int height;
unsigned x;
unsigned y;
unsigned width;
unsigned height;
};
typedef struct grub_video_rect grub_video_rect_t;