Check-in for Adrian Oanca

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2917 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2003-03-15 00:04:55 +00:00
parent 0eadb1ac5c
commit d230489402
3 changed files with 1211 additions and 1126 deletions
File diff suppressed because it is too large Load Diff
+489 -459
View File
@@ -1,459 +1,489 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS // Copyright (c) 2001-2002, OpenBeOS
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation // to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, // the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the // and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions: // Software is furnished to do so, subject to the following conditions:
// //
// The above copyright notice and this permission notice shall be included in // The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software. // all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
// File Name: Window.h // File Name: Window.h
// Author: Erik Jaesler ([email protected]) // Author: Erik Jaesler ([email protected])
// DarkWyrm <[email protected]> // Description: BWindow is the base class for all windows (graphic areas
// Description: BWindow is the base class for all windows (graphic areas // displayed on-screen).
// displayed on-screen). //
//------------------------------------------------------------------------------ //
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#ifndef _WINDOW_H // NOTE(!!!) All private non virtual functions are to be renamed following
#define _WINDOW_H // this scheme: word_another_third <-> wordAnotherThird
// OBOS Team: If you use one of BWindow's private functions, please addapt to this code
class PortLink; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//------------------------------------------------------------------------------
// Standard Includes -----------------------------------------------------------
#ifndef _WINDOW_H
// System Includes ------------------------------------------------------------- #define _WINDOW_H
#include <BeBuild.h>
#include <InterfaceDefs.h> // Standard Includes -----------------------------------------------------------
#include <List.h>
#include <Looper.h> // System Includes -------------------------------------------------------------
#include <Rect.h> #include <BeBuild.h>
#include <StorageDefs.h> #include <InterfaceDefs.h>
#include <List.h>
// Project Includes ------------------------------------------------------------ #include <Looper.h>
#include <Rect.h>
// Local Includes -------------------------------------------------------------- #include <StorageDefs.h>
// Local Defines --------------------------------------------------------------- // Project Includes ------------------------------------------------------------
// Globals --------------------------------------------------------------------- // Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// window definitions ----------------------------------------------------------
// Globals ---------------------------------------------------------------------
enum window_type {
B_UNTYPED_WINDOW = 0,
B_TITLED_WINDOW = 1, // window definitions ----------------------------------------------------------
B_MODAL_WINDOW = 3,
B_DOCUMENT_WINDOW = 11, enum window_type {
B_BORDERED_WINDOW = 20, B_UNTYPED_WINDOW = 0,
B_FLOATING_WINDOW = 21 B_TITLED_WINDOW = 1,
}; B_MODAL_WINDOW = 3,
B_DOCUMENT_WINDOW = 11,
//---------------------------------------------------------------- B_BORDERED_WINDOW = 20,
B_FLOATING_WINDOW = 21
enum window_look { };
B_BORDERED_WINDOW_LOOK = 20,
B_NO_BORDER_WINDOW_LOOK = 19, //----------------------------------------------------------------
B_TITLED_WINDOW_LOOK = 1,
B_DOCUMENT_WINDOW_LOOK = 11, enum window_look {
B_MODAL_WINDOW_LOOK = 3, B_BORDERED_WINDOW_LOOK = 20,
B_FLOATING_WINDOW_LOOK = 7 B_NO_BORDER_WINDOW_LOOK = 19,
}; B_TITLED_WINDOW_LOOK = 1,
B_DOCUMENT_WINDOW_LOOK = 11,
//---------------------------------------------------------------- B_MODAL_WINDOW_LOOK = 3,
B_FLOATING_WINDOW_LOOK = 7
enum window_feel { };
B_NORMAL_WINDOW_FEEL = 0,
B_MODAL_SUBSET_WINDOW_FEEL = 2, //----------------------------------------------------------------
B_MODAL_APP_WINDOW_FEEL = 1,
B_MODAL_ALL_WINDOW_FEEL = 3, enum window_feel {
B_FLOATING_SUBSET_WINDOW_FEEL = 5, B_NORMAL_WINDOW_FEEL = 0,
B_FLOATING_APP_WINDOW_FEEL = 4, B_MODAL_SUBSET_WINDOW_FEEL = 2,
B_FLOATING_ALL_WINDOW_FEEL = 6 B_MODAL_APP_WINDOW_FEEL = 1,
}; B_MODAL_ALL_WINDOW_FEEL = 3,
B_FLOATING_SUBSET_WINDOW_FEEL = 5,
//---------------------------------------------------------------- B_FLOATING_APP_WINDOW_FEEL = 4,
B_FLOATING_ALL_WINDOW_FEEL = 6
enum window_alignment { };
B_BYTE_ALIGNMENT = 0,
B_PIXEL_ALIGNMENT = 1 //----------------------------------------------------------------
};
enum window_alignment {
//---------------------------------------------------------------- B_BYTE_ALIGNMENT = 0,
B_PIXEL_ALIGNMENT = 1
enum { };
B_NOT_MOVABLE = 0x00000001,
B_NOT_CLOSABLE = 0x00000020, //----------------------------------------------------------------
B_NOT_ZOOMABLE = 0x00000040,
B_NOT_MINIMIZABLE = 0x00004000, enum {
B_NOT_RESIZABLE = 0x00000002, B_NOT_MOVABLE = 0x00000001,
B_NOT_H_RESIZABLE = 0x00000004, B_NOT_CLOSABLE = 0x00000020,
B_NOT_V_RESIZABLE = 0x00000008, B_NOT_ZOOMABLE = 0x00000040,
B_AVOID_FRONT = 0x00000080, B_NOT_MINIMIZABLE = 0x00004000,
B_AVOID_FOCUS = 0x00002000, B_NOT_RESIZABLE = 0x00000002,
B_WILL_ACCEPT_FIRST_CLICK = 0x00000010, B_NOT_H_RESIZABLE = 0x00000004,
B_OUTLINE_RESIZE = 0x00001000, B_NOT_V_RESIZABLE = 0x00000008,
B_NO_WORKSPACE_ACTIVATION = 0x00000100, B_AVOID_FRONT = 0x00000080,
B_NOT_ANCHORED_ON_ACTIVATE = 0x00020000, B_AVOID_FOCUS = 0x00002000,
B_ASYNCHRONOUS_CONTROLS = 0x00080000, B_WILL_ACCEPT_FIRST_CLICK = 0x00000010,
B_QUIT_ON_WINDOW_CLOSE = 0x00100000 B_OUTLINE_RESIZE = 0x00001000,
}; B_NO_WORKSPACE_ACTIVATION = 0x00000100,
B_NOT_ANCHORED_ON_ACTIVATE = 0x00020000,
#define B_CURRENT_WORKSPACE 0 B_ASYNCHRONOUS_CONTROLS = 0x00080000,
#define B_ALL_WORKSPACES 0xffffffff B_QUIT_ON_WINDOW_CLOSE = 0x00100000
};
//----------------------------------------------------------------
#define B_CURRENT_WORKSPACE 0
class _BSession_; #define B_ALL_WORKSPACES 0xffffffff
class BButton;
class BMenuBar; //----------------------------------------------------------------
class BMenuItem;
class BMessage; class PortLink;
class BMessageRunner; class BButton;
class BMessenger; class BMenuBar;
class BView; class BMenuItem;
class BMessage;
struct message; class BMessageRunner;
struct _cmd_key_; class BMessenger;
struct _view_attr_; class BView;
// BWindow class --------------------------------------------------------------- struct message;
class BWindow : public BLooper { struct _cmd_key_;
struct _view_attr_;
public:
BWindow(BRect frame, // BWindow class ---------------------------------------------------------------
const char* title, class BWindow : public BLooper {
window_type type,
uint32 flags, public:
uint32 workspace = B_CURRENT_WORKSPACE); BWindow(BRect frame, //done
BWindow(BRect frame, const char* title,
const char* title, window_type type,
window_look look, uint32 flags,
window_feel feel, uint32 workspace = B_CURRENT_WORKSPACE);
uint32 flags, BWindow(BRect frame, //done, but must be maintained - call InitData(...)
uint32 workspace = B_CURRENT_WORKSPACE); const char* title,
virtual ~BWindow(); window_look look,
window_feel feel,
BWindow(BMessage* data); uint32 flags,
static BArchivable *Instantiate(BMessage* data); uint32 workspace = B_CURRENT_WORKSPACE);
virtual status_t Archive(BMessage* data, bool deep = true) const; virtual ~BWindow(); //done
virtual void Quit(); BWindow(BMessage* data); //done
void Close(); // Synonym of Quit() static BArchivable *Instantiate(BMessage* data); //done
virtual status_t Archive(BMessage* data, bool deep = true) const; //done
void AddChild(BView* child, BView* before = NULL);
bool RemoveChild(BView* child); virtual void Quit(); //done
int32 CountChildren() const; void Close(); // Synonym of Quit()
BView *ChildAt(int32 index) const;
void AddChild(BView* child, BView* before = NULL); //done
virtual void DispatchMessage(BMessage* message, BHandler* handler); bool RemoveChild(BView* child); //done
virtual void MessageReceived(BMessage* message); int32 CountChildren() const; //done
virtual void FrameMoved(BPoint new_position); BView *ChildAt(int32 index) const; //done
virtual void WorkspacesChanged(uint32 old_ws, uint32 new_ws);
virtual void WorkspaceActivated(int32 ws, bool state); virtual void DispatchMessage(BMessage* message, BHandler* handler); //done
virtual void FrameResized(float new_width, float new_height); virtual void MessageReceived(BMessage* message); //done
virtual void Minimize(bool minimize); virtual void FrameMoved(BPoint new_position); //done
virtual void Zoom( BPoint rec_position, virtual void WorkspacesChanged(uint32 old_ws, uint32 new_ws); //done
float rec_width, virtual void WorkspaceActivated(int32 ws, bool state); //done
float rec_height); virtual void FrameResized(float new_width, float new_height); //done
void Zoom(); virtual void Minimize(bool minimize); //done
void SetZoomLimits(float max_h, float max_v); virtual void Zoom( BPoint rec_position, //done
virtual void ScreenChanged(BRect screen_size, color_space depth); float rec_width,
void SetPulseRate(bigtime_t rate); float rec_height);
bigtime_t PulseRate() const; void Zoom(); //done
void AddShortcut( uint32 key, void SetZoomLimits(float maxWidth, float maxHeight); //done // changed from: SetZoomLimits(float max_h, float max_v);
uint32 modifiers, virtual void ScreenChanged(BRect screen_size, color_space depth); //done
BMessage* msg); void SetPulseRate(bigtime_t rate); //done
void AddShortcut( uint32 key, bigtime_t PulseRate() const; //done
uint32 modifiers, void AddShortcut( uint32 key, //done
BMessage* msg, uint32 modifiers,
BHandler* target); BMessage* msg);
void RemoveShortcut(uint32 key, uint32 modifiers); void AddShortcut( uint32 key, //done
void SetDefaultButton(BButton* button); uint32 modifiers,
BButton *DefaultButton() const; BMessage* msg,
virtual void MenusBeginning(); BHandler* target);
virtual void MenusEnded(); void RemoveShortcut(uint32 key, uint32 modifiers); //done
bool NeedsUpdate() const; void SetDefaultButton(BButton* button); //done
void UpdateIfNeeded(); BButton *DefaultButton() const; //done
BView *FindView(const char* view_name) const; virtual void MenusBeginning(); //done
BView *FindView(BPoint) const; virtual void MenusEnded(); //done
BView *CurrentFocus() const; bool NeedsUpdate() const; //done
void Activate(bool = true); void UpdateIfNeeded(); //done
virtual void WindowActivated(bool state); BView *FindView(const char* viewName) const; //done // changed from: FindView( const char* view_name );
void ConvertToScreen(BPoint* pt) const; BView *FindView(BPoint) const; //done
BPoint ConvertToScreen(BPoint pt) const; BView *CurrentFocus() const; //done
void ConvertFromScreen(BPoint* pt) const; void Activate(bool = true); //done
BPoint ConvertFromScreen(BPoint pt) const; virtual void WindowActivated(bool state); //done
void ConvertToScreen(BRect* rect) const; void ConvertToScreen(BPoint* pt) const; //done
BRect ConvertToScreen(BRect rect) const; BPoint ConvertToScreen(BPoint pt) const; //done
void ConvertFromScreen(BRect* rect) const; void ConvertFromScreen(BPoint* pt) const; //done
BRect ConvertFromScreen(BRect rect) const; BPoint ConvertFromScreen(BPoint pt) const; //done
void MoveBy(float dx, float dy); void ConvertToScreen(BRect* rect) const; //done
void MoveTo(BPoint); BRect ConvertToScreen(BRect rect) const; //done
void MoveTo(float x, float y); void ConvertFromScreen(BRect* rect) const; //done
void ResizeBy(float dx, float dy); BRect ConvertFromScreen(BRect rect) const; //done
void ResizeTo(float width, float height); void MoveBy(float dx, float dy); //done
virtual void Show(); void MoveTo(BPoint); //done
virtual void Hide(); void MoveTo(float x, float y); //done
bool IsHidden() const; void ResizeBy(float dx, float dy); //done
bool IsMinimized() const; void ResizeTo(float width, float height); //done
virtual void Show(); //done
void Flush() const; virtual void Hide(); //done
void Sync() const; bool IsHidden() const; //done
bool IsMinimized() const; //done
status_t SendBehind(const BWindow* window);
void Flush() const; //done
void DisableUpdates(); void Sync() const; //done
void EnableUpdates();
status_t SendBehind(const BWindow* window); //done
void BeginViewTransaction();
void EndViewTransaction(); void DisableUpdates(); //done
void EnableUpdates(); //done
BRect Bounds() const;
BRect Frame() const; void BeginViewTransaction(); //done // referred as OpenViewTransaction() in BeBook
const char *Title() const; void EndViewTransaction(); //done // referred as CommitViewTransaction() in BeBook
void SetTitle(const char* title);
bool IsFront() const; BRect Bounds() const; //done
bool IsActive() const; BRect Frame() const; //done
void SetKeyMenuBar(BMenuBar* bar); const char *Title() const; //done
BMenuBar *KeyMenuBar() const; void SetTitle(const char* title); //done
void SetSizeLimits( float min_h, bool IsFront() const; //done
float max_h, bool IsActive() const; //done
float min_v, void SetKeyMenuBar(BMenuBar* bar); //done
float max_v); BMenuBar *KeyMenuBar() const; //done
void GetSizeLimits( float* min_h, void SetSizeLimits( float minWidth, //done // changed from: SetSizeLimits(float min_h, float max_h, float min_v, float max_v);
float* max_h, float maxWidth,
float* min_v, float minHeight,
float* max_v); float maxHeight);
uint32 Workspaces() const; void GetSizeLimits( float *minWidth, //done // changed from: SetSizeLimits(float* min_h, float* max_h, float* min_v, float* max_v);
void SetWorkspaces(uint32); float *maxWidth,
BView *LastMouseMovedView() const; float *minHeight,
float *maxHeight);
virtual BHandler *ResolveSpecifier(BMessage* msg, uint32 Workspaces() const; //done
int32 index, void SetWorkspaces(uint32); //done
BMessage* specifier, BView *LastMouseMovedView() const; //done
int32 form,
const char* property); virtual BHandler *ResolveSpecifier(BMessage* msg, //done
virtual status_t GetSupportedSuites(BMessage* data); int32 index,
BMessage* specifier,
status_t AddToSubset(BWindow* window); int32 form,
status_t RemoveFromSubset(BWindow* window); const char* property);
virtual status_t GetSupportedSuites(BMessage* data); //done
virtual status_t Perform(perform_code d, void* arg);
status_t AddToSubset(BWindow* window); //done
status_t SetType(window_type type); status_t RemoveFromSubset(BWindow* window); //done
window_type Type() const;
virtual status_t Perform(perform_code d, void* arg); //done
status_t SetLook(window_look look);
window_look Look() const; status_t SetType(window_type type); //done
window_type Type() const; //done
status_t SetFeel(window_feel feel);
window_feel Feel() const; status_t SetLook(window_look look); //done
window_look Look() const; //done
status_t SetFlags(uint32);
uint32 Flags() const; status_t SetFeel(window_feel feel); //done
window_feel Feel() const; //done
bool IsModal() const;
bool IsFloating() const; status_t SetFlags(uint32); //done
uint32 Flags() const; //done
status_t SetWindowAlignment(window_alignment mode,
int32 h, bool IsModal() const; //done
int32 hOffset = 0, bool IsFloating() const; //done
int32 width = 0,
int32 widthOffset = 0, status_t SetWindowAlignment(window_alignment mode, //done
int32 v = 0, int32 h,
int32 vOffset = 0, int32 hOffset = 0,
int32 height = 0, int32 width = 0,
int32 heightOffset = 0); int32 widthOffset = 0,
status_t GetWindowAlignment(window_alignment* mode = NULL, int32 v = 0,
int32* h = NULL, int32 vOffset = 0,
int32* hOffset = NULL, int32 height = 0,
int32* width = NULL, int32 heightOffset = 0);
int32* widthOffset = NULL, status_t GetWindowAlignment(window_alignment* mode = NULL, //done
int32* v = NULL, int32* h = NULL,
int32* vOffset = NULL, int32* hOffset = NULL,
int32* height = NULL, int32* width = NULL,
int32* heightOffset = NULL) const; int32* widthOffset = NULL,
int32* v = NULL,
virtual bool QuitRequested(); int32* vOffset = NULL,
virtual thread_id Run(); int32* height = NULL,
int32* heightOffset = NULL) const;
// Private or reserved ---------------------------------------------------------
private: virtual bool QuitRequested(); //done
virtual thread_id Run(); //done
typedef BLooper inherited;
// Private or reserved ---------------------------------------------------------
friend class BApplication; private:
friend class BBitmap;
friend class BScrollBar; typedef BLooper inherited;
friend class BView;
friend class BMenuItem; friend class BApplication;
friend class BWindowScreen; friend class BBitmap;
friend class BDirectWindow; friend class BScrollBar;
friend class BFilePanel; friend class BView;
friend class _CEventPort_; friend class BMenuItem;
friend void _set_menu_sem_(BWindow* w, sem_id sem); friend class BWindowScreen;
friend status_t _safe_get_server_token_(const BLooper* , int32* ); friend class BDirectWindow;
friend class BFilePanel;
virtual void _ReservedWindow1(); friend class BHandler;
virtual void _ReservedWindow2(); friend class _BEventMask_;
virtual void _ReservedWindow3(); friend void _set_menu_sem_(BWindow* w, sem_id sem);
virtual void _ReservedWindow4(); friend status_t _safe_get_server_token_(const BLooper* , int32* );
virtual void _ReservedWindow5();
virtual void _ReservedWindow6(); virtual void _ReservedWindow1();
virtual void _ReservedWindow7(); virtual void _ReservedWindow2();
virtual void _ReservedWindow8(); virtual void _ReservedWindow3();
virtual void _ReservedWindow4();
BWindow(); virtual void _ReservedWindow5();
BWindow(BWindow&); virtual void _ReservedWindow6();
BWindow &operator=(BWindow&); virtual void _ReservedWindow7();
virtual void _ReservedWindow8();
BWindow(BRect frame, color_space depth,
uint32 bitmapFlags, int32 rowBytes); BWindow();
void InitData(BRect frame, BWindow(BWindow&);
const char* title, BWindow &operator=(BWindow&);
window_look look,
window_feel feel, BWindow(BRect frame, color_space depth, // I'm realllly curious in the things that this funtion does
uint32 flags, uint32 bitmapFlags, int32 rowBytes); // I think it's called from every constructor and sends its server counterpart (ServerWindow) the message for creating a surface(BBitmap) with certain parameters.
uint32 workspace); void InitData(BRect frame,
status_t ArchiveChildren(BMessage* data, bool deep) const; const char* title,
status_t UnarchiveChildren(BMessage* data); window_look look,
void BitmapClose(); window_feel feel,
virtual void task_looper(); uint32 flags,
void start_drag( BMessage* msg, uint32 workspace);
int32 token, status_t ArchiveChildren(BMessage* data, bool deep) const; // call made from within Archive
BPoint offset, status_t UnarchiveChildren(BMessage* data); // Instantiate(BMessage* data)->BWindow(BMessage)->UnarchiveChildren(BMessage* data)
BRect track_rect, void BitmapClose();
BHandler* reply_to); virtual void task_looper(); // thread function - it's here where app_server messages are received and converted to BMessages
void start_drag( BMessage* msg, void start_drag( BMessage* msg,
int32 token, int32 token,
BPoint offset, BPoint offset,
int32 bitmap_token, BRect track_rect,
drawing_mode dragMode, BHandler* reply_to);
BHandler* reply_to); void start_drag( BMessage* msg,
void view_builder(BView* a_view); int32 token,
void attach_builder(BView* a_view); BPoint offset,
void detach_builder(BView* a_view); int32 bitmap_token,
int32 get_server_token() const; drawing_mode dragMode,
BMessage *extract_drop(BMessage* an_event, BHandler* *target); BHandler* reply_to);
void movesize(uint32 opcode, float h, float v); void view_builder(BView* a_view); // It passes needed parameters to a BView allready created.
void attach_builder(BView* a_view); // Attaches the view
BMessage* ReadMessageFromPort(bigtime_t tout = B_INFINITE_TIMEOUT); void detach_builder(BView* a_view); // Detaches the view
int32 MessagesWaiting(); int32 get_server_token() const;
BMessage *extract_drop(BMessage* an_event, BHandler* *target);
void handle_activate(BMessage* an_event); void movesize(uint32 opcode, float h, float v);
void do_view_frame(BMessage* an_event);
void do_value_change(BMessage* an_event, BHandler* handler); BMessage* ReadMessageFromPort(bigtime_t tout = B_INFINITE_TIMEOUT); // reads a message from receive_port and passes it along with the message body to CreateMessage(void*, int32) function
void do_mouse_down(BMessage* an_event, BView* target); int32 MessagesWaiting(); // (?)# of messages waiting in the port queue
void do_mouse_moved(BMessage* an_event, BView* target);
void do_key_down(BMessage* an_event, BHandler* handler); void handle_activate(BMessage* an_event);
void do_key_up(BMessage* an_event, BHandler* handler); void do_view_frame(BMessage* an_event);
void do_menu_event(BMessage* an_event); void do_value_change(BMessage* an_event, BHandler* handler);
void do_draw_views(); void do_mouse_down(BMessage* an_event, BView* target);
virtual BMessage *ConvertToMessage(void* raw, int32 code); void do_mouse_moved(BMessage* an_event, BView* target);
_cmd_key_ *allocShortcut(uint32 key, uint32 modifiers); void do_key_down(BMessage* an_event, BHandler* handler);
_cmd_key_ *FindShortcut(uint32 key, uint32 modifiers); void do_key_up(BMessage* an_event, BHandler* handler);
void AddShortcut(uint32 key, void do_menu_event(BMessage* an_event);
uint32 modifiers, void do_draw_views();
BMenuItem* item); virtual BMessage *ConvertToMessage(void* raw, int32 code); // HUGE function - it convers PortLink messages into BMessage messages
void post_message(BMessage* message); _cmd_key_ *allocShortcut(uint32 key, uint32 modifiers);
void SetLocalTitle(const char* new_title); _cmd_key_ *FindShortcut(uint32 key, uint32 modifiers);
void enable_pulsing(bool enable); void AddShortcut(uint32 key, // !!! - and menu shortcuts to list when a menu is added
BHandler *determine_target(BMessage* msg, BHandler* target, bool pref); uint32 modifiers,
void kb_navigate(); BMenuItem* item);
void navigate_to_next(int32 direction, bool group = false); void post_message(BMessage* message);
void set_focus(BView* focus, bool notify_input_server); void SetLocalTitle(const char* new_title);
bool InUpdate(); void enable_pulsing(bool enable);
void DequeueAll(); BHandler *determine_target(BMessage* msg, BHandler* target, bool pref);
bool find_token_and_handler(BMessage* msg, void kb_navigate();
int32* token, void navigate_to_next(int32 direction, bool group = false);
BHandler* *handler); void set_focus(BView* focus, bool notify_input_server); // what does notify_input_server mean??? why???
window_type compose_type(window_look look, bool InUpdate();
window_feel feel) const; void DequeueAll();
void decompose_type(window_type type, bool find_token_and_handler(BMessage* msg,
window_look* look, int32* token,
window_feel* feel) const; BHandler* *handler);
window_type composeType(window_look look, // changed from: compose_type(...)
void SetIsFilePanel(bool panel); window_feel feel) const;
bool IsFilePanel() const; void decomposeType(window_type type, // changed from: decompose_type(...)
window_look* look,
// 3 deprecated calls window_feel* feel) const;
void AddFloater(BWindow* a_floating_window);
void RemoveFloater(BWindow* a_floating_window); void SetIsFilePanel(bool yes);
window_type WindowType() const; bool IsFilePanel() const;
// OBOS BWindow's addon functions
char *fTitle; uint32 WindowLookToInteger(window_look wl);
int32 server_token; uint32 WindowFeelToInteger(window_feel wf);
char fInUpdate; BView* buildTopView();
char f_active; void attachTopView();
short fShowLevel; void detachTopView();
uint32 fFlags; void setFocus(BView *focusView, bool notifyIputServer);
port_id send_port; bool handleBWindowKeys( BString, uint32);
port_id receive_port;
// message: B_MOUSE_UP, B_MOUSE_DOWN, B_MOUSE_MOVED
BView *top_view; void sendMessageUsingEventMask( int32 message, BPoint where );
BView *fFocus; void sendWillingBViewsPulseMsg( BView* );
BView *fLastMouseMovedView; int32 findShortcut(int32 key, int32 modifiers);
PortLink *serverlink; bool findHandler( BView* start, BHandler* handler );
BMenuBar *fKeyMenuBar; BView* findView(BView* aView, const char* viewName) const;
BButton *fDefaultButton; BView* findView(BView* aView, BPoint point) const;
BList accelList; BView* findView(BView* aView, int32 token);
int32 top_view_token;
bool pulse_enabled; void drawAllViews(BView* aView);
bool fViewsNeedPulse; // END: OBOS addon functions
bool fIsFilePanel;
bool fUnused1; // 3 deprecated calls
bigtime_t pulse_rate; void AddFloater(BWindow* a_floating_window);
bool fWaitingForMenu; void RemoveFloater(BWindow* a_floating_window);
bool fOffscreen; window_type WindowType() const;
sem_id fMenuSem;
float fMaxZoomH; char *fTitle; // set
float fMaxZoomV; int32 server_token;
float fMinWindH; bool fInTransaction; // set // changed from: char fInUpdate;
float fMinWindV; bool fActive; // changed from: char f_active;
float fMaxWindH; short fShowLevel;
float fMaxWindV; uint32 fFlags; // set
BRect fFrame;
window_look fLook; port_id send_port; // set
_view_attr_ *fCurDrawViewState; port_id receive_port; // set
window_feel fFeel;
int32 fLastViewToken; BView *top_view;
_CEventPort_* fEventPort; BView *fFocus;
BMessageRunner *fPulseRunner; BView *fLastMouseMovedView; // set
BRect fCurrentFrame; PortLink *serverLink;
BMenuBar *fKeyMenuBar; // set
uint32 _reserved[2]; // was 8 BButton *fDefaultButton; // set
#if !_PR3_COMPATIBLE_ BList accelList; // set
uint32 _more_reserved[4]; int32 fTopViewToken; // // changed from: int32 top_view_token;
#endif bool fPulseEnabled; // // changed from: bool pulse_enabled;
}; bool fViewsNeedPulse;
bool fIsFilePanel;
// inline definitions ---------------------------------------------------------- bool fUnused1;
inline void BWindow::Close() bigtime_t fPulseRate; // // changed from: bigtime_t pulse_rate;
{ bool fWaitingForMenu;
Quit(); bool fMinimized; // // changed from: bool fOffscreen;
} sem_id fMenuSem;
//------------------------------------------------------------------------------ float fMaxZoomHeight; // set // changed from: float fMaxZoomH;
float fMaxZoomWidth; // set // changed from: float fMaxZoomV;
#endif // _WINDOW_H float fMinWindHeight; // set // changed from: float fMinWindH;
float fMinWindWidth; // set // changed from: float fMinWindV;
/* float fMaxWindHeight; // set // changed from: float fMaxWindH;
* $Log $ float fMaxWindWidth; // set // changed from: float fMaxWindV;
* BRect fFrame; // set
* $Id $ window_look fLook; // set
* _view_attr_ *fCurDrawViewState;
*/ window_feel fFeel; // set
int32 fLastViewToken;
_BEventMask_* fEventMask; // changed from: _CEventPort_* fEventPort;
BMessageRunner *fPulseRunner;
BRect fCurrentFrame;
// dedicated for graphic calls
PortLink *srvGfxLink; // set
uint32 _reserved;
// uint32 _reserved[2]; // was 8
#if !_PR3_COMPATIBLE_
uint32 _more_reserved[4];
#endif
};
// inline definitions ----------------------------------------------------------
inline void BWindow::Close()
{
Quit();
}
//------------------------------------------------------------------------------
#endif // _WINDOW_H
/*
* $Log $
*
* $Id $
*
*/
+54
View File
@@ -0,0 +1,54 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: WindowAux.h
// Author: Adrian Oanca ([email protected])
// Description: BWindowAux.h contains helper definitions for BWindow class
//
//------------------------------------------------------------------------------
#ifndef _WINDOWAUX_H
#define _WINDOWAUX_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Message.h>
#include <Handler.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
struct _BCmdKey{
uint32 key;
uint32 modifiers;
BMessage* message;
BHandler* target;
};
#endif // _WINDOWAUX_H