gfxmenu_view.h 3.5 KB
Newer Older
Colin D Bennett's avatar
Colin D Bennett committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
/* gfxmenu_view.h - gfxmenu view interface. */
/*
 *  GRUB  --  GRand Unified Bootloader
 *  Copyright (C) 2008,2009  Free Software Foundation, Inc.
 *
 *  GRUB is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  GRUB is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef GRUB_GFXMENU_VIEW_HEADER
#define GRUB_GFXMENU_VIEW_HEADER 1

#include <grub/types.h>
#include <grub/err.h>
#include <grub/menu.h>
#include <grub/font.h>
#include <grub/gfxwidgets.h>

struct grub_gfxmenu_view;   /* Forward declaration of opaque type.  */
typedef struct grub_gfxmenu_view *grub_gfxmenu_view_t;


grub_gfxmenu_view_t grub_gfxmenu_view_new (const char *theme_path,
34
					   int width, int height);
Colin D Bennett's avatar
Colin D Bennett committed
35 36 37 38 39 40 41 42 43 44 45 46 47

void grub_gfxmenu_view_destroy (grub_gfxmenu_view_t view);

/* Set properties on the view based on settings from the specified
   theme file.  */
grub_err_t grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view,
                                         const char *theme_path);

grub_err_t grub_gui_recreate_box (grub_gfxmenu_box_t *boxptr,
                                  const char *pattern, const char *theme_dir);

void grub_gfxmenu_view_draw (grub_gfxmenu_view_t view);

48 49
void
grub_gfxmenu_redraw_menu (grub_gfxmenu_view_t view);
Colin D Bennett's avatar
Colin D Bennett committed
50

51 52 53 54 55 56
void
grub_gfxmenu_redraw_timeout (grub_gfxmenu_view_t view);

void
grub_gfxmenu_view_redraw (grub_gfxmenu_view_t view,
			  const grub_video_rect_t *region);
Colin D Bennett's avatar
Colin D Bennett committed
57

58 59 60 61 62 63 64
void 
grub_gfxmenu_clear_timeout (void *data);
void 
grub_gfxmenu_print_timeout (int timeout, void *data);
void
grub_gfxmenu_set_chosen_entry (int entry, void *data);

65 66 67 68 69 70 71 72
grub_err_t grub_font_draw_string (const char *str,
				  grub_font_t font,
				  grub_video_color_t color,
				  int left_x, int baseline_y);
int grub_font_get_string_width (grub_font_t font,
				const char *str);


Colin D Bennett's avatar
Colin D Bennett committed
73 74 75 76 77
/* Implementation details -- this should not be used outside of the
   view itself.  */

#include <grub/video.h>
#include <grub/bitmap.h>
78
#include <grub/bitmap_scale.h>
Colin D Bennett's avatar
Colin D Bennett committed
79 80 81 82 83 84 85 86 87
#include <grub/gui.h>
#include <grub/gfxwidgets.h>
#include <grub/icon_manager.h>

/* Definition of the private representation of the view.  */
struct grub_gfxmenu_view
{
  grub_video_rect_t screen;

88 89 90 91
  int need_to_check_sanity;
  grub_video_rect_t terminal_rect;
  int terminal_border;

Colin D Bennett's avatar
Colin D Bennett committed
92 93 94
  grub_font_t title_font;
  grub_font_t message_font;
  char *terminal_font_name;
95 96 97
  grub_video_rgba_color_t title_color;
  grub_video_rgba_color_t message_color;
  grub_video_rgba_color_t message_bg_color;
98 99 100 101 102
  struct grub_video_bitmap *raw_desktop_image;
  struct grub_video_bitmap *scaled_desktop_image;
  grub_video_bitmap_selection_method_t desktop_image_scale_method;
  grub_video_bitmap_h_align_t desktop_image_h_align;
  grub_video_bitmap_v_align_t desktop_image_v_align;
103
  grub_video_rgba_color_t desktop_color;
Colin D Bennett's avatar
Colin D Bennett committed
104 105 106 107 108 109 110
  grub_gfxmenu_box_t terminal_box;
  char *title_text;
  char *progress_message_text;
  char *theme_path;

  grub_gui_container_t canvas;

111 112
  int double_repaint;

113 114
  int selected;

115
  grub_video_rect_t progress_message_frame;
116 117 118 119 120 121

  grub_menu_t menu;

  int nested;

  int first_timeout;
Colin D Bennett's avatar
Colin D Bennett committed
122 123 124
};

#endif /* ! GRUB_GFXMENU_VIEW_HEADER */