haiku/headers/os/app/AppDefs.h

139 lines
3.6 KiB
C
Raw Normal View History

/*
* Copyright 2001-2007, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Erik Jaesler (erik@cgsoftware.com)
*/
#ifndef _APP_DEFS_H
#define _APP_DEFS_H
#include <BeBuild.h>
// Old-style cursors
extern const unsigned char B_HAND_CURSOR[];
extern const unsigned char B_I_BEAM_CURSOR[];
// New-style cursors
#ifdef __cplusplus
class BCursor;
extern const BCursor *B_CURSOR_SYSTEM_DEFAULT;
extern const BCursor *B_CURSOR_I_BEAM;
#endif
// System Message Codes
enum system_message_code {
B_ABOUT_REQUESTED = '_ABR',
B_WINDOW_ACTIVATED = '_ACT',
B_APP_ACTIVATED = '_ACT', // Same as B_WINDOW_ACTIVATED
B_ARGV_RECEIVED = '_ARG',
B_QUIT_REQUESTED = '_QRQ',
B_CLOSE_REQUESTED = '_QRQ', // Obsolete; use B_QUIT_REQUESTED
B_CANCEL = '_CNC',
B_INVALIDATE = '_IVL',
B_KEY_DOWN = '_KYD',
B_KEY_UP = '_KYU',
B_UNMAPPED_KEY_DOWN = '_UKD',
B_UNMAPPED_KEY_UP = '_UKU',
B_KEY_MAP_LOADED = '_KML',
B_LAYOUT_WINDOW = '_LAY',
B_MODIFIERS_CHANGED = '_MCH',
B_MINIMIZE = '_WMN',
B_MOUSE_DOWN = '_MDN',
B_MOUSE_MOVED = '_MMV',
B_MOUSE_ENTER_EXIT = '_MEX',
B_MOUSE_IDLE = '_MSI',
B_MOUSE_UP = '_MUP',
B_MOUSE_WHEEL_CHANGED = '_MWC',
B_OPEN_IN_WORKSPACE = '_OWS',
B_PACKAGE_UPDATE = '_PKU',
B_PRINTER_CHANGED = '_PCH',
B_PULSE = '_PUL',
B_READY_TO_RUN = '_RTR',
B_REFS_RECEIVED = '_RRC',
B_RELEASE_OVERLAY_LOCK = '_ROV',
B_ACQUIRE_OVERLAY_LOCK = '_AOV',
B_SCREEN_CHANGED = '_SCH',
B_VALUE_CHANGED = '_VCH',
B_TRANSLATOR_ADDED = '_ART',
B_TRANSLATOR_REMOVED = '_RRT',
Make sure images containing BTranslators are not unloaded early When a translator is uninstalled, BTranslatorPrivate::_RemoveTranslators is called. This method used to unload the image containing the translator after calling Release() on it resulting in several problems: - If the translator was still busy, e.g. translating something while being installed, it crashed since the image was unloaded even though its refcount was larger than 0. - Applications using code from one of the translators (e.g. its config view) would crash when the translator is uninstalled (this is bug #12005). This problem is now fixed. The roster keeps track of all translators whose image it manages (even if the translator was already removed from the roster). It also keeps a refcount to all images. When a translator's refcount drops to zero and it belonged to a roster at some point, it does not delete itself, but notifies the roster that it is ready to destruct, which then removes it from the roster if the translator is still in it, destroys the translator, decrements the refcount of the image and if the new refcount is zero, unloads the image. All of this is done in a message handler, since if the translator called TranslatorDeleted like before, the unloaded image would be referenced when the stack is walked up. Finally, the DataTranslations preflet is required to Acquire() the translator whose config view it is showing, because otherwise its refcount could be reduced to 0 and the image unloaded. BTranslatorRoster now enables users to acquire a translator by ID. By the time the translator has to be released, it might not be part of the roster anymore though. Since BTranslatorRoster tries not to give out raw pointers to the translators it manages, users who acquire a translator through a roster now are given a BTranslatorReleaseDelegate, which allows for releasing the BTranslator exactly once and then self-destructs. Signed-off-by: Axel Dörfler <axeld@pinc-software.de>
2015-11-08 18:16:05 +03:00
B_DELETE_TRANSLATOR = '_DRT',
B_VIEW_MOVED = '_VMV',
B_VIEW_RESIZED = '_VRS',
B_WINDOW_MOVED = '_WMV',
B_WINDOW_RESIZED = '_WRS',
B_WORKSPACES_CHANGED = '_WCG',
B_WORKSPACE_ACTIVATED = '_WAC',
B_ZOOM = '_WZM',
Set*UIColor, etc. The inseparable changes necessary to support live color updating across the system in a sane, safe, and performant manner. BView gains: HasSystemColors() HasDefaultColors() AdoptSystemColors() AdoptParentColors() AdoptViewColor(BView*) SetViewUIColor(color_which, float tint) SetHighUIColor(... SetLowUIColor(... ViewUIColor(float* tint) HighUIColor(... LowUIColor(... DelayedInvalidate() BWindow gains a simple helper method: IsOffscreenWindow() BMessage gains: AddColor() FindColor() GetColor() HasColor() * allegedly this API is deprecated, but I implemented it anyway ReplaceColor() SetColor() Previous private ColorTools methods are made public and moved into GraphicsDefs: mix_color, blend_color, disable_color These are fully compatible with BeOS dan0 R5.1 methods and are just code cleanup of BeOS example code under the OpenTracker license. In addition, four new colors are created: B_LINK_TEXT_COLOR B_LINK_HOVER_COLOR B_LINK_ACTIVE_COLOR B_LINK_VISITED_COLOR These changes are documented in their proper user documentation files. In addition, due to a history rewrite, B_FOLLOW_LEFT_TOP has been defined and used in lieu of B_FOLLOW_TOP | B_FOLLOW_LEFT and is included in this commit. On the app_server side, the following has changed: Add DelayedMessage - a system by which messages can be sent at a scheduled time, and can also be merged according to set rules. A single thread is used to service the message queue and multiple recipients can be set for each message. Desktop gains the ability to add message ports to a DelayedMessage so that said messages can target either all applications or all windows, as needed. Desktop maintains a BMessage which is used to queue up all pending color changes and the delayed messaging system is used to enact these changes after a short period of time has passed. This prevents abuse and allows the system to merge repeated set_ui_color events into one event for client applications, improving performance drastically. In addition, B_COLORS_UPDATED is sent to the BApplication, which forwards the message to each BWindow. This is done to improve performance over having the app_server independently informing each window. Decorator changes are live now, which required some reworking. Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2015-12-10 21:52:48 +03:00
B_COLORS_UPDATED = '_CLU',
B_FONTS_UPDATED = '_FNU',
B_TRACKER_ADDON_MESSAGE = '_TAM',
_APP_MENU_ = '_AMN',
_BROWSER_MENUS_ = '_BRM',
_MENU_EVENT_ = '_MEV',
_PING_ = '_PBL',
_QUIT_ = '_QIT',
_VOLUME_MOUNTED_ = '_NVL',
_VOLUME_UNMOUNTED_ = '_VRM',
_MESSAGE_DROPPED_ = '_MDP',
_DISPOSE_DRAG_ = '_DPD',
_MENUS_DONE_ = '_MND',
_SHOW_DRAG_HANDLES_ = '_SDH',
_EVENTS_PENDING_ = '_EVP',
_UPDATE_ = '_UPD',
_UPDATE_IF_NEEDED_ = '_UPN',
_PRINTER_INFO_ = '_PIN',
_SETUP_PRINTER_ = '_SUP',
_SELECT_PRINTER_ = '_PSL'
// Media Kit reserves all reserved codes starting in '_TR'
};
// Other Commands
enum command_code {
B_SET_PROPERTY = 'PSET',
B_GET_PROPERTY = 'PGET',
B_CREATE_PROPERTY = 'PCRT',
B_DELETE_PROPERTY = 'PDEL',
B_COUNT_PROPERTIES = 'PCNT',
B_EXECUTE_PROPERTY = 'PEXE',
B_GET_SUPPORTED_SUITES = 'SUIT',
B_UNDO = 'UNDO',
B_REDO = 'REDO',
B_CUT = 'CCUT',
B_COPY = 'COPY',
B_PASTE = 'PSTE',
B_SELECT_ALL = 'SALL',
B_SAVE_REQUESTED = 'SAVE',
B_MESSAGE_NOT_UNDERSTOOD = 'MNOT',
B_NO_REPLY = 'NONE',
B_REPLY = 'RPLY',
B_SIMPLE_DATA = 'DATA',
B_MIME_DATA = 'MIME',
B_ARCHIVED_OBJECT = 'ARCV',
B_UPDATE_STATUS_BAR = 'SBUP',
B_RESET_STATUS_BAR = 'SBRS',
B_NODE_MONITOR = 'NDMN',
B_QUERY_UPDATE = 'QUPD',
B_ENDORSABLE = 'ENDO',
B_COPY_TARGET = 'DDCP',
B_MOVE_TARGET = 'DDMV',
B_TRASH_TARGET = 'DDRM',
B_LINK_TARGET = 'DDLN',
B_INPUT_DEVICES_CHANGED = 'IDCH',
B_INPUT_METHOD_EVENT = 'IMEV',
B_WINDOW_MOVE_TO = 'WDMT',
B_WINDOW_MOVE_BY = 'WDMB',
B_SILENT_RELAUNCH = 'AREL',
B_OBSERVER_NOTICE_CHANGE = 'NTCH',
B_CONTROL_INVOKED = 'CIVK',
B_CONTROL_MODIFIED = 'CMOD'
// Media Kit reserves all reserved codes starting in 'TRI'
};
#endif // _APP_DEFS_H