⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menus.h

📁 SEAL是DOS 下的32位保护模式的GUI程序
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************************
 * SEAL 2.0                                                       *
 * Copyright (c) 1999-2002 SEAL Developers. All Rights Reserved.  *
 *                                                                *
 * Web site: http://sealsystem.sourceforge.net/                   *
 * E-mail (current maintainer): orudge@users.sourceforge.net      *
 ******************************************************************/

/*
   This program 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 2 of the License, or
   (at your option) any later version.

   This program 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 this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __MENUS_H_INCLUDED__
#define __MENUS_H_INCLUDED__

#ifdef __cplusplus
extern "C" {
#endif


/* menu flags */

/* menu is vertical */
#define MF_VERMENU        0x01
/* menu is horizontal */
#define MF_HORMENU        0x02
/* menu starts from bottom */
#define MF_BOTTOM_MENU    0x04


/* menu action flags */

#define MA_NONE             1
#define MA_HMFORWARD       -6
#define MA_OTHER           -5
#define MA_ESC             -4
#define MA_END             -3
#define MA_BACKWARD        -2
#define MA_COMMAND         -1
#define MA_IAMSUBMENU       2
#define MA_SUBMENU          3
#define MA_FORWARD          4
#define MA_ENTER            5


/* standard menu sizes */

/* diference size */
#define STANDARD_MENULINE_SIZE         7
/* horizontal line width */
#define STANDARD_MENULINE_WIDTH       25
/* size between text and start of icon */
#define STANDARD_MENUDIFF_SIZE        25
/* size between left and right origins */
#define STANDARD_MENUBOUNDSDIFF_SIZE  20



/* menuitem flags */

/* none flags in the item */
#define MIF_NONE      0x00000
/* item will be checkable */
#define MIF_CHECK     0x00001
/* item was pressed and now it's enable */
#define MIF_CHECKOK   0x00002
/* item has own memory of the icon.  */
#define MIF_SELFICON  0x00004


/*
   palette of menuview object :
   ----------------------------

   standard colors from Seal.ini file, from section [colors] :

   index of palette        name in [colors]

   0                       menu_background
   1                       menu_background_gradient
   2                       menu_pasive_caption
   3                       menu_active_title
   4                       menu_active_caption
   5                       menu_disable_caption
*/
extern l_color  pal_menu[];

/*
   palette of hormenu object :
   ---------------------------

   standard colors from Seal.ini file, from section [colors] :

   index of palette        name in [colors]

   0                       menu_horizontal_background
   1                       menu_horizontal_background_gradient
   2                       menu_pasive_caption
   3                       menu_active_title
   4                       menu_active_caption
   5                       menu_disable_caption
*/
extern l_color  pal_hormenu[];

typedef struct t_menu     *p_menu;
typedef struct t_menuitem *p_menuitem;


#define standard_menuicon_size   system_item_size
#define standard_menuitem_size   system_item_size+4

/* standard menu item font */
extern l_font* standard_menuitem_font;


/* t_menu structure */

typedef struct t_menu {

  /* point to all items in the menu */
  p_menuitem   items;
  /* point to last selected item in the menu */
  p_menuitem   current;

} t_menu;



/* t_menuitem structure */

typedef struct t_menuitem {

  /* point to the next menuitem in the menu. if NULL, this is the last item */
  p_menuitem next;

  /* text in the item */
  l_text     name;
  /* text in the right of the item. shows HOTKEY of item */
  l_text     param;
  /* keycode of the hotkey for this item */
  l_int      hotkey;
  /* message, that's called whenever is item pressed. If the item is sub-menu,
     this contains MSG_NOTHING
  */
  l_dword    message;
  /* true if item is enable, otherwise contains false */
  l_bool     enable;
  /* if this entry is true, this item was pressed. */
  l_bool     lastcall;
  /* text to be visible, wnehever mouse..+CTRL+F1 is pressed under the item */
  l_text     info_text;
  /* flags of the item, see MIF_XXXX above. */
  l_int      flags;

  /* font of the item */
  l_font    *font;
  /* font for the symbol, that's placed on the left in the item */
  l_font    *font_symbol;
  /* symbol, that's placed on the left in the item */
  l_byte     char_symbol;
  /* we can use symbol or icon, icon is the 16,32 bitmap. if this item point to
     the bitmap that was created only for this item, then (flags) must contains
     MIF_SELFICON flag
  */
  BITMAP    *icon;

  /* reserved for next versions */
  l_char     reserved[16];

  /* if the t_menuitem.message is MSG_NOTHING, this point to sub-menu */
  p_menu     submenu;

} t_menuitem;



typedef struct t_menuview *p_menuview;


/* t_menuview */

/*
  object t_menuview is used for showing vertical menu or ANY menus that's inherited
  from this one.
*/

typedef struct t_menuview {

  /* inherite variables / functions from t_view and t_object class */
  struct t_view  obclass;

  /* pointer to menu items */
  p_menu         menu;
  /* internal variable */
  l_char         action;
  /* indicates (y) distance between two items in vertical menu, in horizontal (x) */
  t_point        between;
  /* (y) size of the item */
  l_rect         item_size;
  /* saved desktop. this desktop is saved whenever is menu showed and freed when the
     menu is hiden.
  */
  BITMAP        *safe_desktop;

  /* sub-menu of this menu */
  p_menuview     sub_menu;
  /* parent-menu of this menu */
  p_menuview     parent_menu;

  /* indicated flags of the menu, that can be one of MF_XXXX, see above. */
  l_int          flags;
  /* true if process is inside the menu */
  l_bool         inside;

  /* save desktop under menu before menu showing */
  void        (*save_desktop) ( p_menuview o );

  /* return order of the item (p) */
  l_int       (*at) ( p_menuview o, p_menuitem p );

  /* return item defined by index "item" */
  p_menuitem  (*index_of) ( p_menuview o, l_int item );

  /* draw item "item" */
  void        (*draw_item) ( p_menuview o, p_menuitem item );

  /* draw selected item */
  void        (*draw_current_item) ( p_menuview o );

  /* get area of item "item" moved from r.a.x, r.a.y */
  t_rect      (*get_item_box_ex) ( p_menuview o, p_menuitem item, t_rect r );

  /* get area of item "item" */
  t_rect      (*get_item_box) ( p_menuview o, p_menuitem item );

  /* get area of item "item" specific for the mouse. */
  t_rect      (*get_mouseitem_box) ( p_menuview o, p_menuitem item );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -