📄 panel_impl.h
字号:
/* @(#)panel_impl.h 1.1 92/07/30 SMI *//*************************************************************************//* panel_impl.h *//* Copyright (c) 1985 by Sun Microsystems, Inc. *//*************************************************************************/#ifndef panel_impl_DEFINED#define panel_impl_DEFINED#ifdef menu_SKIP#undef menu_SKIP#endif menu_SKIP#ifdef lint#ifdef menu_DEFINED#define menu_SKIP#else#define menu_DEFINED#endif menu_DEFINED#endif lint#ifndef menu_SKIP#include <stdio.h>#include <sunwindow/window_hs.h>#include <suntool/tool_struct.h>#include <suntool/panel.h>#include <suntool/scrollbar.h>#include <suntool/selection_svc.h>#include <suntool/help.h>/*************************************************************************//* per item status flags *//*************************************************************************/#define IS_PANEL 0x00000001 /* object is a panel */#define IS_ITEM 0x00000002 /* object is an item */#define HIDDEN 0x00000004 /* item is not currently displayed */#define ITEM_X_FIXED 0x00000008 /* item's x coord fixed by user*/#define ITEM_Y_FIXED 0x00000010 /* item's y coord fixed by user*/#define LABEL_X_FIXED 0x00000020 /* label x coord fixed by user */#define LABEL_Y_FIXED 0x00000040 /* label y coord fixed by user */#define VALUE_X_FIXED 0x00000080 /* value x coord fixed by user */#define VALUE_Y_FIXED 0x00000100 /* value y coord fixed by user */#define WANTS_KEY 0x00000400 /* item wants keystroke events */#define LABEL_BOLD 0x00000800 /* for panel-wide setting */#define VALUE_BOLD 0x00001000 /* for panel-wide setting */#define ADJUSTABLE 0x00002000 /* temporarily out of service */#define SHOW_MENU_MARK 0x00004000 /* show the menu mark in the menu */#define ITEM_NOT_SCROLLABLE 0x00008000 /* item will not scroll */#define SHOW_MENU 0x00010000 /* show the menu */#define LABEL_SHADED 0x00020000 /* shade the label */#define OPS_SET 0x00040000 /* ops vector has been altered */#define hidden(ip) ((ip)->flags & HIDDEN)#define adjustable(ip) ((ip)->flags & ADJUSTABLE)#define item_fixed(ip) ((ip)->flags & (ITEM_X_FIXED | ITEM_Y_FIXED))#define label_fixed(ip) ((ip)->flags & (LABEL_X_FIXED|LABEL_Y_FIXED))#define value_fixed(ip) ((ip)->flags & (VALUE_X_FIXED|VALUE_Y_FIXED))#define item_not_scrollable(ip) ((ip)->flags & ITEM_NOT_SCROLLABLE)#define wants_key(object) ((object)->flags & WANTS_KEY)#define label_bold_flag(object) ((object)->flags & LABEL_BOLD)#define label_shaded_flag(object) ((object)->flags & LABEL_SHADED)#define value_bold_flag(object) ((object)->flags & VALUE_BOLD)#define is_panel(object) ((object)->flags & IS_PANEL)#define is_item(object) ((object)->flags & IS_ITEM)#define show_menu_mark(object) ((object)->flags & SHOW_MENU_MARK)#define show_menu(object) ((object)->flags & SHOW_MENU)#define ops_set(object) ((object)->flags & OPS_SET)/*************************************************************************//* per panel status flags *//*************************************************************************/#define BLINKING 0x00000001#define TIMING 0x00000002#define SCROLL_V_NORMALIZE 0x00000004#define SCROLL_H_NORMALIZE 0x00000008#define SHOW_MENU_SET 0x00000010#define USING_NOTIFIER 0x00000020#define USING_WRAPPER 0x00000040#define ADJUST_IS_PENDING_DELETE 0x00000200#define blinking(panel) ((panel)->status & BLINKING)#define timing(panel) ((panel)->status & TIMING)#define v_normalization_desired(panel) ((panel)->status & SCROLL_V_NORMALIZE)#define h_normalization_desired(panel) ((panel)->status & SCROLL_H_NORMALIZE)#define show_menu_set(panel) ((panel)->status & SHOW_MENU_SET)#define using_notifier(panel) ((panel)->status & USING_NOTIFIER)#define using_wrapper(panel) ((panel)->status & USING_WRAPPER)#define adjust_is_pending_delete(panel) ((panel)->status & ADJUST_IS_PENDING_DELETE)/*************************************************************************//* macros for scrolling *//*************************************************************************/#define view_width(panel) ((panel)->rect.r_width - (panel)->v_bar_width)#define view_height(panel) ((panel)->rect.r_height - (panel)->h_bar_width)/*************************************************************************//* miscellaneous constants *//*************************************************************************/#define BIG 0x7FFF#define KEY_NEXT KEY_BOTTOMRIGHT#define ITEM_X_GAP 10 /* # of x pixels between items */#define ITEM_Y_GAP 5 /* # of y pixels between items rows */#define LABEL_X_GAP 8 /* used in panel_attr.c */#define LABEL_Y_GAP 4 /* used in panel_attr.c *//* * Definitions to support the default user interface. */#define TOP_KEY ACTION_FRONT#define BOTTOM_KEY ACTION_BACK#define PUT_KEY ACTION_COPY#define OPEN_KEY ACTION_OPEN#define CLOSE_KEY ACTION_CLOSE#define GET_KEY ACTION_PASTE#define FIND_KEY ACTION_FIND_FORWARD#define DELETE_KEY ACTION_CUT#define AGAIN_KEY ACTION_AGAIN#define PROPS_KEY ACTION_PROPS#define HELP_KEY ACTION_HELP/*************************************************************************//* structures *//*************************************************************************/typedef struct panel *panel_handle;typedef struct panel_item *panel_item_handle;typedef struct panel_image *panel_image_handle;/*********************** panel menu ***************************************/struct menu { int m_imagetype; /* interpretation of m_imagedata */#define MENU_IMAGESTRING 0x00 /* imagedata is char * */#define MENU_GRAPHIC 0x01 /* imagedata is pixrect * */ caddr_t m_imagedata; /* pointer to display data for header */ int m_itemcount; /* number of menuitems in m_items */ struct menuitem *m_items; /* array of menuitems */ struct menu *m_next; /* link to another menu */ caddr_t m_data; /* menu private data (initialize to 0)*/};struct menuitem { int mi_imagetype; /* interpretation of mi_imagedata */ caddr_t mi_imagedata; /* pointer to display data for item */ caddr_t mi_data; /* item specific data */};/*********************** panel_image **************************************/#define IM_PIXRECT 2 /* pixrect */#define IM_STRING 3 /* string */struct panel_image { u_int im_type; u_int shaded : 1; /* true to shade the image */ union { struct { char *text; Pixfont *font; short bold; /* TRUE if text should be bold */ } t; /* IM_STRING arm */ Pixrect *pixrect; /* IM_PIXRECT arm */ } im_value;};#define image_type(image) ((image)->im_type)#define image_shaded(image) ((image)->shaded)#define is_string(image) (image_type(image) == IM_STRING)#define is_pixrect(image) (image_type(image) == IM_PIXRECT)#define image_string(image) ((image)->im_value.t.text)#define image_font(image) ((image)->im_value.t.font)#define image_bold(image) ((image)->im_value.t.bold)#define image_pixrect(image) ((image)->im_value.pixrect)#define image_set_type(image, type) (image_type(image) = type)#define image_set_string(image, string) (image_string(image) = (string))#define image_set_pixrect(image, pixrect) (image_pixrect(image) = (pixrect))#define image_set_font(image, font) (image_font(image) = (font))#define image_set_bold(image, bold) (image_bold(image) = (bold) != 0)#define image_set_shaded(image, shaded) (image_shaded(image) = (shaded) != 0)/******************* selection info ****************************************/struct panel_selection { Seln_rank rank; /* SELN_{PRIMARY, SECONDARY, CARET} */ u_int is_null;/* TRUE if the selection has no chars */ panel_item_handle ip; /* item with the selection */};typedef struct panel_selection *panel_selection_handle;#define panel_seln(panel, rank) (&((panel)->selections[(u_int)(rank)]))/****************** ops vector for panels & items *****************************//* Note that the null_ops static struct * in panel_public.c must be updated when * this structure is changed. */struct panel_ops { int (*handle_event)(); int (*begin_preview)(); int (*update_preview)(); int (*cancel_preview)(); int (*accept_preview)(); int (*accept_menu)(); int (*accept_key)(); int (*paint)(); int (*destroy)(); caddr_t (*get_attr)(); int (*set_attr)(); caddr_t (*remove)(); caddr_t (*restore)(); int (*layout)();};typedef struct panel_ops *panel_ops_handle;/***************************** panel **************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -