From a0b1d631cc1d7640685274e7bc0dcaf19316cdd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 15 Feb 2009 15:41:35 +0000 Subject: [PATCH] Added layout friendly constructor to this base class. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29215 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/ChannelControl.h | 8 ++++++-- src/kits/interface/ChannelControl.cpp | 25 ++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/headers/os/interface/ChannelControl.h b/headers/os/interface/ChannelControl.h index c79bec4b44..82383c1342 100644 --- a/headers/os/interface/ChannelControl.h +++ b/headers/os/interface/ChannelControl.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2008 Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT/X11 license. + * Copyright (C) 2008-2009 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT license. */ #ifndef _CHANNEL_CONTROL_H #define _CHANNEL_CONTROL_H @@ -19,6 +19,10 @@ public: uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 viewFlags = B_WILL_DRAW); + BChannelControl(const char* name, + const char* label, BMessage* model, + int32 channelCount = 1, + uint32 viewFlags = B_WILL_DRAW); BChannelControl(BMessage* archive); virtual ~BChannelControl(); diff --git a/src/kits/interface/ChannelControl.cpp b/src/kits/interface/ChannelControl.cpp index a6907eebe1..1ffa878820 100644 --- a/src/kits/interface/ChannelControl.cpp +++ b/src/kits/interface/ChannelControl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005, Haiku Inc. All Rights Reserved. + * Copyright 2005-2009, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ @@ -57,6 +57,29 @@ BChannelControl::BChannelControl(BRect frame, const char *name, const char *labe } +BChannelControl::BChannelControl(const char *name, const char *label, + BMessage *model, int32 channel_count, uint32 flags) + : BControl(name, label, model, flags), + fChannelCount(channel_count), + fCurrentChannel(0), + fChannelMin(NULL), + fChannelMax(NULL), + fChannelValues(NULL), + fMultiLabels(NULL), + fModificationMsg(NULL) +{ + fChannelMin = new int32[channel_count]; + memset(fChannelMin, 0, sizeof(int32) * channel_count); + + fChannelMax = new int32[channel_count]; + for (int32 i = 0; i < channel_count; i++) + fChannelMax[i] = 100; + + fChannelValues = new int32[channel_count]; + memset(fChannelValues, 0, sizeof(int32) * channel_count); +} + + BChannelControl::BChannelControl(BMessage *archive) : BControl(archive), fChannelCount(0),