* Fixed issues like not calling the inherited virtual or calling the wrong one.
* Applied coding style. * Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15089 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,55 +1,23 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright 2001-2005, Haiku, Inc.
|
||||||
//
|
* Distributed under the terms of the MIT license.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Graham MacDonald ([email protected])
|
||||||
// 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:
|
/** BPictureButton displays and controls a picture button in a window. */
|
||||||
//
|
|
||||||
// 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: PictureButton.cpp
|
|
||||||
// Author: Graham MacDonald ([email protected])
|
|
||||||
// Description: BPictureButton displays and controls a picture button in a
|
|
||||||
// window.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <PictureButton.h>
|
#include <PictureButton.h>
|
||||||
|
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
BPictureButton::BPictureButton(BRect frame, const char* name,
|
||||||
|
BPicture *off, BPicture *on, BMessage *message,
|
||||||
// Local Includes --------------------------------------------------------------
|
uint32 behavior, uint32 resizeMask, uint32 flags)
|
||||||
|
: BControl(frame, name, "", message, resizeMask, flags),
|
||||||
// Local Defines ---------------------------------------------------------------
|
fOutlined(false),
|
||||||
|
fBehavior(behavior)
|
||||||
// Globals ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BPictureButton::BPictureButton (BRect frame,
|
|
||||||
const char* name,
|
|
||||||
BPicture *off,
|
|
||||||
BPicture *on,
|
|
||||||
BMessage *message,
|
|
||||||
uint32 behavior,
|
|
||||||
uint32 resizeMask,
|
|
||||||
uint32 flgs)
|
|
||||||
: BControl (frame, name, "", message, resizeMask, flgs), fOutlined (false),
|
|
||||||
fBehavior (behavior)
|
|
||||||
{
|
{
|
||||||
fEnabledOff = new BPicture(*off);
|
fEnabledOff = new BPicture(*off);
|
||||||
fEnabledOn = new BPicture(*on);
|
fEnabledOn = new BPicture(*on);
|
||||||
@@ -58,154 +26,102 @@ BPictureButton::BPictureButton (BRect frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
BPictureButton::BPictureButton(BMessage *data)
|
||||||
* Method: BPictureButton::BPictureButton
|
: BControl(data)
|
||||||
* Params: BMessage *data
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
BPictureButton::BPictureButton(BMessage *data) : BControl (data)
|
|
||||||
{
|
{
|
||||||
BMessage pictureArchive;
|
BMessage pictureArchive;
|
||||||
|
|
||||||
// Default to 1 state button if not here - is this valid?
|
// Default to 1 state button if not here - is this valid?
|
||||||
if (data->FindInt32 ("_behave", (int32 *)&fBehavior ) != B_OK )
|
if (data->FindInt32 ("_behave", (int32 *)&fBehavior) != B_OK)
|
||||||
{
|
|
||||||
fBehavior = B_ONE_STATE_BUTTON;
|
fBehavior = B_ONE_STATE_BUTTON;
|
||||||
}
|
|
||||||
|
|
||||||
// Now expand the pictures:
|
// Now expand the pictures:
|
||||||
if (data->FindMessage("_e_on", &pictureArchive) == B_OK)
|
if (data->FindMessage("_e_on", &pictureArchive) == B_OK)
|
||||||
{
|
|
||||||
fEnabledOn = new BPicture(&pictureArchive);
|
fEnabledOn = new BPicture(&pictureArchive);
|
||||||
}
|
|
||||||
if (data->FindMessage("_e_off", &pictureArchive) == B_OK)
|
|
||||||
{
|
|
||||||
fEnabledOff = new BPicture(&pictureArchive);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fBehavior == B_TWO_STATE_BUTTON)
|
if (data->FindMessage("_e_off", &pictureArchive) == B_OK)
|
||||||
{
|
fEnabledOff = new BPicture(&pictureArchive);
|
||||||
|
|
||||||
|
if (fBehavior == B_TWO_STATE_BUTTON) {
|
||||||
if (data->FindMessage("_d_on", &pictureArchive) == B_OK)
|
if (data->FindMessage("_d_on", &pictureArchive) == B_OK)
|
||||||
{
|
|
||||||
fDisabledOn = new BPicture(&pictureArchive);
|
fDisabledOn = new BPicture(&pictureArchive);
|
||||||
}
|
|
||||||
if (data->FindMessage("_d_off", &pictureArchive) == B_OK)
|
if (data->FindMessage("_d_off", &pictureArchive) == B_OK)
|
||||||
{
|
|
||||||
fDisabledOff = new BPicture(&pictureArchive);
|
fDisabledOff = new BPicture(&pictureArchive);
|
||||||
}
|
} else
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fDisabledOn = fDisabledOff = NULL;
|
fDisabledOn = fDisabledOff = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::~BPictureButton
|
|
||||||
* Params:
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
BPictureButton::~BPictureButton()
|
BPictureButton::~BPictureButton()
|
||||||
{
|
{
|
||||||
delete fEnabledOn;
|
delete fEnabledOn;
|
||||||
delete fEnabledOff;
|
delete fEnabledOff;
|
||||||
|
delete fDisabledOn;
|
||||||
if (fBehavior == B_TWO_STATE_BUTTON)
|
delete fDisabledOff;
|
||||||
{
|
|
||||||
delete fDisabledOn;
|
|
||||||
delete fDisabledOff;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::Instantiate
|
|
||||||
* Params: BMessage *data
|
|
||||||
* Returns: BArchivable *
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
BArchivable *
|
BArchivable *
|
||||||
BPictureButton::Instantiate (BMessage *data)
|
BPictureButton::Instantiate(BMessage *data)
|
||||||
{
|
{
|
||||||
// Do we ned to take into account deep copy of images? I guess so!
|
|
||||||
if ( validate_instantiation(data, "BPictureButton"))
|
if ( validate_instantiation(data, "BPictureButton"))
|
||||||
{
|
|
||||||
return new BPictureButton(data);
|
return new BPictureButton(data);
|
||||||
}
|
|
||||||
else
|
return NULL;
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::Archive
|
|
||||||
* Params: BMessage *data, bool deep
|
|
||||||
* Returns: status_t
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
status_t
|
status_t
|
||||||
BPictureButton::Archive (BMessage *data, bool deep) const
|
BPictureButton::Archive(BMessage *data, bool deep) const
|
||||||
{
|
{
|
||||||
status_t err = BControl::Archive(data, deep);
|
status_t err = BControl::Archive(data, deep);
|
||||||
|
if (err != B_OK)
|
||||||
if (err != B_OK) return err;
|
return err;
|
||||||
|
|
||||||
// Do we need this? Good practice!
|
// Do we need this? Good practice!
|
||||||
err = data->AddString("class", "BPictureButton");
|
err = data->AddString("class", "BPictureButton");
|
||||||
|
if (err != B_OK)
|
||||||
if (err != B_OK) return err;
|
return err;
|
||||||
|
|
||||||
// Fill out message, depending on whether a deep copy is required or not.
|
// Fill out message, depending on whether a deep copy is required or not.
|
||||||
if (deep)
|
if (deep) {
|
||||||
{
|
|
||||||
BMessage pictureArchive;
|
BMessage pictureArchive;
|
||||||
|
|
||||||
if (fEnabledOn->Archive(&pictureArchive, deep) == B_OK)
|
if (fEnabledOn->Archive(&pictureArchive, deep) == B_OK) {
|
||||||
{
|
|
||||||
err = data->AddMessage("_e_on", &pictureArchive);
|
err = data->AddMessage("_e_on", &pictureArchive);
|
||||||
if (err != B_OK) return err;
|
if (err != B_OK)
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fEnabledOff->Archive(&pictureArchive, deep) == B_OK)
|
if (fEnabledOff->Archive(&pictureArchive, deep) == B_OK) {
|
||||||
{
|
|
||||||
err = data->AddMessage("_e_off", &pictureArchive);
|
err = data->AddMessage("_e_off", &pictureArchive);
|
||||||
if (err != B_OK) return err;
|
if (err != B_OK)
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we add messages for pictures that don't exist?
|
// Do we add messages for pictures that don't exist?
|
||||||
if (fBehavior == B_TWO_STATE_BUTTON)
|
if (fBehavior == B_TWO_STATE_BUTTON) {
|
||||||
{
|
if (fDisabledOn->Archive(&pictureArchive, deep) == B_OK) {
|
||||||
if (fDisabledOn->Archive(&pictureArchive, deep) == B_OK)
|
|
||||||
{
|
|
||||||
err = data->AddMessage("_d_on", &pictureArchive);
|
err = data->AddMessage("_d_on", &pictureArchive);
|
||||||
if (err != B_OK) return err;
|
if (err != B_OK)
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fDisabledOff->Archive(&pictureArchive, deep) == B_OK)
|
if (fDisabledOff->Archive(&pictureArchive, deep) == B_OK) {
|
||||||
{
|
|
||||||
err = data->AddMessage("_d_off", &pictureArchive);
|
err = data->AddMessage("_d_off", &pictureArchive);
|
||||||
if (err != B_OK) return err;
|
if (err != B_OK)
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = data->AddInt32("_behave", fBehavior);
|
return data->AddInt32("_behave", fBehavior);
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::Draw
|
|
||||||
* Params: BRect updateRect
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::Draw (BRect updateRect)
|
BPictureButton::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
BRect rect = Bounds();
|
BRect rect = Bounds();
|
||||||
|
|
||||||
@@ -215,306 +131,176 @@ BPictureButton::Draw (BRect updateRect)
|
|||||||
// We should request the view's base color which normaly is (216,216,216)
|
// We should request the view's base color which normaly is (216,216,216)
|
||||||
rgb_color color = ui_color(B_PANEL_BACKGROUND_COLOR);
|
rgb_color color = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||||
|
|
||||||
if (fBehavior == B_ONE_STATE_BUTTON)
|
if (fBehavior == B_ONE_STATE_BUTTON) {
|
||||||
{
|
if (Value() == B_CONTROL_ON)
|
||||||
if (BControl::Value() == B_CONTROL_ON)
|
DrawPicture(fEnabledOn);
|
||||||
{
|
|
||||||
BView::DrawPicture(fEnabledOn);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
DrawPicture(fEnabledOff);
|
||||||
BView::DrawPicture(fEnabledOff);
|
} else {
|
||||||
}
|
// B_TWO_STATE_BUTTON
|
||||||
}
|
|
||||||
else // Must be B_TWO_STATE_BUTTON:
|
if (IsEnabled()) {
|
||||||
{
|
if (Value() == B_CONTROL_ON)
|
||||||
if (BControl::IsEnabled())
|
DrawPicture(fEnabledOn);
|
||||||
{
|
|
||||||
if (BControl::Value() == B_CONTROL_ON)
|
|
||||||
{
|
|
||||||
BView::DrawPicture(fEnabledOn);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
DrawPicture(fEnabledOff);
|
||||||
BView::DrawPicture(fEnabledOff);
|
} else {
|
||||||
}
|
// disabled
|
||||||
}
|
if (Value() == B_CONTROL_ON) {
|
||||||
else // Must be Disabled:
|
|
||||||
{
|
|
||||||
if (BControl::Value() == B_CONTROL_ON)
|
|
||||||
{
|
|
||||||
if (fDisabledOn == NULL)
|
if (fDisabledOn == NULL)
|
||||||
{
|
|
||||||
debugger("Need to set the 'disabled' pictures for this BPictureButton ");
|
debugger("Need to set the 'disabled' pictures for this BPictureButton ");
|
||||||
}
|
|
||||||
BView::DrawPicture(fDisabledOn);
|
DrawPicture(fDisabledOn);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (fDisabledOn == NULL)
|
if (fDisabledOn == NULL)
|
||||||
{
|
|
||||||
debugger("Need to set the 'disabled' pictures for this BPictureButton ");
|
debugger("Need to set the 'disabled' pictures for this BPictureButton ");
|
||||||
}
|
|
||||||
BView::DrawPicture(fDisabledOff);
|
DrawPicture(fDisabledOff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsFocus())
|
if (IsFocus()) {
|
||||||
{
|
SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
|
||||||
SetHighColor( ui_color(B_KEYBOARD_NAVIGATION_COLOR) );
|
|
||||||
StrokeRect(rect, B_SOLID_HIGH);
|
StrokeRect(rect, B_SOLID_HIGH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::MouseDown
|
|
||||||
* Params: BPoint where
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::MouseDown (BPoint point)
|
BPictureButton::MouseDown(BPoint point)
|
||||||
{
|
{
|
||||||
if (!IsEnabled())
|
if (!IsEnabled()) {
|
||||||
{
|
|
||||||
BControl::MouseDown(point);
|
BControl::MouseDown(point);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY | B_SUSPEND_VIEW_FOCUS);
|
SetMouseEventMask(B_POINTER_EVENTS,
|
||||||
|
B_NO_POINTER_HISTORY | B_SUSPEND_VIEW_FOCUS);
|
||||||
|
|
||||||
if (fBehavior == B_ONE_STATE_BUTTON)
|
if (fBehavior == B_ONE_STATE_BUTTON) {
|
||||||
{
|
|
||||||
SetValue(B_CONTROL_ON);
|
SetValue(B_CONTROL_ON);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Value() == B_CONTROL_ON)
|
if (Value() == B_CONTROL_ON)
|
||||||
{
|
|
||||||
SetValue(B_CONTROL_OFF);
|
SetValue(B_CONTROL_OFF);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
SetValue(B_CONTROL_ON);
|
SetValue(B_CONTROL_ON);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SetTracking(true);
|
SetTracking(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::MouseUp
|
|
||||||
* Params: BPoint pt
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::MouseUp (BPoint point)
|
BPictureButton::MouseUp(BPoint point)
|
||||||
{
|
{
|
||||||
if (IsEnabled() && IsTracking())
|
if (IsEnabled() && IsTracking()) {
|
||||||
{
|
if (Bounds().Contains(point)) {
|
||||||
if (Bounds().Contains(point))
|
if (fBehavior == B_ONE_STATE_BUTTON) {
|
||||||
{
|
if (Value() == B_CONTROL_ON) {
|
||||||
if (fBehavior == B_ONE_STATE_BUTTON)
|
|
||||||
{
|
|
||||||
if (Value() == B_CONTROL_ON)
|
|
||||||
{
|
|
||||||
snooze(75000);
|
snooze(75000);
|
||||||
SetValue(B_CONTROL_OFF);
|
SetValue(B_CONTROL_OFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BControl::Invoke();
|
Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTracking(false);
|
SetTracking(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::MouseMoved
|
|
||||||
* Params: BPoint pt, uint32 code, const BMessage *msg
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::MouseMoved (BPoint pt, uint32 code, const BMessage *msg)
|
BPictureButton::MouseMoved(BPoint point, uint32 transit, const BMessage *msg)
|
||||||
{
|
{
|
||||||
if (IsEnabled() && IsTracking())
|
if (IsEnabled() && IsTracking()) {
|
||||||
{
|
if (transit == B_EXITED_VIEW)
|
||||||
if (code == B_EXITED_VIEW)
|
|
||||||
SetValue(B_CONTROL_OFF);
|
SetValue(B_CONTROL_OFF);
|
||||||
else if (code == B_ENTERED_VIEW)
|
else if (transit == B_ENTERED_VIEW)
|
||||||
SetValue(B_CONTROL_ON);
|
SetValue(B_CONTROL_ON);
|
||||||
}
|
} else
|
||||||
else
|
BControl::MouseMoved(point, transit, msg);
|
||||||
{
|
|
||||||
BControl::MouseMoved(pt, code, msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::KeyDown
|
|
||||||
* Params: const char *bytes, int32 numBytes
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::KeyDown (const char *bytes, int32 numBytes)
|
BPictureButton::KeyDown(const char *bytes, int32 numBytes)
|
||||||
{
|
{
|
||||||
if (numBytes == 1)
|
if (numBytes == 1) {
|
||||||
{
|
switch (bytes[0]) {
|
||||||
switch (bytes[0])
|
|
||||||
{
|
|
||||||
case B_ENTER:
|
case B_ENTER:
|
||||||
case B_SPACE:
|
case B_SPACE:
|
||||||
if (fBehavior == B_ONE_STATE_BUTTON)
|
if (fBehavior == B_ONE_STATE_BUTTON) {
|
||||||
{
|
|
||||||
SetValue(B_CONTROL_ON);
|
SetValue(B_CONTROL_ON);
|
||||||
snooze(50000);
|
snooze(50000);
|
||||||
SetValue(B_CONTROL_OFF);
|
SetValue(B_CONTROL_OFF);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Value() == B_CONTROL_ON)
|
if (Value() == B_CONTROL_ON)
|
||||||
{
|
|
||||||
SetValue(B_CONTROL_OFF);
|
SetValue(B_CONTROL_OFF);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
SetValue(B_CONTROL_ON);
|
SetValue(B_CONTROL_ON);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Invoke();
|
Invoke();
|
||||||
break;
|
return;
|
||||||
|
|
||||||
default:
|
|
||||||
BControl::KeyDown(bytes, numBytes);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
BControl::KeyDown(bytes, numBytes);
|
||||||
BControl::KeyDown(bytes, numBytes);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::SetEnabledOn
|
|
||||||
* Params: BPicture *on
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::SetEnabledOn (BPicture *on)
|
BPictureButton::SetEnabledOn(BPicture *on)
|
||||||
{
|
{
|
||||||
if (!fEnabledOn)
|
delete fEnabledOn;
|
||||||
{
|
fEnabledOn = new BPicture(*on);
|
||||||
delete fEnabledOn;
|
|
||||||
}
|
|
||||||
fEnabledOn = new BPicture (*on);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::SetEnabledOff
|
|
||||||
* Params: BPicture *off
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::SetEnabledOff (BPicture *off)
|
BPictureButton::SetEnabledOff(BPicture *off)
|
||||||
{
|
{
|
||||||
if (!fEnabledOff)
|
delete fEnabledOff;
|
||||||
{
|
fEnabledOff = new BPicture(*off);
|
||||||
delete fEnabledOff;
|
|
||||||
}
|
|
||||||
fEnabledOff = new BPicture (*off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::SetDisabledOn
|
|
||||||
* Params: BPicture *on
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::SetDisabledOn (BPicture *on)
|
BPictureButton::SetDisabledOn(BPicture *on)
|
||||||
{
|
{
|
||||||
if (!fDisabledOn)
|
delete fDisabledOn;
|
||||||
{
|
fDisabledOn = new BPicture(*on);
|
||||||
delete fDisabledOn;
|
|
||||||
}
|
|
||||||
fDisabledOn = new BPicture (*on);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::SetDisabledOff
|
|
||||||
* Params: BPicture *off
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::SetDisabledOff (BPicture *off)
|
BPictureButton::SetDisabledOff(BPicture *off)
|
||||||
{
|
{
|
||||||
if (!fDisabledOff)
|
delete fDisabledOff;
|
||||||
{
|
fDisabledOff = new BPicture(*off);
|
||||||
delete fDisabledOff;
|
|
||||||
}
|
|
||||||
fDisabledOff = new BPicture (*off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::EnabledOn
|
|
||||||
* Params:
|
|
||||||
* Returns: BPicture *
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
BPicture *
|
BPicture *
|
||||||
BPictureButton::EnabledOn () const
|
BPictureButton::EnabledOn() const
|
||||||
{
|
{
|
||||||
return fEnabledOn;
|
return fEnabledOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::EnabledOff
|
|
||||||
* Params:
|
|
||||||
* Returns: BPicture *
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
BPicture *
|
BPicture *
|
||||||
BPictureButton::EnabledOff () const
|
BPictureButton::EnabledOff() const
|
||||||
{
|
{
|
||||||
return fEnabledOff;
|
return fEnabledOff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::DisabledOn
|
|
||||||
* Params:
|
|
||||||
* Returns: BPicture *
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
BPicture *
|
BPicture *
|
||||||
BPictureButton::DisabledOn () const
|
BPictureButton::DisabledOn() const
|
||||||
{
|
{
|
||||||
return fDisabledOn;
|
return fDisabledOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::DisabledOff
|
|
||||||
* Params:
|
|
||||||
* Returns: BPicture *
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
BPicture *
|
BPicture *
|
||||||
BPictureButton::DisabledOff() const
|
BPictureButton::DisabledOff() const
|
||||||
{
|
{
|
||||||
@@ -522,235 +308,129 @@ BPictureButton::DisabledOff() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::SetBehavior
|
|
||||||
* Params: uint32 behavior
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::SetBehavior (uint32 behavior)
|
BPictureButton::SetBehavior(uint32 behavior)
|
||||||
{
|
{
|
||||||
fBehavior = behavior;
|
fBehavior = behavior;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::Behavior
|
|
||||||
* Params:
|
|
||||||
* Returns: uint32
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
uint32
|
uint32
|
||||||
BPictureButton::Behavior () const
|
BPictureButton::Behavior() const
|
||||||
{
|
{
|
||||||
return fBehavior;
|
return fBehavior;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::MessageReceived
|
|
||||||
* Params: BMessage *msg
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::MessageReceived (BMessage *msg)
|
BPictureButton::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
BControl::MessageReceived(msg);
|
BControl::MessageReceived(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::WindowActivated
|
|
||||||
* Params: bool state
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::WindowActivated (bool state)
|
BPictureButton::WindowActivated(bool state)
|
||||||
{
|
{
|
||||||
BView::WindowActivated (state);
|
BControl::WindowActivated(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::AttachedToWindow
|
|
||||||
* Params:
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::AttachedToWindow ()
|
BPictureButton::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BControl::AttachedToWindow();
|
BControl::AttachedToWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::DetachedFromWindow
|
|
||||||
* Params:
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::DetachedFromWindow ()
|
BPictureButton::DetachedFromWindow()
|
||||||
{
|
{
|
||||||
BView::DetachedFromWindow();
|
BControl::DetachedFromWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::SetValue
|
|
||||||
* Params: int32 value
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::SetValue (int32 value)
|
BPictureButton::SetValue(int32 value)
|
||||||
{
|
{
|
||||||
BControl::SetValue(value);
|
BControl::SetValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::Invoke
|
|
||||||
* Params: BMessage *msg
|
|
||||||
* Returns: status_t
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
status_t
|
status_t
|
||||||
BPictureButton::Invoke (BMessage *msg)
|
BPictureButton::Invoke(BMessage *msg)
|
||||||
{
|
{
|
||||||
return BControl::Invoke(msg);
|
return BControl::Invoke(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::FrameMoved
|
|
||||||
* Params: BPoint new_position
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::FrameMoved (BPoint new_position)
|
BPictureButton::FrameMoved(BPoint newPosition)
|
||||||
{
|
{
|
||||||
BView::FrameMoved (new_position);
|
BControl::FrameMoved(newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::FrameResized
|
|
||||||
* Params: float new_width, float new_height
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::FrameResized (float new_width, float new_height)
|
BPictureButton::FrameResized(float newWidth, float newHeight)
|
||||||
{
|
{
|
||||||
BView::FrameResized (new_width, new_height);
|
BControl::FrameResized(newWidth, newHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::ResolveSpecifier
|
|
||||||
* Params: BMessage *msg, int32 index, BMessage *specifier, int32 form, const char *property
|
|
||||||
* Returns: BHandler *
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
BHandler *
|
BHandler *
|
||||||
BPictureButton::ResolveSpecifier (BMessage *msg, int32 index, BMessage *specifier, int32 form, const char *property)
|
BPictureButton::ResolveSpecifier(BMessage *msg, int32 index,
|
||||||
|
BMessage *specifier, int32 form, const char *property)
|
||||||
{
|
{
|
||||||
return BControl::ResolveSpecifier(msg, index, specifier, form, property);
|
return BControl::ResolveSpecifier(msg, index, specifier, form, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::GetSupportedSuites
|
|
||||||
* Params: BMessage *data
|
|
||||||
* Returns: status_t
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
status_t
|
status_t
|
||||||
BPictureButton::GetSupportedSuites (BMessage *data)
|
BPictureButton::GetSupportedSuites(BMessage *data)
|
||||||
{
|
{
|
||||||
return BControl::GetSupportedSuites(data);
|
return BControl::GetSupportedSuites(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::ResizeToPreferred
|
|
||||||
* Params:
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::ResizeToPreferred ()
|
BPictureButton::ResizeToPreferred()
|
||||||
{
|
{
|
||||||
float w, h;
|
float width, height;
|
||||||
GetPreferredSize (&w, &h);
|
GetPreferredSize(&width, &height);
|
||||||
BView::ResizeTo (w,h);
|
BControl::ResizeTo(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::GetPreferredSize
|
|
||||||
* Params: float *width, float *height
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::GetPreferredSize (float *width, float *height)
|
BPictureButton::GetPreferredSize(float* _width, float* _height)
|
||||||
{
|
{
|
||||||
// Need to do some test to see what the Be method returns...
|
// Need to do some test to see what the Be method returns...
|
||||||
|
BControl::GetPreferredSize(_width, _height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::MakeFocus
|
|
||||||
* Params: bool state
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::MakeFocus (bool state)
|
BPictureButton::MakeFocus(bool state)
|
||||||
{
|
{
|
||||||
BControl::MakeFocus(state);
|
BControl::MakeFocus(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::AllAttached
|
|
||||||
* Params:
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::AllAttached ()
|
BPictureButton::AllAttached()
|
||||||
{
|
{
|
||||||
BView::AllAttached();
|
BControl::AllAttached();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::AllDetached
|
|
||||||
* Params:
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::AllDetached ()
|
BPictureButton::AllDetached()
|
||||||
{
|
{
|
||||||
BView::AllDetached();
|
BControl::AllDetached();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::Perform
|
|
||||||
* Params: perform_code d, void *arg
|
|
||||||
* Returns: status_t
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
status_t
|
status_t
|
||||||
BPictureButton::Perform (perform_code d, void *arg)
|
BPictureButton::Perform (perform_code d, void *arg)
|
||||||
{
|
{
|
||||||
@@ -759,48 +439,11 @@ BPictureButton::Perform (perform_code d, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
void BPictureButton::_ReservedPictureButton1() {}
|
||||||
* Method: BPictureButton::_ReservedPictureButton1
|
void BPictureButton::_ReservedPictureButton2() {}
|
||||||
* Params:
|
void BPictureButton::_ReservedPictureButton3() {}
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
|
||||||
BPictureButton::_ReservedPictureButton1 ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::_ReservedPictureButton2
|
|
||||||
* Params:
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
|
||||||
BPictureButton::_ReservedPictureButton2()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::_ReservedPictureButton3
|
|
||||||
* Params:
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
|
||||||
BPictureButton::_ReservedPictureButton3()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::operator=
|
|
||||||
* Params: const BPictureButton &
|
|
||||||
* Returns: BPictureButton &
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
BPictureButton &
|
BPictureButton &
|
||||||
BPictureButton::operator=(const BPictureButton &button)
|
BPictureButton::operator=(const BPictureButton &button)
|
||||||
{
|
{
|
||||||
@@ -808,24 +451,12 @@ BPictureButton::operator=(const BPictureButton &button)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::Redraw
|
|
||||||
* Params:
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::Redraw()
|
BPictureButton::Redraw()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Method: BPictureButton::InitData
|
|
||||||
* Params:
|
|
||||||
* Returns: void
|
|
||||||
* Effects:
|
|
||||||
***********************************************************************/
|
|
||||||
void
|
void
|
||||||
BPictureButton::InitData()
|
BPictureButton::InitData()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user