Rewrote PopUpMenu.h and MenuBar.h. Adjusted source files accordingly.
Added license to SeparatorItem.h git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22759 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,13 +1,7 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: Menubar.h
|
||||
/
|
||||
/ Description: BMenuBar is a menu that's at the root of a menu hierarchy.
|
||||
/
|
||||
/ Copyright 1994-98, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _MENU_BAR_H
|
||||
#define _MENU_BAR_H
|
||||
|
||||
@@ -16,8 +10,6 @@
|
||||
#include <Menu.h>
|
||||
#include <OS.h>
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- BmenuBar declarations ------------------------------------*/
|
||||
|
||||
enum menu_bar_border {
|
||||
B_BORDER_FRAME,
|
||||
@@ -30,100 +22,90 @@ class BWindow;
|
||||
class BMenuItem;
|
||||
class BMenuField;
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- BMenuBar class -------------------------------------------*/
|
||||
|
||||
class BMenuBar : public BMenu
|
||||
{
|
||||
public:
|
||||
BMenuBar(BRect frame,
|
||||
const char *title,
|
||||
uint32 resizeMask =
|
||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
|
||||
menu_layout layout = B_ITEMS_IN_ROW,
|
||||
bool resizeToFit = true);
|
||||
BMenuBar(const char *title,
|
||||
menu_layout layout = B_ITEMS_IN_ROW,
|
||||
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS);
|
||||
BMenuBar(BMessage *data);
|
||||
virtual ~BMenuBar();
|
||||
static BArchivable *Instantiate(BMessage *data);
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
class BMenuBar : public BMenu {
|
||||
public:
|
||||
BMenuBar(BRect frame, const char *title,
|
||||
uint32 resizeMask = B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
|
||||
menu_layout layout = B_ITEMS_IN_ROW,
|
||||
bool resizeToFit = true);
|
||||
BMenuBar(const char *title, menu_layout layout = B_ITEMS_IN_ROW,
|
||||
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS);
|
||||
BMenuBar(BMessage *data);
|
||||
virtual ~BMenuBar();
|
||||
|
||||
static BArchivable* Instantiate(BMessage *data);
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
|
||||
virtual void SetBorder(menu_bar_border border);
|
||||
menu_bar_border Border() const;
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void WindowActivated(bool state);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void FrameMoved(BPoint new_position);
|
||||
virtual void FrameResized(float new_width, float new_height);
|
||||
virtual void SetBorder(menu_bar_border border);
|
||||
menu_bar_border Border() const;
|
||||
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void WindowActivated(bool state);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void FrameMoved(BPoint newPosition);
|
||||
virtual void FrameResized(float newWidth, float newHeight);
|
||||
|
||||
virtual void Show();
|
||||
virtual void Hide();
|
||||
|
||||
virtual void Show();
|
||||
virtual void Hide();
|
||||
virtual BHandler* ResolveSpecifier(BMessage *message, int32 index,
|
||||
BMessage *specifier, int32 form,
|
||||
const char *property);
|
||||
virtual status_t GetSupportedSuites(BMessage *data);
|
||||
|
||||
virtual BHandler *ResolveSpecifier(BMessage *msg,
|
||||
int32 index,
|
||||
BMessage *specifier,
|
||||
int32 form,
|
||||
const char *property);
|
||||
virtual status_t GetSupportedSuites(BMessage *data);
|
||||
virtual void ResizeToPreferred();
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void MakeFocus(bool state = true);
|
||||
virtual void AllAttached();
|
||||
virtual void AllDetached();
|
||||
|
||||
|
||||
virtual void ResizeToPreferred();
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void MakeFocus(bool state = true);
|
||||
virtual void AllAttached();
|
||||
virtual void AllDetached();
|
||||
// layout related
|
||||
virtual BSize MinSize();
|
||||
virtual BSize MaxSize();
|
||||
virtual BSize PreferredSize();
|
||||
|
||||
virtual status_t Perform(perform_code code, void *arg);
|
||||
|
||||
private:
|
||||
friend class BWindow;
|
||||
friend class BMenuField;
|
||||
friend class BMenu;
|
||||
|
||||
// layout related
|
||||
virtual BSize MinSize();
|
||||
virtual BSize MaxSize();
|
||||
virtual BSize PreferredSize();
|
||||
virtual void _ReservedMenuBar1();
|
||||
virtual void _ReservedMenuBar2();
|
||||
virtual void _ReservedMenuBar3();
|
||||
virtual void _ReservedMenuBar4();
|
||||
|
||||
/*----- Private or reserved -----------------------------------------*/
|
||||
virtual status_t Perform(perform_code d, void *arg);
|
||||
BMenuBar &operator=(const BMenuBar &);
|
||||
|
||||
private:
|
||||
friend class BWindow;
|
||||
friend class BMenuItem;
|
||||
friend class BMenuField;
|
||||
friend class BMenu;
|
||||
// TODO: Tracker uses this function so we can't change
|
||||
// its signature without breaking it
|
||||
void StartMenuBar(int32 menuIndex, bool sticky = true,
|
||||
bool showMenu = false,
|
||||
BRect *special_rect = NULL);
|
||||
|
||||
static int32 _TrackTask(void *arg);
|
||||
BMenuItem *_Track(int32 *action, int32 startIndex = -1,
|
||||
bool showMenu = false);
|
||||
void _StealFocus();
|
||||
void _RestoreFocus();
|
||||
void _InitData(menu_layout layout);
|
||||
|
||||
virtual void _ReservedMenuBar1();
|
||||
virtual void _ReservedMenuBar2();
|
||||
virtual void _ReservedMenuBar3();
|
||||
virtual void _ReservedMenuBar4();
|
||||
menu_bar_border fBorder;
|
||||
thread_id fTrackingPID;
|
||||
int32 fPrevFocusToken;
|
||||
sem_id fMenuSem;
|
||||
BRect* fLastBounds;
|
||||
uint32 _reserved[2]; // was 3
|
||||
|
||||
BMenuBar &operator=(const BMenuBar &);
|
||||
|
||||
void StartMenuBar( int32 menuIndex,
|
||||
bool sticky = true,
|
||||
bool show_menu = false,
|
||||
BRect *special_rect = NULL);
|
||||
static long TrackTask(void *arg);
|
||||
BMenuItem *Track( int32 *action,
|
||||
int32 startIndex = -1,
|
||||
bool showMenu = false);
|
||||
void StealFocus();
|
||||
void RestoreFocus();
|
||||
void InitData(menu_layout layout);
|
||||
|
||||
menu_bar_border fBorder;
|
||||
thread_id fTrackingPID;
|
||||
int32 fPrevFocusToken;
|
||||
sem_id fMenuSem;
|
||||
BRect* fLastBounds;
|
||||
uint32 _reserved[2]; // was 3
|
||||
|
||||
bool fTracking;
|
||||
bool fTracking;
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _MENU_BAR_H */
|
||||
|
||||
@@ -1,90 +1,75 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: PopUpMenu.h
|
||||
/
|
||||
/ Description: BPopUpMenu represents a menu that pops up when you
|
||||
/ activate it.
|
||||
/
|
||||
/ Copyright 1994-98, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _POP_UP_MENU_H
|
||||
#define _POP_UP_MENU_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <Menu.h>
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- BPopUpMenu class -----------------------------------------*/
|
||||
class BPopUpMenu : public BMenu {
|
||||
public:
|
||||
BPopUpMenu(const char *title, bool radioMode = true,
|
||||
bool autoRename = true,
|
||||
menu_layout layout = B_ITEMS_IN_COLUMN);
|
||||
BPopUpMenu(BMessage *data);
|
||||
virtual ~BPopUpMenu();
|
||||
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
static BArchivable* Instantiate(BMessage *data);
|
||||
|
||||
class BPopUpMenu : public BMenu
|
||||
{
|
||||
public:
|
||||
BPopUpMenu( const char *title,
|
||||
bool radioMode = true,
|
||||
bool autoRename = true,
|
||||
menu_layout layout = B_ITEMS_IN_COLUMN
|
||||
);
|
||||
BPopUpMenu(BMessage *data);
|
||||
virtual ~BPopUpMenu();
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
static BArchivable *Instantiate(BMessage *data);
|
||||
|
||||
BMenuItem *Go(BPoint where,
|
||||
bool delivers_message = false,
|
||||
bool open_anyway = false,
|
||||
BMenuItem* Go(BPoint where, bool autoInvoke = false,
|
||||
bool keepOpen = false,
|
||||
bool async = false);
|
||||
BMenuItem *Go(BPoint where,
|
||||
bool delivers_message,
|
||||
bool open_anyway,
|
||||
BRect click_to_open,
|
||||
BMenuItem* Go(BPoint where, bool autoInvoke,
|
||||
bool keepOpen,
|
||||
BRect openRect,
|
||||
bool async = false);
|
||||
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
virtual void MouseDown(BPoint pt);
|
||||
virtual void MouseUp(BPoint pt);
|
||||
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void FrameMoved(BPoint new_position);
|
||||
virtual void FrameResized(float new_width, float new_height);
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void MouseDown(BPoint point);
|
||||
virtual void MouseUp(BPoint point);
|
||||
virtual void MouseMoved(BPoint point, uint32 code,
|
||||
const BMessage *message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void FrameMoved(BPoint newPosition);
|
||||
virtual void FrameResized(float newWidth, float newHeight);
|
||||
|
||||
virtual BHandler *ResolveSpecifier(BMessage *msg,
|
||||
int32 index,
|
||||
BMessage *specifier,
|
||||
int32 form,
|
||||
const char *property);
|
||||
virtual status_t GetSupportedSuites(BMessage *data);
|
||||
virtual BHandler* ResolveSpecifier(BMessage *message, int32 index,
|
||||
BMessage *specifier, int32 form,
|
||||
const char *property);
|
||||
virtual status_t GetSupportedSuites(BMessage *data);
|
||||
|
||||
virtual status_t Perform(perform_code d, void *arg);
|
||||
virtual status_t Perform(perform_code code, void *arg);
|
||||
|
||||
virtual void ResizeToPreferred();
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void MakeFocus(bool state = true);
|
||||
virtual void AllAttached();
|
||||
virtual void AllDetached();
|
||||
virtual void ResizeToPreferred();
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void MakeFocus(bool state = true);
|
||||
virtual void AllAttached();
|
||||
virtual void AllDetached();
|
||||
|
||||
void SetAsyncAutoDestruct(bool state);
|
||||
bool AsyncAutoDestruct() const;
|
||||
void SetAsyncAutoDestruct(bool state);
|
||||
bool AsyncAutoDestruct() const;
|
||||
|
||||
protected:
|
||||
virtual BPoint ScreenLocation();
|
||||
protected:
|
||||
virtual BPoint ScreenLocation();
|
||||
|
||||
virtual void _ReservedPopUpMenu1();
|
||||
virtual void _ReservedPopUpMenu2();
|
||||
virtual void _ReservedPopUpMenu3();
|
||||
virtual void _ReservedPopUpMenu1();
|
||||
virtual void _ReservedPopUpMenu2();
|
||||
virtual void _ReservedPopUpMenu3();
|
||||
|
||||
BPopUpMenu &operator=(const BPopUpMenu &);
|
||||
|
||||
/*----- Private or reserved -----------------------------------------*/
|
||||
private:
|
||||
private:
|
||||
BMenuItem *_Go(BPoint where, bool autoInvoke, bool startOpened,
|
||||
BRect *specialRect, bool async);
|
||||
BMenuItem *_StartTrack(BPoint where, bool autoInvoke, bool startOpened, BRect *specialRect);
|
||||
BMenuItem *_StartTrack(BPoint where, bool autoInvoke,
|
||||
bool startOpened, BRect *specialRect);
|
||||
BMenuItem *_WaitMenu(void *data);
|
||||
|
||||
static int32 _thread_entry(void *);
|
||||
static int32 _thread_entry(void *);
|
||||
|
||||
BPoint fWhere;
|
||||
bool fUseWhere;
|
||||
@@ -95,7 +80,5 @@ static int32 _thread_entry(void *);
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _POP_UP_MENU_H */
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* Copyright 2001-2007, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
#ifndef _SEPARATOR_ITEM_H
|
||||
#define _SEPARATOR_ITEM_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user