GEOS SDK TechDocs
|
|
3.2 Managing the Edit Menu
|
3.4 Handling Cut and Copy
As stated above, most applications will simply let a GenEditControl object create and maintain their Edit menu.
GenEditControlClass
is a subclass of
GenControlClass
(see the Controllers chapter for usage of controllers in general).
The GenEditControl object can provide triggers and/or tools for Undo, Cut, Copy, Paste, Select All, and Delete operations. These operations must all be handled by your application, of course, just as if you did not use a GenEditControl; using this controller, however, simplifies your UI programming and allows the Edit tools to be used by the GenToolControl.
The features of the GenEditControl are listed below (they are flags of the
GECFeatures
record type):
MSG_META_UNDO
to the application's target.
MSG_META_CLIPBOARD_CUT
to the application's target.
MSG_META_CLIPBOARD_COPY
to the application's target.
MSG_META_CLIPBOARD_PASTE
to the application's target.
MSG_META_SELECT_ALL
to the applications' target.
MSG_META_DELETE
to the application's target.The GenEditControl also provides an equivalent set of tools. Each tool executes the exact same functions as the analogous feature; see GenEditControl Features and Tools for the listing of the features and tools as well as the standard settings.
The GenEditControl handles two different notification types: GWNT_SELECT_STATE_CHANGE, sent when the selection state changes, and GWNT_UNDO_STATE_CHANGE, sent when a state change in the Undo status occurs. In both cases, the GenEditControl will appropriately update the Cut, Copy, Paste, Delete, and Undo triggers (the Select All trigger will always be enabled).
Code Display 7-6 GenEditControl Features and Tools
/* This display shows the features and tools records of GenEditControlClass, as * well as the default settings and instance data. */
/* GenEditControlClass features */ typedef WordFlags GECFeatures; #define GECF_UNDO 0x0020 /* MSG_META_UNDO */ #define GECF_CUT 0x0010 /* MSG_META_CLIPBOARD_CUT */ #define GECF_COPY 0x0008 /* MSG_META_CLIPBOARD_COPY */ #define GECF_PASTE 0x0004 /* MSG_META_CLIPBOARD_PASTE */ #define GECF_SELECT_ALL 0x0002 /* MSG_META_SELECT_ALL */ #define GECF_DELETE 0x0001 /* MSG_META_DELETE */
#define GEC_DEFAULT_FEATURES (GECF_UNDO | GECF_CUT | GECF_COPY | \ GECF_PASTE | GECF_SELECT_ALL | GECF_DELETE)
/* GenEditControlClass tools */ typedef WordFlags GECToolboxFeatures; #define GECTF_UNDO 0x0020 /* MSG_META_UNDO */ #define GECTF_CUT 0x0010 /* MSG_META_CLIPBOARD_CUT */ #define GECTF_COPY 0x0008 /* MSG_META_CLIPBOARD_COPY */ #define GECTF_PASTE 0x0004 /* MSG_META_CLIPBOARD_PASTE */ #define GECTF_SELECT_ALL 0x0002 /* MSG_META_SELECT_ALL */ #define GECTF_DELETE 0x0001 /* MSG_META_DELETE */
#define GEC_DEFAULT_TOOLBOX_FEATURES (GECTF_UNDO | GECTF_CUT | GECTF_COPY | GECTF_PASTE | GECTF_SELECT_ALL | GECTF_DELETE)
/* GenEditControlClass Instance Data Settings */
@default GCI_output = (TO_APP_TARGET); /* Send output to the target */
@default GI_states = (@default | GS_ENABLED);
@default GI_attrs = (@default | GA_KBD_SEARCH_PATH);
GEOS SDK TechDocs
|
|
3.2 Managing the Edit Menu
|
3.4 Handling Cut and Copy