Rewrote ChannelControl.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27287 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,221 +1,171 @@
|
|||||||
/*******************************************************************************
|
/*
|
||||||
/
|
* Copyright (C) 2008 Haiku, Inc. All rights reserved.
|
||||||
/ File: ChannelControl.h
|
* Distributed under the terms of the MIT/X11 license.
|
||||||
/
|
*/
|
||||||
/ Description: BChannelControl is the base class for controls that
|
#ifndef _CHANNEL_CONTROL_H
|
||||||
/ have several independent values, with minima and maxima.
|
|
||||||
/
|
|
||||||
/ Copyright 1998-99, Be Incorporated, All Rights Reserved
|
|
||||||
/
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#if !defined(_CHANNEL_CONTROL_H)
|
|
||||||
#define _CHANNEL_CONTROL_H
|
#define _CHANNEL_CONTROL_H
|
||||||
|
|
||||||
|
//! BChannelControl is the base class for controls that have several
|
||||||
|
// independent values, with minima and maxima.
|
||||||
|
|
||||||
#include <Control.h>
|
#include <Control.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
class BChannelControl :
|
class BChannelControl : public BControl {
|
||||||
public BControl
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
BChannelControl(
|
BChannelControl(BRect frame, const char* name,
|
||||||
BRect frame,
|
const char* label, BMessage* model,
|
||||||
const char * name,
|
int32 channelCount = 1,
|
||||||
const char * label,
|
uint32 resizeFlags
|
||||||
BMessage * model,
|
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||||
int32 channel_count = 1,
|
uint32 viewFlags = B_WILL_DRAW);
|
||||||
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
BChannelControl(BMessage* archive);
|
||||||
uint32 flags = B_WILL_DRAW);
|
virtual ~BChannelControl();
|
||||||
BChannelControl(
|
|
||||||
BMessage * from);
|
|
||||||
virtual ~BChannelControl();
|
|
||||||
virtual status_t Archive(
|
|
||||||
BMessage * into,
|
|
||||||
bool deep = true) const;
|
|
||||||
|
|
||||||
virtual void Draw(
|
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
||||||
BRect area) = 0;
|
|
||||||
virtual void MouseDown(
|
|
||||||
BPoint where) = 0;
|
|
||||||
virtual void KeyDown(
|
|
||||||
const char * bytes,
|
|
||||||
int32 size) = 0;
|
|
||||||
|
|
||||||
virtual void FrameResized(
|
virtual void Draw(BRect updateRect) = 0;
|
||||||
float width,
|
virtual void MouseDown(BPoint where) = 0;
|
||||||
float height);
|
virtual void KeyDown(const char* bytes, int32 size) = 0;
|
||||||
virtual void SetFont(
|
|
||||||
const BFont * font,
|
virtual void FrameResized(float width, float height);
|
||||||
|
virtual void SetFont(const BFont* font,
|
||||||
uint32 mask = B_FONT_ALL);
|
uint32 mask = B_FONT_ALL);
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
virtual void ResizeToPreferred();
|
virtual void ResizeToPreferred();
|
||||||
virtual void GetPreferredSize(
|
virtual void GetPreferredSize(float* width,
|
||||||
float * width,
|
float* height) = 0;
|
||||||
float * height) = 0;
|
|
||||||
virtual void MessageReceived(
|
|
||||||
BMessage * message);
|
|
||||||
|
|
||||||
virtual BHandler *ResolveSpecifier(BMessage *msg,
|
virtual void MessageReceived(BMessage* message);
|
||||||
int32 index,
|
|
||||||
BMessage *specifier,
|
|
||||||
int32 form,
|
|
||||||
const char *property);
|
|
||||||
virtual status_t GetSupportedSuites(BMessage *data);
|
|
||||||
|
|
||||||
virtual void SetModificationMessage(
|
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
|
||||||
BMessage *message);
|
BMessage* specifier, int32 form,
|
||||||
BMessage *ModificationMessage() const;
|
const char* property);
|
||||||
|
virtual status_t GetSupportedSuites(BMessage* data);
|
||||||
|
|
||||||
virtual status_t Invoke(BMessage *msg = NULL);
|
virtual void SetModificationMessage(BMessage* message);
|
||||||
|
BMessage* ModificationMessage() const;
|
||||||
|
|
||||||
// Perform a full-fledged channel invocation. These methods are
|
virtual status_t Invoke(BMessage* withMessage = NULL);
|
||||||
// just like Invoke() and InvokeNotify(), but include information
|
|
||||||
// about all of the channels in the control.
|
//! These methods are similar to Invoke() Invoke() and InvokeNotify(), but
|
||||||
virtual status_t InvokeChannel(BMessage *msg = NULL,
|
// include additional information about all of the channels in the control.
|
||||||
int32 from_channel = 0,
|
virtual status_t InvokeChannel(BMessage* message = NULL,
|
||||||
int32 channel_count = -1,
|
int32 fromChannel = 0,
|
||||||
const bool* in_mask = NULL);
|
int32 channelCount = -1,
|
||||||
status_t InvokeNotifyChannel(BMessage *msg = NULL,
|
const bool* _mask = NULL);
|
||||||
|
status_t InvokeNotifyChannel(BMessage* message = NULL,
|
||||||
uint32 kind = B_CONTROL_INVOKED,
|
uint32 kind = B_CONTROL_INVOKED,
|
||||||
int32 from_channel = 0,
|
int32 fromChannel = 0,
|
||||||
int32 channel_count = -1,
|
int32 channelCount = -1,
|
||||||
const bool* in_mask = NULL);
|
const bool* _mask = NULL);
|
||||||
|
|
||||||
virtual void SetValue( /* SetCurrentChannel() determines which channel */
|
virtual void SetValue(int32 value);
|
||||||
int32 value);
|
// SetCurrentChannel() determines which channel
|
||||||
virtual status_t SetCurrentChannel(
|
virtual status_t SetCurrentChannel(int32 index);
|
||||||
int32 channel);
|
|
||||||
int32 CurrentChannel() const;
|
int32 CurrentChannel() const;
|
||||||
|
|
||||||
virtual int32 CountChannels() const;
|
virtual int32 CountChannels() const;
|
||||||
virtual int32 MaxChannelCount() const = 0;
|
virtual int32 MaxChannelCount() const = 0;
|
||||||
virtual status_t SetChannelCount(
|
virtual status_t SetChannelCount(int32 count);
|
||||||
int32 channel_count);
|
int32 ValueFor(int32 channel) const;
|
||||||
int32 ValueFor(
|
virtual int32 GetValue(int32* _values, int32 fromChannel,
|
||||||
int32 channel) const;
|
int32 channelCount) const;
|
||||||
virtual int32 GetValue(
|
status_t SetValueFor(int32 channel, int32 value);
|
||||||
int32 * out_values,
|
virtual status_t SetValue(int32 fromChannel, int32 channelCount,
|
||||||
int32 from_channel,
|
const int32* values);
|
||||||
int32 channel_count) const;
|
status_t SetAllValue(int32 values);
|
||||||
status_t SetValueFor(
|
status_t SetLimitsFor(int32 channel, int32 minimum,
|
||||||
int32 channel,
|
|
||||||
int32 value);
|
|
||||||
virtual status_t SetValue(
|
|
||||||
int32 from_channel,
|
|
||||||
int32 channel_count,
|
|
||||||
const int32 * in_values);
|
|
||||||
status_t SetAllValue(
|
|
||||||
int32 values);
|
|
||||||
status_t SetLimitsFor(
|
|
||||||
int32 channel,
|
|
||||||
int32 minimum,
|
|
||||||
int32 maximum);
|
int32 maximum);
|
||||||
status_t GetLimitsFor(
|
status_t GetLimitsFor(int32 channel, int32* _minimum,
|
||||||
int32 channel,
|
int32* _maximum) const ;
|
||||||
int32 * minimum,
|
virtual status_t SetLimitsFor(int32 fromChannel,
|
||||||
int32 * maximum) const ;
|
int32 channelCount, const int32* minima,
|
||||||
virtual status_t SetLimitsFor(
|
const int32* maxima);
|
||||||
int32 from_channel,
|
virtual status_t GetLimitsFor(int32 fromChannel,
|
||||||
int32 channel_count,
|
int32 channelCount, int32* minima,
|
||||||
const int32 * minimum,
|
int32* maxima) const;
|
||||||
const int32 * maximum);
|
status_t SetLimits(int32 minimum, int32 maximum);
|
||||||
virtual status_t GetLimitsFor(
|
status_t GetLimits(int32* _minimum,
|
||||||
int32 from_channel,
|
int32* _maximum) const;
|
||||||
int32 channel_count,
|
|
||||||
int32 * minimum,
|
|
||||||
int32 * maximum) const;
|
|
||||||
status_t SetLimits(
|
|
||||||
int32 minimum,
|
|
||||||
int32 maximum);
|
|
||||||
status_t GetLimits(
|
|
||||||
int32 * outMinimum,
|
|
||||||
int32 * outMaximum) const;
|
|
||||||
|
|
||||||
virtual bool SupportsIndividualLimits() const = 0;
|
virtual bool SupportsIndividualLimits() const = 0;
|
||||||
virtual status_t SetLimitLabels(
|
virtual status_t SetLimitLabels(const char* minLabel,
|
||||||
const char * min_label,
|
const char* maxLabel);
|
||||||
const char * max_label);
|
const char* MinLimitLabel() const;
|
||||||
const char * MinLimitLabel() const;
|
const char* MaxLimitLabel() const;
|
||||||
const char * MaxLimitLabel() const;
|
virtual status_t SetLimitLabelsFor(int32 channel,
|
||||||
virtual status_t SetLimitLabelsFor(
|
const char* minLabel, const char* maxLabel);
|
||||||
int32 channel,
|
virtual status_t SetLimitLabelsFor(int32 fromChannel,
|
||||||
const char * minLabel,
|
int32 channelCount, const char* minLabel,
|
||||||
const char * maxLabel);
|
const char* maxLabel);
|
||||||
virtual status_t SetLimitLabelsFor(
|
const char* MinLimitLabelFor(int32 channel) const;
|
||||||
int32 from_channel,
|
const char* MaxLimitLabelFor(int32 channel) const;
|
||||||
int32 channel_count,
|
|
||||||
const char * minLabel,
|
|
||||||
const char * maxLabel);
|
|
||||||
const char * MinLimitLabelFor(
|
|
||||||
int32 channel) const;
|
|
||||||
const char * MaxLimitLabelFor(
|
|
||||||
int32 channel) const;
|
|
||||||
private:
|
private:
|
||||||
|
// Forbidden (and unimplemented)
|
||||||
|
BChannelControl(const BChannelControl& other);
|
||||||
|
BChannelControl& operator=(const BChannelControl& other);
|
||||||
|
|
||||||
BChannelControl( /* unimplemented */
|
virtual void _Reserverd_ChannelControl_0(void *, ...);
|
||||||
const BChannelControl &);
|
virtual void _Reserverd_ChannelControl_1(void *, ...);
|
||||||
BChannelControl & operator=( /* unimplemented */
|
virtual void _Reserverd_ChannelControl_2(void *, ...);
|
||||||
const BChannelControl &);
|
virtual void _Reserverd_ChannelControl_3(void *, ...);
|
||||||
virtual void _Reserverd_ChannelControl_0(void *, ...);
|
virtual void _Reserverd_ChannelControl_4(void *, ...);
|
||||||
virtual void _Reserverd_ChannelControl_1(void *, ...);
|
virtual void _Reserverd_ChannelControl_5(void *, ...);
|
||||||
virtual void _Reserverd_ChannelControl_2(void *, ...);
|
virtual void _Reserverd_ChannelControl_6(void *, ...);
|
||||||
virtual void _Reserverd_ChannelControl_3(void *, ...);
|
virtual void _Reserverd_ChannelControl_7(void *, ...);
|
||||||
virtual void _Reserverd_ChannelControl_4(void *, ...);
|
virtual void _Reserverd_ChannelControl_8(void *, ...);
|
||||||
virtual void _Reserverd_ChannelControl_5(void *, ...);
|
virtual void _Reserverd_ChannelControl_9(void *, ...);
|
||||||
virtual void _Reserverd_ChannelControl_6(void *, ...);
|
virtual void _Reserverd_ChannelControl_10(void *, ...);
|
||||||
virtual void _Reserverd_ChannelControl_7(void *, ...);
|
virtual void _Reserverd_ChannelControl_11(void *, ...);
|
||||||
virtual void _Reserverd_ChannelControl_8(void *, ...);
|
|
||||||
virtual void _Reserverd_ChannelControl_9(void *, ...);
|
|
||||||
virtual void _Reserverd_ChannelControl_10(void *, ...);
|
|
||||||
virtual void _Reserverd_ChannelControl_11(void *, ...);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
inline int32* const& MinLimitList() const;
|
||||||
inline int32 * const & MinLimitList() const;
|
inline int32* const& MaxLimitList() const;
|
||||||
inline int32 * const & MaxLimitList() const;
|
inline int32* const& ValueList() const;
|
||||||
inline int32 * const & ValueList() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int32 fChannelCount;
|
int32 fChannelCount;
|
||||||
int32 fCurrentChannel;
|
int32 fCurrentChannel;
|
||||||
int32 * fChannelMin;
|
int32* fChannelMin;
|
||||||
int32 * fChannelMax;
|
int32* fChannelMax;
|
||||||
int32 * fChannelValues;
|
int32* fChannelValues;
|
||||||
|
|
||||||
BString fMinLabel;
|
BString fMinLabel;
|
||||||
BString fMaxLabel;
|
BString fMaxLabel;
|
||||||
|
|
||||||
void * fMultiLabels;
|
void* fMultiLabels;
|
||||||
|
|
||||||
BMessage * fModificationMsg;
|
BMessage* fModificationMsg;
|
||||||
|
|
||||||
uint32 _reserved_[15];
|
uint32 _reserved_[15];
|
||||||
|
|
||||||
status_t StuffValues(
|
status_t StuffValues(int32 fromChannel,
|
||||||
int32 from_channel,
|
int32 channelCount, const int32* values);
|
||||||
int32 channel_count,
|
|
||||||
const int32 * in_values);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int32 * const & BChannelControl::MinLimitList() const
|
|
||||||
|
inline int32* const&
|
||||||
|
BChannelControl::MinLimitList() const
|
||||||
{
|
{
|
||||||
return fChannelMin;
|
return fChannelMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int32 * const & BChannelControl::MaxLimitList() const
|
|
||||||
|
inline int32* const&
|
||||||
|
BChannelControl::MaxLimitList() const
|
||||||
{
|
{
|
||||||
return fChannelMax;
|
return fChannelMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int32 * const & BChannelControl::ValueList() const
|
|
||||||
|
inline int32* const&
|
||||||
|
BChannelControl::ValueList() const
|
||||||
{
|
{
|
||||||
return fChannelValues;
|
return fChannelValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* _CHANNEL_CONTROL_H */
|
#endif // _CHANNEL_CONTROL_H
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user