Minor header-related changes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3246 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
haydentech 2003-05-14 17:21:46 +00:00
parent e1d7ae79b2
commit 30fd51473f
17 changed files with 1702 additions and 1698 deletions

View File

@ -171,9 +171,9 @@ virtual void DrawBackground(BRect update);
/*----- Private or reserved -----------------------------------------*/
private:
friend BWindow;
friend BMenuBar;
friend BMenuItem;
friend class BWindow;
friend class BMenuBar;
friend class BMenuItem;
friend status_t _init_interface_kit_();
friend status_t set_menu_info(menu_info *);
friend status_t get_menu_info(menu_info *);

View File

@ -80,10 +80,10 @@ virtual void AllDetached();
virtual status_t Perform(perform_code d, void *arg);
private:
friend BWindow;
friend BMenuItem;
friend BMenuField;
friend BMenu;
friend class BWindow;
friend class BMenuItem;
friend class BMenuField;
friend class BMenu;
virtual void _ReservedMenuBar1();
virtual void _ReservedMenuBar2();

View File

@ -65,9 +65,9 @@ virtual void Highlight(bool on);
/*----- Private or reserved -----------------------------------------*/
private:
friend BMenu;
friend BPopUpMenu;
friend BMenuBar;
friend class BMenu;
friend class BPopUpMenu;
friend class BMenuBar;
virtual void _ReservedMenuItem1();
virtual void _ReservedMenuItem2();

View File

@ -74,9 +74,9 @@ virtual void _ReservedShape2();
virtual void _ReservedShape3();
virtual void _ReservedShape4();
friend BShapeIterator;
friend class BShapeIterator;
friend class TPicture;
friend BView;
friend class BView;
friend class BFont;
void GetData(int32 *opCount, int32 *ptCount, uint32 **opList, BPoint **ptList);
void SetData(int32 opCount, int32 ptCount, uint32 *opList, BPoint *ptList);

View File

@ -1,5 +1,5 @@
//
// $Id: Autolock.h,v 1.1 2002/07/09 12:24:33 ejakowatz Exp $
// $Id: Autolock.h,v 1.2 2003/05/14 17:21:46 haydentech Exp $
//
// This is the BAutolock interface for OpenBeOS. It has been created to
// be source and binary compatible with the BeOS version of BAutolock.
@ -11,7 +11,7 @@
#define _OPENBEOS_AUTOLOCK_H
#include "Locker.h"
#include <Locker.h>
#include <Looper.h>

View File

@ -15,7 +15,7 @@
#include <SupportDefs.h>
#include <stdarg.h>
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <OS.h>
/*------------------------------*/

View File

@ -2,7 +2,7 @@
#define _BLUE_STOP_WATCH_H
#include <BeBuild.h>
#include "support/SupportDefs.h"
#include <SupportDefs.h>
#ifdef USE_OPENBEOS_NAMESPACE
namespace OpenBeOS {

View File

@ -40,7 +40,7 @@ typedef unsigned short ushort;
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <sys/types.h>
#include <support/Errors.h>
#include <Errors.h>
// Project Includes ------------------------------------------------------------

View File

@ -1,14 +1,14 @@
//
// $Id: MessageQueue.cpp,v 1.2 2002/09/28 09:49:34 shatty Exp $
// $Id: MessageQueue.cpp,v 1.3 2003/05/14 17:21:46 haydentech Exp $
//
// This file contains the implementation of the BMessageQueue class
// for the OpenBeOS project.
//
#include "MessageQueue.h"
#include "Autolock.h"
#include "Message.h"
#include <MessageQueue.h>
#include <Autolock.h>
#include <Message.h>
#ifdef USE_OPENBEOS_NAMESPACE
namespace OpenBeOS {

View File

@ -28,9 +28,9 @@
#include <stdio.h>
// System Includes -------------------------------------------------------------
#include "ColorControl.h"
#include "TextControl.h"
#include <Support/Errors.h>
#include <ColorControl.h>
#include <TextControl.h>
#include <Errors.h>
// Project Includes ------------------------------------------------------------

View File

@ -26,7 +26,7 @@
// Standard Includes -----------------------------------------------------------
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
// System Includes -------------------------------------------------------------
#include <Control.h>

View File

@ -1,481 +1,481 @@
// Standard Includes -----------------------------------------------------------
#include <string.h>
#include <malloc.h>
// System Includes -------------------------------------------------------------
#include <MenuItem.h>
#include <String.h>
#include <Message.h>
#include <Window.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
//------------------------------------------------------------------------------
BMenuItem::BMenuItem(const char *label, BMessage *message, char shortcut,
uint32 modifiers)
: BInvoker(message, NULL),
fSubmenu(NULL),
fWindow(NULL),
fSuper(NULL),
fModifiers(modifiers),
fCachedWidth(0.0f),
fTriggerIndex(0),
fUserTrigger(0),
fSysTrigger(0),
fShortcutChar(shortcut),
fMark(false),
fEnabled(true),
fSelected(false)
{
fLabel = strdup(label);
}
//------------------------------------------------------------------------------
BMenuItem::BMenuItem(BMenu *menu, BMessage *message)
: BInvoker(message, NULL),
fSubmenu(menu),
fWindow(NULL),
fSuper(NULL),
fModifiers(0),
fCachedWidth(0.0f),
fTriggerIndex(0),
fUserTrigger(0),
fSysTrigger(0),
fShortcutChar(0),
fMark(false),
fEnabled(true),
fSelected(false)
{
fLabel = strdup(menu->Name());
fSubmenu->fSuperitem = this;
}
//------------------------------------------------------------------------------
BMenuItem::BMenuItem(BMessage *data)
{
}
//------------------------------------------------------------------------------
BArchivable *BMenuItem::Instantiate(BMessage *data)
{
if (validate_instantiation(data, "BMenuItem"))
return new BMenuItem(data);
return NULL;
}
//------------------------------------------------------------------------------
status_t BMenuItem::Archive(BMessage *data, bool deep) const
{
if (Label())
data->AddString("_label", Label());
if (!IsEnabled())
data->AddBool("_disable", true);
if (IsMarked())
data->AddBool("_marked", true);
if (fUserTrigger)
data->AddInt32("_user_trig", fUserTrigger);
if (fShortcutChar && fModifiers)
{
data->AddInt32("_shortcut", fShortcutChar);
data->AddInt32("_mods", fModifiers);
}
if (Message())
data->AddMessage("_msg", Message());
if (deep && Submenu())
{
BMessage submenu;
Submenu()->Archive(&submenu);
data->AddMessage("_submenu", &submenu);
}
return B_OK;
}
//------------------------------------------------------------------------------
BMenuItem::~BMenuItem()
{
if (fLabel)
free(fLabel);
if (fSubmenu)
delete fSubmenu;
}
//------------------------------------------------------------------------------
void BMenuItem::SetLabel(const char *string)
{
if (fLabel)
free(fLabel);
fLabel = strdup(string);
Menu()->InvalidateLayout();
}
//------------------------------------------------------------------------------
void BMenuItem::SetEnabled(bool state)
{
if (Menu()->IsEnabled() == false)
return;
fEnabled = state;
if (Submenu())
Submenu()->SetEnabled(state);
}
//------------------------------------------------------------------------------
void BMenuItem::SetMarked(bool state)
{
fMark = state;
if (state && Menu())
Menu()->ItemMarked(this);
}
//------------------------------------------------------------------------------
void BMenuItem::SetTrigger(char ch)
{
fUserTrigger = ch;
}
//------------------------------------------------------------------------------
void BMenuItem::SetShortcut(char ch, uint32 modifiers)
{
fShortcutChar = ch;
fModifiers = modifiers;
}
//------------------------------------------------------------------------------
const char *BMenuItem::Label() const
{
return fLabel;
}
//------------------------------------------------------------------------------
bool BMenuItem::IsEnabled() const
{
return fEnabled;
}
//------------------------------------------------------------------------------
bool BMenuItem::IsMarked() const
{
return fMark;
}
//------------------------------------------------------------------------------
char BMenuItem::Trigger() const
{
if (fUserTrigger)
return fUserTrigger;
else
return fSysTrigger;
}
//------------------------------------------------------------------------------
char BMenuItem::Shortcut(uint32 *modifiers) const
{
if (modifiers)
*modifiers = fModifiers;
return fShortcutChar;
}
//------------------------------------------------------------------------------
BMenu *BMenuItem::Submenu() const
{
return fSubmenu;
}
//------------------------------------------------------------------------------
BMenu *BMenuItem::Menu() const
{
return fSuper;
}
//------------------------------------------------------------------------------
BRect BMenuItem::Frame() const
{
return fBounds;
}
//------------------------------------------------------------------------------
void BMenuItem::GetContentSize(float *width, float *height)
{
BMenu *menu = Menu();
if (menu->fFontHeight == -1)
menu->CacheFontInfo();
*width = (float)ceil(menu->StringWidth(fLabel));
*height = menu->fFontHeight;
}
//------------------------------------------------------------------------------
void BMenuItem::TruncateLabel(float maxWidth, char *newLabel)
{
}
//------------------------------------------------------------------------------
void BMenuItem::DrawContent()
{
fSuper->DrawString(fLabel);
}
//------------------------------------------------------------------------------
void BMenuItem::Draw()
{
if (IsEnabled() && fSelected)
{
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
fSuper->SetLowColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
fSuper->FillRect(Frame());
}
BPoint pt = ContentLocation();
fSuper->MovePenTo(pt.x, pt.y + Menu()->fAscent);
if (IsEnabled())
fSuper->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
else
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DISABLED_LABEL_TINT));
DrawContent();
if (Menu()->Layout() == B_ITEMS_IN_COLUMN)
{
if (IsMarked())
DrawMarkSymbol();
if (Submenu())
DrawSubmenuSymbol();
else if (fShortcutChar)
DrawShortcutSymbol();
}
}
//------------------------------------------------------------------------------
void BMenuItem::Highlight(bool flag)
{
//Menu()->InvertRect(Frame());
Menu()->Invalidate(Frame());
}
//------------------------------------------------------------------------------
bool BMenuItem::IsSelected() const
{
return fSelected;
}
//------------------------------------------------------------------------------
BPoint BMenuItem::ContentLocation () const
{
if (!Menu())
return BPoint();
return BPoint(fBounds.left + Menu()->fPad.left,
fBounds.top + Menu()->fPad.top);
}
//------------------------------------------------------------------------------
void BMenuItem::_ReservedMenuItem1() {}
void BMenuItem::_ReservedMenuItem2() {}
void BMenuItem::_ReservedMenuItem3() {}
void BMenuItem::_ReservedMenuItem4() {}
//------------------------------------------------------------------------------
BMenuItem::BMenuItem(const BMenuItem &)
{
}
//------------------------------------------------------------------------------
BMenuItem &BMenuItem::operator=(const BMenuItem &)
{
return *this;
}
//------------------------------------------------------------------------------
void BMenuItem::InitData()
{
}
//------------------------------------------------------------------------------
void BMenuItem::InitMenuData(BMenu *menu)
{
}
//------------------------------------------------------------------------------
void BMenuItem::Install(BWindow *window)
{
if (Submenu())
Submenu()->Install(window);
char shortcut;
uint32 modifiers;
if (shortcut = Shortcut(&modifiers))
window->AddShortcut(shortcut, modifiers, this);
if (Target() == NULL)
SetTarget(window);
}
//------------------------------------------------------------------------------
status_t BMenuItem::Invoke(BMessage *message)
{
if (IsEnabled())
{
BMessage msg;
if (message)
msg = *message;
else if (Message())
msg = *Message();
else
return B_OK;
msg.AddInt64("when", system_time()); // TODO
msg.AddPointer("source", this);
msg.AddInt32("index", Menu()->IndexOf(this));
return BInvoker::Invoke(&msg);
}
else
return B_OK;
}
//------------------------------------------------------------------------------
void BMenuItem::Uninstall()
{
}
//------------------------------------------------------------------------------
void BMenuItem::SetSuper(BMenu *super)
{
fSuper = super;
}
//------------------------------------------------------------------------------
void BMenuItem::Select(bool on)
{
fSelected = on;
}
//------------------------------------------------------------------------------
void BMenuItem::DrawMarkSymbol()
{
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_1_TINT));
fSuper->StrokeLine(BPoint(fBounds.left + 6.0f, fBounds.bottom - 3.0f),
BPoint(fBounds.left + 10.0f, fBounds.bottom - 12.0f));
fSuper->StrokeLine(BPoint(fBounds.left + 7.0f, fBounds.bottom - 3.0f),
BPoint(fBounds.left + 11.0f, fBounds.bottom - 12.0f));
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_4_TINT));
fSuper->StrokeLine(BPoint(fBounds.left + 6.0f, fBounds.bottom - 4.0f),
BPoint(fBounds.left + 10.0f, fBounds.bottom - 13.0f));
fSuper->StrokeLine(BPoint(fBounds.left + 5.0f, fBounds.bottom - 4.0f),
BPoint(fBounds.left + 9.0f, fBounds.bottom - 13.0f));
fSuper->StrokeLine(BPoint(fBounds.left + 5.0f, fBounds.bottom - 3.0f),
BPoint(fBounds.left + 3.0f, fBounds.bottom - 9.0f));
fSuper->StrokeLine(BPoint(fBounds.left + 4.0f, fBounds.bottom - 4.0f),
BPoint(fBounds.left + 2.0f, fBounds.bottom - 9.0f));
}
//------------------------------------------------------------------------------
void BMenuItem::DrawShortcutSymbol()
{
BString shortcut("");
if (fModifiers & B_CONTROL_KEY)
shortcut += "ctl+";
shortcut += fShortcutChar;
fSuper->DrawString(shortcut.String(), ContentLocation() +
BPoint(fBounds.Width() - 14.0f - 22.0f, fBounds.Height() - 4.0f));
}
//------------------------------------------------------------------------------
void BMenuItem::DrawSubmenuSymbol()
{
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_LIGHTEN_MAX_TINT));
fSuper->FillTriangle(BPoint(fBounds.right - 14.0f, fBounds.bottom - 4.0f),
BPoint(fBounds.right - 14.0f, fBounds.bottom - 12.0f),
BPoint(fBounds.right - 5.0f, fBounds.bottom - 8.0f));
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
fSuper->StrokeLine(BPoint(fBounds.right - 14.0f, fBounds.bottom - 5),
BPoint(fBounds.right - 9.0f, fBounds.bottom - 7));
fSuper->StrokeLine(BPoint(fBounds.right - 7.0f, fBounds.bottom - 8),
BPoint(fBounds.right - 7.0f, fBounds.bottom - 8));
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_3_TINT));
fSuper->StrokeTriangle(BPoint(fBounds.right - 14.0f, fBounds.bottom - 4.0f),
BPoint(fBounds.right - 14.0f, fBounds.bottom - 12.0f),
BPoint(fBounds.right - 5.0f, fBounds.bottom - 8.0f));
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_LIGHTEN_1_TINT));
fSuper->StrokeTriangle(BPoint(fBounds.right - 12.0f, fBounds.bottom - 7.0f),
BPoint(fBounds.right - 12.0f, fBounds.bottom - 9.0f),
BPoint(fBounds.right - 9.0f, fBounds.bottom - 8.0f));
fSuper->FillTriangle(BPoint(fBounds.right - 12.0f, fBounds.bottom - 7.0f),
BPoint(fBounds.right - 12.0f, fBounds.bottom - 9.0f),
BPoint(fBounds.right - 9.0f, fBounds.bottom - 8.0f));
}
//------------------------------------------------------------------------------
void BMenuItem::DrawControlChar(const char *control)
{
}
//------------------------------------------------------------------------------
void BMenuItem::SetSysTrigger(char ch)
{
fSysTrigger = ch;
}
//------------------------------------------------------------------------------
BSeparatorItem::BSeparatorItem()
: BMenuItem(NULL, NULL, 0, 0)
{
}
//------------------------------------------------------------------------------
BSeparatorItem::BSeparatorItem(BMessage *data)
: BMenuItem(data)
{
}
//------------------------------------------------------------------------------
BSeparatorItem::~BSeparatorItem()
{
}
//------------------------------------------------------------------------------
status_t BSeparatorItem::Archive(BMessage *data, bool deep) const
{
return BMenuItem::Archive(data, deep);
}
//------------------------------------------------------------------------------
BArchivable *BSeparatorItem::Instantiate(BMessage *data)
{
if (validate_instantiation(data, "BSeparatorItem"))
return new BSeparatorItem(data);
return NULL;
}
//------------------------------------------------------------------------------
void BSeparatorItem::SetEnabled(bool state)
{
BSeparatorItem::SetEnabled(state);
}
//------------------------------------------------------------------------------
void BSeparatorItem::GetContentSize(float *width, float *height)
{
*width = 2.0f;
*height = 8.0f;
}
//------------------------------------------------------------------------------
void BSeparatorItem::Draw()
{
BRect bounds = Frame();
Menu()->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
Menu()->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f),
BPoint(bounds.right - 1.0f, bounds.top + 4.0f));
Menu()->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_LIGHTEN_2_TINT));
Menu()->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 5.0f),
BPoint(bounds.right - 1.0f, bounds.top + 5.0f));
Menu()->SetHighColor(0, 0, 0);
}
//------------------------------------------------------------------------------
void BSeparatorItem::_ReservedSeparatorItem1() {}
void BSeparatorItem::_ReservedSeparatorItem2() {}
//------------------------------------------------------------------------------
BSeparatorItem &BSeparatorItem::operator=(const BSeparatorItem &)
{
return *this;
}
//------------------------------------------------------------------------------
// Standard Includes -----------------------------------------------------------
#include <string.h>
#include <stdlib.h>
// System Includes -------------------------------------------------------------
#include <MenuItem.h>
#include <String.h>
#include <Message.h>
#include <Window.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
//------------------------------------------------------------------------------
BMenuItem::BMenuItem(const char *label, BMessage *message, char shortcut,
uint32 modifiers)
: BInvoker(message, NULL),
fSubmenu(NULL),
fWindow(NULL),
fSuper(NULL),
fModifiers(modifiers),
fCachedWidth(0.0f),
fTriggerIndex(0),
fUserTrigger(0),
fSysTrigger(0),
fShortcutChar(shortcut),
fMark(false),
fEnabled(true),
fSelected(false)
{
fLabel = strdup(label);
}
//------------------------------------------------------------------------------
BMenuItem::BMenuItem(BMenu *menu, BMessage *message)
: BInvoker(message, NULL),
fSubmenu(menu),
fWindow(NULL),
fSuper(NULL),
fModifiers(0),
fCachedWidth(0.0f),
fTriggerIndex(0),
fUserTrigger(0),
fSysTrigger(0),
fShortcutChar(0),
fMark(false),
fEnabled(true),
fSelected(false)
{
fLabel = strdup(menu->Name());
fSubmenu->fSuperitem = this;
}
//------------------------------------------------------------------------------
BMenuItem::BMenuItem(BMessage *data)
{
}
//------------------------------------------------------------------------------
BArchivable *BMenuItem::Instantiate(BMessage *data)
{
if (validate_instantiation(data, "BMenuItem"))
return new BMenuItem(data);
return NULL;
}
//------------------------------------------------------------------------------
status_t BMenuItem::Archive(BMessage *data, bool deep) const
{
if (Label())
data->AddString("_label", Label());
if (!IsEnabled())
data->AddBool("_disable", true);
if (IsMarked())
data->AddBool("_marked", true);
if (fUserTrigger)
data->AddInt32("_user_trig", fUserTrigger);
if (fShortcutChar && fModifiers)
{
data->AddInt32("_shortcut", fShortcutChar);
data->AddInt32("_mods", fModifiers);
}
if (Message())
data->AddMessage("_msg", Message());
if (deep && Submenu())
{
BMessage submenu;
Submenu()->Archive(&submenu);
data->AddMessage("_submenu", &submenu);
}
return B_OK;
}
//------------------------------------------------------------------------------
BMenuItem::~BMenuItem()
{
if (fLabel)
free(fLabel);
if (fSubmenu)
delete fSubmenu;
}
//------------------------------------------------------------------------------
void BMenuItem::SetLabel(const char *string)
{
if (fLabel)
free(fLabel);
fLabel = strdup(string);
Menu()->InvalidateLayout();
}
//------------------------------------------------------------------------------
void BMenuItem::SetEnabled(bool state)
{
if (Menu()->IsEnabled() == false)
return;
fEnabled = state;
if (Submenu())
Submenu()->SetEnabled(state);
}
//------------------------------------------------------------------------------
void BMenuItem::SetMarked(bool state)
{
fMark = state;
if (state && Menu())
Menu()->ItemMarked(this);
}
//------------------------------------------------------------------------------
void BMenuItem::SetTrigger(char ch)
{
fUserTrigger = ch;
}
//------------------------------------------------------------------------------
void BMenuItem::SetShortcut(char ch, uint32 modifiers)
{
fShortcutChar = ch;
fModifiers = modifiers;
}
//------------------------------------------------------------------------------
const char *BMenuItem::Label() const
{
return fLabel;
}
//------------------------------------------------------------------------------
bool BMenuItem::IsEnabled() const
{
return fEnabled;
}
//------------------------------------------------------------------------------
bool BMenuItem::IsMarked() const
{
return fMark;
}
//------------------------------------------------------------------------------
char BMenuItem::Trigger() const
{
if (fUserTrigger)
return fUserTrigger;
else
return fSysTrigger;
}
//------------------------------------------------------------------------------
char BMenuItem::Shortcut(uint32 *modifiers) const
{
if (modifiers)
*modifiers = fModifiers;
return fShortcutChar;
}
//------------------------------------------------------------------------------
BMenu *BMenuItem::Submenu() const
{
return fSubmenu;
}
//------------------------------------------------------------------------------
BMenu *BMenuItem::Menu() const
{
return fSuper;
}
//------------------------------------------------------------------------------
BRect BMenuItem::Frame() const
{
return fBounds;
}
//------------------------------------------------------------------------------
void BMenuItem::GetContentSize(float *width, float *height)
{
BMenu *menu = Menu();
if (menu->fFontHeight == -1)
menu->CacheFontInfo();
*width = (float)ceil(menu->StringWidth(fLabel));
*height = menu->fFontHeight;
}
//------------------------------------------------------------------------------
void BMenuItem::TruncateLabel(float maxWidth, char *newLabel)
{
}
//------------------------------------------------------------------------------
void BMenuItem::DrawContent()
{
fSuper->DrawString(fLabel);
}
//------------------------------------------------------------------------------
void BMenuItem::Draw()
{
if (IsEnabled() && fSelected)
{
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
fSuper->SetLowColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
fSuper->FillRect(Frame());
}
BPoint pt = ContentLocation();
fSuper->MovePenTo(pt.x, pt.y + Menu()->fAscent);
if (IsEnabled())
fSuper->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
else
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DISABLED_LABEL_TINT));
DrawContent();
if (Menu()->Layout() == B_ITEMS_IN_COLUMN)
{
if (IsMarked())
DrawMarkSymbol();
if (Submenu())
DrawSubmenuSymbol();
else if (fShortcutChar)
DrawShortcutSymbol();
}
}
//------------------------------------------------------------------------------
void BMenuItem::Highlight(bool flag)
{
//Menu()->InvertRect(Frame());
Menu()->Invalidate(Frame());
}
//------------------------------------------------------------------------------
bool BMenuItem::IsSelected() const
{
return fSelected;
}
//------------------------------------------------------------------------------
BPoint BMenuItem::ContentLocation () const
{
if (!Menu())
return BPoint();
return BPoint(fBounds.left + Menu()->fPad.left,
fBounds.top + Menu()->fPad.top);
}
//------------------------------------------------------------------------------
void BMenuItem::_ReservedMenuItem1() {}
void BMenuItem::_ReservedMenuItem2() {}
void BMenuItem::_ReservedMenuItem3() {}
void BMenuItem::_ReservedMenuItem4() {}
//------------------------------------------------------------------------------
BMenuItem::BMenuItem(const BMenuItem &)
{
}
//------------------------------------------------------------------------------
BMenuItem &BMenuItem::operator=(const BMenuItem &)
{
return *this;
}
//------------------------------------------------------------------------------
void BMenuItem::InitData()
{
}
//------------------------------------------------------------------------------
void BMenuItem::InitMenuData(BMenu *menu)
{
}
//------------------------------------------------------------------------------
void BMenuItem::Install(BWindow *window)
{
if (Submenu())
Submenu()->Install(window);
char shortcut;
uint32 modifiers;
if (shortcut = Shortcut(&modifiers))
window->AddShortcut(shortcut, modifiers, this);
if (Target() == NULL)
SetTarget(window);
}
//------------------------------------------------------------------------------
status_t BMenuItem::Invoke(BMessage *message)
{
if (IsEnabled())
{
BMessage msg;
if (message)
msg = *message;
else if (Message())
msg = *Message();
else
return B_OK;
msg.AddInt64("when", system_time()); // TODO
msg.AddPointer("source", this);
msg.AddInt32("index", Menu()->IndexOf(this));
return BInvoker::Invoke(&msg);
}
else
return B_OK;
}
//------------------------------------------------------------------------------
void BMenuItem::Uninstall()
{
}
//------------------------------------------------------------------------------
void BMenuItem::SetSuper(BMenu *super)
{
fSuper = super;
}
//------------------------------------------------------------------------------
void BMenuItem::Select(bool on)
{
fSelected = on;
}
//------------------------------------------------------------------------------
void BMenuItem::DrawMarkSymbol()
{
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_1_TINT));
fSuper->StrokeLine(BPoint(fBounds.left + 6.0f, fBounds.bottom - 3.0f),
BPoint(fBounds.left + 10.0f, fBounds.bottom - 12.0f));
fSuper->StrokeLine(BPoint(fBounds.left + 7.0f, fBounds.bottom - 3.0f),
BPoint(fBounds.left + 11.0f, fBounds.bottom - 12.0f));
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_4_TINT));
fSuper->StrokeLine(BPoint(fBounds.left + 6.0f, fBounds.bottom - 4.0f),
BPoint(fBounds.left + 10.0f, fBounds.bottom - 13.0f));
fSuper->StrokeLine(BPoint(fBounds.left + 5.0f, fBounds.bottom - 4.0f),
BPoint(fBounds.left + 9.0f, fBounds.bottom - 13.0f));
fSuper->StrokeLine(BPoint(fBounds.left + 5.0f, fBounds.bottom - 3.0f),
BPoint(fBounds.left + 3.0f, fBounds.bottom - 9.0f));
fSuper->StrokeLine(BPoint(fBounds.left + 4.0f, fBounds.bottom - 4.0f),
BPoint(fBounds.left + 2.0f, fBounds.bottom - 9.0f));
}
//------------------------------------------------------------------------------
void BMenuItem::DrawShortcutSymbol()
{
BString shortcut("");
if (fModifiers & B_CONTROL_KEY)
shortcut += "ctl+";
shortcut += fShortcutChar;
fSuper->DrawString(shortcut.String(), ContentLocation() +
BPoint(fBounds.Width() - 14.0f - 22.0f, fBounds.Height() - 4.0f));
}
//------------------------------------------------------------------------------
void BMenuItem::DrawSubmenuSymbol()
{
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_LIGHTEN_MAX_TINT));
fSuper->FillTriangle(BPoint(fBounds.right - 14.0f, fBounds.bottom - 4.0f),
BPoint(fBounds.right - 14.0f, fBounds.bottom - 12.0f),
BPoint(fBounds.right - 5.0f, fBounds.bottom - 8.0f));
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
fSuper->StrokeLine(BPoint(fBounds.right - 14.0f, fBounds.bottom - 5),
BPoint(fBounds.right - 9.0f, fBounds.bottom - 7));
fSuper->StrokeLine(BPoint(fBounds.right - 7.0f, fBounds.bottom - 8),
BPoint(fBounds.right - 7.0f, fBounds.bottom - 8));
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_3_TINT));
fSuper->StrokeTriangle(BPoint(fBounds.right - 14.0f, fBounds.bottom - 4.0f),
BPoint(fBounds.right - 14.0f, fBounds.bottom - 12.0f),
BPoint(fBounds.right - 5.0f, fBounds.bottom - 8.0f));
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_LIGHTEN_1_TINT));
fSuper->StrokeTriangle(BPoint(fBounds.right - 12.0f, fBounds.bottom - 7.0f),
BPoint(fBounds.right - 12.0f, fBounds.bottom - 9.0f),
BPoint(fBounds.right - 9.0f, fBounds.bottom - 8.0f));
fSuper->FillTriangle(BPoint(fBounds.right - 12.0f, fBounds.bottom - 7.0f),
BPoint(fBounds.right - 12.0f, fBounds.bottom - 9.0f),
BPoint(fBounds.right - 9.0f, fBounds.bottom - 8.0f));
}
//------------------------------------------------------------------------------
void BMenuItem::DrawControlChar(const char *control)
{
}
//------------------------------------------------------------------------------
void BMenuItem::SetSysTrigger(char ch)
{
fSysTrigger = ch;
}
//------------------------------------------------------------------------------
BSeparatorItem::BSeparatorItem()
: BMenuItem(NULL, NULL, 0, 0)
{
}
//------------------------------------------------------------------------------
BSeparatorItem::BSeparatorItem(BMessage *data)
: BMenuItem(data)
{
}
//------------------------------------------------------------------------------
BSeparatorItem::~BSeparatorItem()
{
}
//------------------------------------------------------------------------------
status_t BSeparatorItem::Archive(BMessage *data, bool deep) const
{
return BMenuItem::Archive(data, deep);
}
//------------------------------------------------------------------------------
BArchivable *BSeparatorItem::Instantiate(BMessage *data)
{
if (validate_instantiation(data, "BSeparatorItem"))
return new BSeparatorItem(data);
return NULL;
}
//------------------------------------------------------------------------------
void BSeparatorItem::SetEnabled(bool state)
{
BSeparatorItem::SetEnabled(state);
}
//------------------------------------------------------------------------------
void BSeparatorItem::GetContentSize(float *width, float *height)
{
*width = 2.0f;
*height = 8.0f;
}
//------------------------------------------------------------------------------
void BSeparatorItem::Draw()
{
BRect bounds = Frame();
Menu()->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
Menu()->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f),
BPoint(bounds.right - 1.0f, bounds.top + 4.0f));
Menu()->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_LIGHTEN_2_TINT));
Menu()->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 5.0f),
BPoint(bounds.right - 1.0f, bounds.top + 5.0f));
Menu()->SetHighColor(0, 0, 0);
}
//------------------------------------------------------------------------------
void BSeparatorItem::_ReservedSeparatorItem1() {}
void BSeparatorItem::_ReservedSeparatorItem2() {}
//------------------------------------------------------------------------------
BSeparatorItem &BSeparatorItem::operator=(const BSeparatorItem &)
{
return *this;
}
//------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -172,7 +172,7 @@ BArchivable *BScrollBar::Instantiate(BMessage *data)
return NULL;
}
status_t BScrollBar::Archive(BMessage *data, bool deep = true) const
status_t BScrollBar::Archive(BMessage *data, bool deep) const
{
return B_ERROR;
}
@ -481,6 +481,10 @@ void BScrollBar::ResizeToPreferred()
void BScrollBar::GetPreferredSize(float *width, float *height)
{
if (fOrientation == B_VERTICAL)
*width = B_V_SCROLL_BAR_WIDTH;
else if (fOrientation == B_HORIZONTAL)
*height = B_H_SCROLL_BAR_HEIGHT;
}
void BScrollBar::MakeFocus(bool state)

View File

@ -24,11 +24,11 @@
// Description: BShape encapsulates a Postscript-style "path"
//------------------------------------------------------------------------------
#include "Shape.h"
#include "Point.h"
#include "Rect.h"
#include <Support/Errors.h>
#include <App/Message.h>
#include <Shape.h>
#include <Point.h>
#include <Rect.h>
#include <Errors.h>
#include <Message.h>
#define OP_LINETO 0x10000000
#define OP_BEZIERTO 0x20000000

View File

@ -25,7 +25,7 @@
//------------------------------------------------------------------------------
// Standard Includes -----------------------------------------------------------
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
// System Includes -------------------------------------------------------------

File diff suppressed because it is too large Load Diff