Style fixes to IK, focus on docs

This commit is contained in:
John Scipione
2014-06-13 17:27:01 -04:00
parent 4a2260f21a
commit 1f424632be
34 changed files with 1141 additions and 1117 deletions
+19 -19
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2006, Haiku, Inc. All rights reserved. * Copyright 2001-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _ALERT_H #ifndef _ALERT_H
@@ -9,11 +9,6 @@
#include <Window.h> #include <Window.h>
class BBitmap;
class BButton;
class BInvoker;
class BTextView;
// enum for flavors of alert // enum for flavors of alert
enum alert_type { enum alert_type {
B_EMPTY_ALERT = 0, B_EMPTY_ALERT = 0,
@@ -29,41 +24,46 @@ enum button_spacing {
}; };
class BBitmap;
class BButton;
class BInvoker;
class BTextView;
class BAlert : public BWindow { class BAlert : public BWindow {
public: public:
BAlert(const char* title, const char* text, BAlert(const char* title, const char* text,
const char* button1, const char* button2 = NULL, const char* button1, const char* button2 = NULL,
const char* button3 = NULL, const char* button3 = NULL,
button_width width = B_WIDTH_AS_USUAL, button_width width = B_WIDTH_AS_USUAL,
alert_type type = B_INFO_ALERT); alert_type type = B_INFO_ALERT);
BAlert(const char *title, const char *text, BAlert(const char* title, const char* text,
const char *button1, const char *button2, const char* button1, const char* button2,
const char *button3, button_width width, const char* button3, button_width width,
button_spacing spacing, button_spacing spacing,
alert_type type = B_INFO_ALERT); alert_type type = B_INFO_ALERT);
virtual ~BAlert(); virtual ~BAlert();
// Archiving // Archiving
BAlert(BMessage *data); BAlert(BMessage* data);
static BArchivable *Instantiate(BMessage *data); static BArchivable *Instantiate(BMessage* data);
virtual status_t Archive(BMessage *data, bool deep = true) const; virtual status_t Archive(BMessage* data, bool deep = true) const;
// BAlert guts // BAlert guts
void SetShortcut(int32 button_index, char key); void SetShortcut(int32 button_index, char key);
char Shortcut(int32 button_index) const; char Shortcut(int32 button_index) const;
int32 Go(); int32 Go();
status_t Go(BInvoker *invoker); status_t Go(BInvoker* invoker);
virtual void MessageReceived(BMessage *an_event); virtual void MessageReceived(BMessage* message);
virtual void FrameResized(float new_width, float new_height); virtual void FrameResized(float new_width, float new_height);
BButton* ButtonAt(int32 index) const; BButton* ButtonAt(int32 index) const;
BTextView* TextView() const; BTextView* TextView() const;
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form, BMessage* specifier, int32 what,
const char* property); const char* property);
virtual status_t GetSupportedSuites(BMessage *data); virtual status_t GetSupportedSuites(BMessage* data);
virtual void DispatchMessage(BMessage* message, BHandler* handler); virtual void DispatchMessage(BMessage* message, BHandler* handler);
virtual void Quit(); virtual void Quit();
@@ -71,9 +71,9 @@ class BAlert : public BWindow {
static BPoint AlertPosition(float width, float height); static BPoint AlertPosition(float width, float height);
virtual status_t Perform(perform_code d, void *arg); virtual status_t Perform(perform_code d, void* arg);
private: private:
friend class _BAlertFilter_; friend class _BAlertFilter_;
virtual void _ReservedAlert1(); virtual void _ReservedAlert1();
+2 -3
View File
@@ -66,9 +66,9 @@ public:
virtual void ResizeToPreferred(); virtual void ResizeToPreferred();
virtual status_t Invoke(BMessage* message = NULL); virtual status_t Invoke(BMessage* message = NULL);
virtual void FrameMoved(BPoint newPosition); virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float width, float height); virtual void FrameResized(float newWidth, float newHeight);
virtual void MakeFocus(bool focused = true); virtual void MakeFocus(bool focus = true);
virtual void AllAttached(); virtual void AllAttached();
virtual void AllDetached(); virtual void AllDetached();
@@ -78,7 +78,6 @@ public:
virtual status_t GetSupportedSuites(BMessage* message); virtual status_t GetSupportedSuites(BMessage* message);
virtual status_t Perform(perform_code d, void* arg); virtual status_t Perform(perform_code d, void* arg);
virtual BSize MinSize(); virtual BSize MinSize();
virtual BSize MaxSize(); virtual BSize MaxSize();
virtual BSize PreferredSize(); virtual BSize PreferredSize();
+22 -20
View File
@@ -5,34 +5,36 @@
#ifndef _CHANNEL_CONTROL_H #ifndef _CHANNEL_CONTROL_H
#define _CHANNEL_CONTROL_H #define _CHANNEL_CONTROL_H
//! BChannelControl is the base class for controls that have several //! BChannelControl is the base class for controls that have several
// independent values, with minima and maxima. // independent values, with minima and maxima.
#include <Control.h> #include <Control.h>
#include <String.h> #include <String.h>
class BChannelControl : public BControl { class BChannelControl : public BControl {
public: public:
BChannelControl(BRect frame, const char* name, BChannelControl(BRect frame, const char* name,
const char* label, BMessage* model, const char* label, BMessage* model,
int32 channelCount = 1, int32 channelCount = 1,
uint32 resizeFlags uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP, = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 viewFlags = B_WILL_DRAW); uint32 flags = B_WILL_DRAW);
BChannelControl(const char* name, BChannelControl(const char* name,
const char* label, BMessage* model, const char* label, BMessage* model,
int32 channelCount = 1, int32 channelCount = 1,
uint32 viewFlags = B_WILL_DRAW); uint32 flags = B_WILL_DRAW);
BChannelControl(BMessage* archive); BChannelControl(BMessage* archive);
virtual ~BChannelControl(); virtual ~BChannelControl();
virtual status_t Archive(BMessage* into, bool deep = true) const; virtual status_t Archive(BMessage* data, bool deep = true) const;
virtual void Draw(BRect updateRect) = 0; virtual void Draw(BRect updateRect) = 0;
virtual void MouseDown(BPoint where) = 0; virtual void MouseDown(BPoint where) = 0;
virtual void KeyDown(const char* bytes, int32 size) = 0; virtual void KeyDown(const char* bytes, int32 numBytes) = 0;
virtual void FrameResized(float width, float height); virtual void FrameResized(float newWidth, float newHeight);
virtual void SetFont(const BFont* font, virtual void SetFont(const BFont* font,
uint32 mask = B_FONT_ALL); uint32 mask = B_FONT_ALL);
@@ -45,14 +47,14 @@ public:
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form, BMessage* specifier, int32 what,
const char* property); const char* property);
virtual status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* data);
virtual void SetModificationMessage(BMessage* message); virtual void SetModificationMessage(BMessage* message);
BMessage* ModificationMessage() const; BMessage* ModificationMessage() const;
virtual status_t Invoke(BMessage* withMessage = NULL); virtual status_t Invoke(BMessage* message = NULL);
//! These methods are similar to Invoke() Invoke() and InvokeNotify(), but //! These methods are similar to Invoke() Invoke() and InvokeNotify(), but
// include additional information about all of the channels in the control. // include additional information about all of the channels in the control.
@@ -112,18 +114,18 @@ private:
BChannelControl(const BChannelControl& other); BChannelControl(const BChannelControl& other);
BChannelControl& operator=(const BChannelControl& other); BChannelControl& operator=(const BChannelControl& other);
virtual void _Reserverd_ChannelControl_0(void *, ...); virtual void _Reserverd_ChannelControl_0(void*, ...);
virtual void _Reserverd_ChannelControl_1(void *, ...); virtual void _Reserverd_ChannelControl_1(void*, ...);
virtual void _Reserverd_ChannelControl_2(void *, ...); virtual void _Reserverd_ChannelControl_2(void*, ...);
virtual void _Reserverd_ChannelControl_3(void *, ...); virtual void _Reserverd_ChannelControl_3(void*, ...);
virtual void _Reserverd_ChannelControl_4(void *, ...); virtual void _Reserverd_ChannelControl_4(void*, ...);
virtual void _Reserverd_ChannelControl_5(void *, ...); virtual void _Reserverd_ChannelControl_5(void*, ...);
virtual void _Reserverd_ChannelControl_6(void *, ...); virtual void _Reserverd_ChannelControl_6(void*, ...);
virtual void _Reserverd_ChannelControl_7(void *, ...); virtual void _Reserverd_ChannelControl_7(void*, ...);
virtual void _Reserverd_ChannelControl_8(void *, ...); virtual void _Reserverd_ChannelControl_8(void*, ...);
virtual void _Reserverd_ChannelControl_9(void *, ...); virtual void _Reserverd_ChannelControl_9(void*, ...);
virtual void _Reserverd_ChannelControl_10(void *, ...); virtual void _Reserverd_ChannelControl_10(void*, ...);
virtual void _Reserverd_ChannelControl_11(void *, ...); virtual void _Reserverd_ChannelControl_11(void*, ...);
protected: protected:
inline int32* const& MinLimitList() const; inline int32* const& MinLimitList() const;
+1 -1
View File
@@ -36,7 +36,7 @@ public:
virtual void AllDetached(); virtual void AllDetached();
virtual void FrameMoved(BPoint newPosition); virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float width, float height); virtual void FrameResized(float newWidth, float newHeight);
virtual void WindowActivated(bool active); virtual void WindowActivated(bool active);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
+4 -4
View File
@@ -29,11 +29,11 @@ public:
float cellSize, const char* name, float cellSize, const char* name,
BMessage* message = NULL, BMessage* message = NULL,
bool useOffscreen = false); bool useOffscreen = false);
BColorControl(BMessage* archive); BColorControl(BMessage* data);
virtual ~BColorControl(); virtual ~BColorControl();
static BArchivable* Instantiate(BMessage* archive); static BArchivable* Instantiate(BMessage* data);
virtual status_t Archive(BMessage* archive, virtual status_t Archive(BMessage* data,
bool deep = true) const; bool deep = true) const;
virtual void SetLayout(BLayout* layout); virtual void SetLayout(BLayout* layout);
@@ -91,7 +91,7 @@ private:
void _InitData(color_control_layout layout, void _InitData(color_control_layout layout,
float size, bool useOffscreen, float size, bool useOffscreen,
BMessage* archive = NULL); BMessage* data = NULL);
void _LayoutView(); void _LayoutView();
void _InitOffscreen(); void _InitOffscreen();
void _InvalidateSelector(int16 ramp, void _InvalidateSelector(int16 ramp,
+1 -1
View File
@@ -45,7 +45,7 @@ public:
virtual void AllDetached(); virtual void AllDetached();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void MakeFocus(bool focused = true); virtual void MakeFocus(bool focus = true);
virtual void KeyDown(const char* bytes, int32 numBytes); virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void MouseDown(BPoint where); virtual void MouseDown(BPoint where);
+3 -3
View File
@@ -53,8 +53,8 @@ public:
virtual void AllDetached(); virtual void AllDetached();
virtual void FrameResized(float newWidth, float newHeight); virtual void FrameResized(float newWidth, float newHeight);
virtual void FrameMoved(BPoint newPosition); virtual void FrameMoved(BPoint newPosition);
virtual void TargetedByScrollView(BScrollView* scroller); virtual void TargetedByScrollView(BScrollView* view);
virtual void WindowActivated(bool state); virtual void WindowActivated(bool active);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void KeyDown(const char* bytes, int32 numBytes); virtual void KeyDown(const char* bytes, int32 numBytes);
@@ -142,7 +142,7 @@ public:
virtual BHandler* ResolveSpecifier(BMessage* message, virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier, int32 index, BMessage* specifier,
int32 form, const char* property); int32 what, const char* property);
virtual status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* data);
virtual status_t Perform(perform_code code, void* arg); virtual status_t Perform(perform_code code, void* arg);
+1 -1
View File
@@ -45,7 +45,7 @@ public:
virtual void KeyDown(const char* bytes, int32 numBytes); virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void MakeFocus(bool focused); virtual void MakeFocus(bool focused);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void WindowActivated(bool state); virtual void WindowActivated(bool active);
virtual void MouseUp(BPoint where); virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 transit, virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage); const BMessage* dragMessage);
+7 -7
View File
@@ -41,11 +41,11 @@ public:
virtual void ResizeToPreferred(); virtual void ResizeToPreferred();
virtual void GetPreferredSize(float* _width, virtual void GetPreferredSize(float* _width,
float* _height); float* _height);
virtual void FrameMoved(BPoint position); virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float width, float height); virtual void FrameResized(float newWidth, float newHeight);
virtual void WindowActivated(bool state); virtual void WindowActivated(bool active);
virtual void MakeFocus(bool state = true); virtual void MakeFocus(bool focus = true);
virtual void Draw(BRect updateRect); virtual void Draw(BRect updateRect);
@@ -53,8 +53,8 @@ public:
virtual void KeyDown(const char* bytes, int32 numBytes); virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void MouseDown(BPoint where); virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where); virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 transit, virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* message); const BMessage* dragMessage);
virtual void SetEnabledOn(BPicture* picture); virtual void SetEnabledOn(BPicture* picture);
virtual void SetEnabledOff(BPicture* picture); virtual void SetEnabledOff(BPicture* picture);
@@ -74,7 +74,7 @@ public:
virtual BHandler* ResolveSpecifier(BMessage* message, virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier, int32 index, BMessage* specifier,
int32 form, const char* property); int32 what, const char* property);
virtual status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* data);
virtual status_t Perform(perform_code code, void* data); virtual status_t Perform(perform_code code, void* data);
+2 -2
View File
@@ -46,13 +46,13 @@ public:
const BMessage* dragMessage); const BMessage* dragMessage);
virtual void DetachedFromWindow(); virtual void DetachedFromWindow();
virtual void FrameMoved(BPoint newPosition); virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float width, float height); virtual void FrameResized(float newWidth, float newHeight);
virtual BHandler* ResolveSpecifier(BMessage* message, virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier, int32 index, BMessage* specifier,
int32 what, const char* property); int32 what, const char* property);
virtual void MakeFocus(bool focused = true); virtual void MakeFocus(bool focus = true);
virtual void AllAttached(); virtual void AllAttached();
virtual void AllDetached(); virtual void AllDetached();
virtual status_t GetSupportedSuites(BMessage* message); virtual status_t GetSupportedSuites(BMessage* message);
+2 -2
View File
@@ -34,8 +34,8 @@ public:
BRegion& operator=(const BRegion& other); BRegion& operator=(const BRegion& other);
bool operator==(const BRegion& other) const; bool operator==(const BRegion& other) const;
void Set(BRect newBounds); void Set(BRect rect);
void Set(clipping_rect newBounds); void Set(clipping_rect clipping);
BRect Frame() const; BRect Frame() const;
clipping_rect FrameInt() const; clipping_rect FrameInt() const;
+33 -25
View File
@@ -33,11 +33,33 @@ public:
virtual status_t Archive(BMessage* archive, virtual status_t Archive(BMessage* archive,
bool deep = true) const; bool deep = true) const;
virtual void AllAttached();
virtual void AllDetached();
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect updateRect);
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float newWidth, float newHeight);
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* dragMessage);
#if DISABLES_ON_WINDOW_DEACTIVATION
virtual void WindowActivated(bool active);
#endif
void SetValue(float value); void SetValue(float value);
float Value() const; float Value() const;
void SetProportion(float); void SetProportion(float);
float Proportion() const; float Proportion() const;
virtual void ValueChanged(float newValue); virtual void ValueChanged(float newValue);
void SetRange(float min, float max); void SetRange(float min, float max);
@@ -45,10 +67,12 @@ public:
void SetSteps(float smallStep, float largeStep); void SetSteps(float smallStep, float largeStep);
void GetSteps(float* _smallStep, void GetSteps(float* _smallStep,
float* _largeStep) const; float* _largeStep) const;
void SetTarget(BView *target); void SetTarget(BView *target);
void SetTarget(const char* targetName); void SetTarget(const char* targetName);
BView* Target() const; BView* Target() const;
void SetOrientation(orientation orientation);
void SetOrientation(orientation direction);
orientation Orientation() const; orientation Orientation() const;
// TODO: Make this a virtual method, it should be one, // TODO: Make this a virtual method, it should be one,
@@ -56,39 +80,23 @@ public:
// to be used in case the BScrollBar should draw part of // to be used in case the BScrollBar should draw part of
// the focus indication of the target view for aesthetical // the focus indication of the target view for aesthetical
// reasons. BScrollView will forward this method. // reasons. BScrollView will forward this method.
status_t SetBorderHighlighted(bool state); status_t SetBorderHighlighted(bool highlight);
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint pt);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved(BPoint pt, uint32 code,
const BMessage* dragMessage);
virtual void DetachedFromWindow();
virtual void Draw(BRect updateRect);
virtual void FrameMoved(BPoint new_position);
virtual void FrameResized(float newWidth, float newHeight);
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 form, const char* property);
virtual void ResizeToPreferred();
virtual void GetPreferredSize(float* _width, virtual void GetPreferredSize(float* _width,
float* _height); float* _height);
virtual void MakeFocus(bool state = true); virtual void ResizeToPreferred();
virtual void AllAttached(); virtual void MakeFocus(bool focus = true);
virtual void AllDetached();
virtual status_t GetSupportedSuites(BMessage* data);
virtual BSize MinSize(); virtual BSize MinSize();
virtual BSize MaxSize(); virtual BSize MaxSize();
virtual BSize PreferredSize(); virtual BSize PreferredSize();
virtual status_t Perform(perform_code d, void* arg); virtual status_t GetSupportedSuites(BMessage* message);
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 what, const char* property);
#if DISABLES_ON_WINDOW_DEACTIVATION virtual status_t Perform(perform_code d, void* arg);
virtual void WindowActivated(bool active);
#endif
private: private:
class Private; class Private;
+33 -26
View File
@@ -1,6 +1,11 @@
/* /*
* Copyright 2004-2009, Haiku, Inc. All rights reserved. * Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT license. * Copyright 2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler, axeld@pinc-software.de
* John Scipione, jscpione@gmail.com
*/ */
#ifndef _SCROLL_VIEW_H #ifndef _SCROLL_VIEW_H
#define _SCROLL_VIEW_H #define _SCROLL_VIEW_H
@@ -28,43 +33,45 @@ public:
virtual ~BScrollView(); virtual ~BScrollView();
static BArchivable* Instantiate(BMessage* archive); static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive, virtual status_t Archive(BMessage* archive, bool deep = true) const;
bool deep = true) const;
virtual void AttachedToWindow(); // Hook methods
virtual void DetachedFromWindow();
virtual void AllAttached(); virtual void AllAttached();
virtual void AllDetached(); virtual void AllDetached();
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect updateRect); virtual void Draw(BRect updateRect);
virtual void FrameMoved(BPoint newPosition);
virtual void WindowActivated(bool active); virtual void FrameResized(float newWidth, float newHeight);
virtual void MakeFocus(bool state = true);
virtual void GetPreferredSize(float* _width,
float* _height);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void ResizeToPreferred();
virtual void FrameMoved(BPoint position);
virtual void FrameResized(float width, float height);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint point); virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint point); virtual void MouseMoved(BPoint where, uint32 code,
virtual void MouseMoved(BPoint point, uint32 code,
const BMessage* dragMessage); const BMessage* dragMessage);
virtual void MouseUp(BPoint where);
// BScrollView virtual void WindowActivated(bool active);
// Size
virtual void GetPreferredSize(float* _width, float* _height);
virtual void ResizeToPreferred();
virtual void MakeFocus(bool focus = true);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
// BScrollBar
BScrollBar* ScrollBar(orientation posture) const; BScrollBar* ScrollBar(orientation posture) const;
virtual void SetBorder(border_style border); virtual void SetBorder(border_style border);
border_style Border() const; border_style Border() const;
virtual status_t SetBorderHighlighted(bool state); virtual status_t SetBorderHighlighted(bool highlight);
bool IsBorderHighlighted() const; bool IsBorderHighlighted() const;
void SetTarget(BView* target); void SetTarget(BView* target);
@@ -73,8 +80,8 @@ public:
// Scripting // Scripting
virtual BHandler* ResolveSpecifier(BMessage* message, virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier, int32 index, BMessage* specifier,
int32 form, const char* property); int32 what, const char* property);
virtual status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* message);
virtual status_t Perform(perform_code d, void* arg); virtual status_t Perform(perform_code d, void* arg);
+6 -6
View File
@@ -75,11 +75,11 @@ public:
virtual void MouseUp(BPoint where); virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 code, virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* dragMessage); const BMessage* dragMessage);
virtual void WindowActivated(bool state); virtual void WindowActivated(bool active);
virtual void KeyDown(const char* bytes, int32 numBytes); virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void Pulse(); virtual void Pulse();
virtual void FrameResized(float width, float height); virtual void FrameResized(float newWidth, float newHeight);
virtual void MakeFocus(bool focusState = true); virtual void MakeFocus(bool focus = true);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual BHandler* ResolveSpecifier(BMessage* message, virtual BHandler* ResolveSpecifier(BMessage* message,
@@ -114,7 +114,7 @@ public:
int32 CountLines() const; int32 CountLines() const;
int32 CurrentLine() const; int32 CurrentLine() const;
void GoToLine(int32 lineIndex); void GoToLine(int32 lineNumber);
virtual void Cut(BClipboard* clipboard); virtual void Cut(BClipboard* clipboard);
virtual void Copy(BClipboard* clipboard); virtual void Copy(BClipboard* clipboard);
@@ -159,8 +159,8 @@ public:
virtual bool CanEndLine(int32 offset); virtual bool CanEndLine(int32 offset);
float LineWidth(int32 lineIndex = 0) const; float LineWidth(int32 lineNumber = 0) const;
float LineHeight(int32 lineIndex = 0) const; float LineHeight(int32 lineNumber = 0) const;
float TextHeight(int32 startLine, float TextHeight(int32 startLine,
int32 endLine) const; int32 endLine) const;
+4 -4
View File
@@ -170,7 +170,7 @@ public:
virtual void MouseUp(BPoint where); virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 code, virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* dragMessage); const BMessage* dragMessage);
virtual void WindowActivated(bool state); virtual void WindowActivated(bool active);
virtual void KeyDown(const char* bytes, int32 numBytes); virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void KeyUp(const char* bytes, int32 numBytes); virtual void KeyUp(const char* bytes, int32 numBytes);
virtual void Pulse(); virtual void Pulse();
@@ -285,7 +285,7 @@ public:
void SetFillRule(int32 rule); void SetFillRule(int32 rule);
int32 FillRule() const; int32 FillRule() const;
void SetOrigin(BPoint pt); void SetOrigin(BPoint where);
void SetOrigin(float x, float y); void SetOrigin(float x, float y);
BPoint Origin() const; BPoint Origin() const;
@@ -522,7 +522,7 @@ public:
void ScrollBy(float dh, float dv); void ScrollBy(float dh, float dv);
void ScrollTo(float x, float y); void ScrollTo(float x, float y);
virtual void ScrollTo(BPoint where); virtual void ScrollTo(BPoint where);
virtual void MakeFocus(bool focusState = true); virtual void MakeFocus(bool focus = true);
bool IsFocus() const; bool IsFocus() const;
virtual void Show(); virtual void Show();
@@ -536,7 +536,7 @@ public:
virtual void GetPreferredSize(float* _width, float* _height); virtual void GetPreferredSize(float* _width, float* _height);
virtual void ResizeToPreferred(); virtual void ResizeToPreferred();
BScrollBar* ScrollBar(orientation posture) const; BScrollBar* ScrollBar(orientation direction) const;
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form, BMessage* specifier, int32 form,
+1 -1
View File
@@ -149,7 +149,7 @@ public:
BView* CurrentFocus() const; BView* CurrentFocus() const;
void Activate(bool = true); void Activate(bool = true);
virtual void WindowActivated(bool state); virtual void WindowActivated(bool focus);
void ConvertToScreen(BPoint* point) const; void ConvertToScreen(BPoint* point) const;
BPoint ConvertToScreen(BPoint point) const; BPoint ConvertToScreen(BPoint point) const;
+14 -10
View File
@@ -1,13 +1,16 @@
/* /*
* Copyright 2001-2008, Haiku. * Copyright 2001-2015 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Erik Jaesler (erik@cgsoftware.com)
* Axel Dörfler, axeld@pinc-software.de * Axel Dörfler, axeld@pinc-software.de
* Erik Jaesler, erik@cgsoftware.com
* John Scipione, jscipione@gmail.com
*/ */
//! BAlert displays a modal alert window.
// BAlert displays a modal alert window.
#include <new> #include <new>
#include <stdio.h> #include <stdio.h>
@@ -304,13 +307,13 @@ BAlert::Go(BInvoker* invoker)
void void
BAlert::MessageReceived(BMessage* msg) BAlert::MessageReceived(BMessage* message)
{ {
if (msg->what != kAlertButtonMsg) if (message->what != kAlertButtonMsg)
return BWindow::MessageReceived(msg); return BWindow::MessageReceived(message);
int32 which; int32 which;
if (msg->FindInt32("which", &which) == B_OK) { if (message->FindInt32("which", &which) == B_OK) {
if (fAlertSem < B_OK) { if (fAlertSem < B_OK) {
// Semaphore hasn't been created; we're running asynchronous // Semaphore hasn't been created; we're running asynchronous
if (fInvoker) { if (fInvoker) {
@@ -361,10 +364,11 @@ BAlert::TextView() const
BHandler* BHandler*
BAlert::ResolveSpecifier(BMessage* msg, int32 index, BAlert::ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form, const char* property) BMessage* specifier, int32 what, const char* property)
{ {
return BWindow::ResolveSpecifier(msg, index, specifier, form, property); return BWindow::ResolveSpecifier(message, index, specifier, what,
property);
} }
+4 -4
View File
@@ -469,16 +469,16 @@ BButton::FrameMoved(BPoint newPosition)
void void
BButton::FrameResized(float width, float height) BButton::FrameResized(float newWidth, float newHeight)
{ {
BControl::FrameResized(width, height); BControl::FrameResized(newWidth, newHeight);
} }
void void
BButton::MakeFocus(bool focused) BButton::MakeFocus(bool focus)
{ {
BControl::MakeFocus(focused); BControl::MakeFocus(focus);
} }
+120 -96
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2005-2009, Haiku Inc. All Rights Reserved. * Copyright 2005-2014 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -34,9 +34,11 @@ sPropertyInfo[] = {
}; };
BChannelControl::BChannelControl(BRect frame, const char *name, const char *label, BChannelControl::BChannelControl(BRect frame, const char* name,
BMessage *model, int32 channel_count, uint32 resizeMode, uint32 flags) const char* label, BMessage* model, int32 channel_count,
: BControl(frame, name, label, model, resizeMode, flags), uint32 resizingMode, uint32 flags)
:
BControl(frame, name, label, model, resizingMode, flags),
fChannelCount(channel_count), fChannelCount(channel_count),
fCurrentChannel(0), fCurrentChannel(0),
fChannelMin(NULL), fChannelMin(NULL),
@@ -57,10 +59,11 @@ BChannelControl::BChannelControl(BRect frame, const char *name, const char *labe
} }
BChannelControl::BChannelControl(const char *name, const char *label, BChannelControl::BChannelControl(const char* name, const char* label,
BMessage *model, int32 channel_count, uint32 flags) BMessage* model, int32 channelCount, uint32 flags)
: BControl(name, label, model, flags), :
fChannelCount(channel_count), BControl(name, label, model, flags),
fChannelCount(channelCount),
fCurrentChannel(0), fCurrentChannel(0),
fChannelMin(NULL), fChannelMin(NULL),
fChannelMax(NULL), fChannelMax(NULL),
@@ -68,20 +71,21 @@ BChannelControl::BChannelControl(const char *name, const char *label,
fMultiLabels(NULL), fMultiLabels(NULL),
fModificationMsg(NULL) fModificationMsg(NULL)
{ {
fChannelMin = new int32[channel_count]; fChannelMin = new int32[channelCount];
memset(fChannelMin, 0, sizeof(int32) * channel_count); memset(fChannelMin, 0, sizeof(int32) * channelCount);
fChannelMax = new int32[channel_count]; fChannelMax = new int32[channelCount];
for (int32 i = 0; i < channel_count; i++) for (int32 i = 0; i < channelCount; i++)
fChannelMax[i] = 100; fChannelMax[i] = 100;
fChannelValues = new int32[channel_count]; fChannelValues = new int32[channelCount];
memset(fChannelValues, 0, sizeof(int32) * channel_count); memset(fChannelValues, 0, sizeof(int32) * channelCount);
} }
BChannelControl::BChannelControl(BMessage *archive) BChannelControl::BChannelControl(BMessage* archive)
: BControl(archive), :
BControl(archive),
fChannelCount(0), fChannelCount(0),
fCurrentChannel(0), fCurrentChannel(0),
fChannelMin(NULL), fChannelMin(NULL),
@@ -111,18 +115,18 @@ BChannelControl::BChannelControl(BMessage *archive)
} }
} }
const char *label = NULL; const char* label = NULL;
if (archive->FindString("be:_m_min_label", &label) == B_OK) if (archive->FindString("be:_m_min_label", &label) == B_OK)
fMinLabel = label; fMinLabel = label;
if (archive->FindString("be:_m_max_label", &label) == B_OK) if (archive->FindString("be:_m_max_label", &label) == B_OK)
fMaxLabel = label; fMaxLabel = label;
BMessage *modificationMessage = new BMessage; BMessage* modificationMessage = new BMessage;
if (archive->FindMessage("_mod_msg", modificationMessage) == B_OK) if (archive->FindMessage("_mod_msg", modificationMessage) == B_OK)
fModificationMsg = modificationMessage; fModificationMsg = modificationMessage;
else else
delete modificationMessage; delete modificationMessage;
} }
@@ -136,28 +140,33 @@ BChannelControl::~BChannelControl()
status_t status_t
BChannelControl::Archive(BMessage *message, bool deep) const BChannelControl::Archive(BMessage* data, bool deep) const
{ {
status_t status = BControl::Archive(message, deep); status_t status = BControl::Archive(data, deep);
if (status == B_OK) if (status == B_OK)
status = message->AddInt32("be:_m_channel_count", fChannelCount); status = data->AddInt32("be:_m_channel_count", fChannelCount);
if (status == B_OK) if (status == B_OK)
status = message->AddInt32("be:_m_value_channel", fCurrentChannel); status = data->AddInt32("be:_m_value_channel", fCurrentChannel);
if (status == B_OK) if (status == B_OK)
status = message->AddString("be:_m_min_label", fMinLabel.String()); status = data->AddString("be:_m_min_label", fMinLabel.String());
if (status == B_OK) if (status == B_OK)
status = message->AddString("be:_m_max_label", fMaxLabel.String()); status = data->AddString("be:_m_max_label", fMaxLabel.String());
if (status == B_OK && fChannelValues != NULL if (status == B_OK && fChannelValues != NULL
&& fChannelMax != NULL && fChannelMin != NULL) { && fChannelMax != NULL && fChannelMin != NULL) {
for (int32 i = 0; i < fChannelCount; i++) { for (int32 i = 0; i < fChannelCount; i++) {
status = message->AddInt32("be:_m_channel_min", fChannelMin[i]); status = data->AddInt32("be:_m_channel_min", fChannelMin[i]);
if (status < B_OK) if (status < B_OK)
break; break;
status = message->AddInt32("be:_m_channel_max", fChannelMax[i]);
status = data->AddInt32("be:_m_channel_max", fChannelMax[i]);
if (status < B_OK) if (status < B_OK)
break; break;
status = message->AddInt32("be:_m_channel_val", fChannelValues[i]);
status = data->AddInt32("be:_m_channel_val", fChannelValues[i]);
if (status < B_OK) if (status < B_OK)
break; break;
} }
@@ -168,14 +177,14 @@ BChannelControl::Archive(BMessage *message, bool deep) const
void void
BChannelControl::FrameResized(float width, float height) BChannelControl::FrameResized(float newWidth, float newHeight)
{ {
BView::FrameResized(width, height); BView::FrameResized(newWidth, newHeight);
} }
void void
BChannelControl::SetFont(const BFont *font, uint32 mask) BChannelControl::SetFont(const BFont* font, uint32 mask)
{ {
BView::SetFont(font, mask); BView::SetFont(font, mask);
} }
@@ -203,27 +212,30 @@ BChannelControl::ResizeToPreferred()
void void
BChannelControl::MessageReceived(BMessage *message) BChannelControl::MessageReceived(BMessage* message)
{ {
BControl::MessageReceived(message); BControl::MessageReceived(message);
} }
BHandler * BHandler*
BChannelControl::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier, BChannelControl::ResolveSpecifier(BMessage* message, int32 index,
int32 form, const char *property) BMessage* specifier, int32 what, const char* property)
{ {
BHandler *target = this; BHandler* target = this;
BPropertyInfo propertyInfo(sPropertyInfo); BPropertyInfo propertyInfo(sPropertyInfo);
if (propertyInfo.FindMatch(msg, index, specifier, form, property) < B_OK) if (propertyInfo.FindMatch(message, index, specifier, what, property)
target = BControl::ResolveSpecifier(msg, index, specifier, form, property); < B_OK) {
target = BControl::ResolveSpecifier(message, index, specifier,
what, property);
}
return target; return target;
} }
status_t status_t
BChannelControl::GetSupportedSuites(BMessage *data) BChannelControl::GetSupportedSuites(BMessage* data)
{ {
if (data == NULL) if (data == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -236,19 +248,20 @@ BChannelControl::GetSupportedSuites(BMessage *data)
if (err == B_OK) if (err == B_OK)
return BControl::GetSupportedSuites(data); return BControl::GetSupportedSuites(data);
return err; return err;
} }
void void
BChannelControl::SetModificationMessage(BMessage *message) BChannelControl::SetModificationMessage(BMessage* message)
{ {
delete fModificationMsg; delete fModificationMsg;
fModificationMsg = message; fModificationMsg = message;
} }
BMessage * BMessage*
BChannelControl::ModificationMessage() const BChannelControl::ModificationMessage() const
{ {
return fModificationMsg; return fModificationMsg;
@@ -256,13 +269,13 @@ BChannelControl::ModificationMessage() const
status_t status_t
BChannelControl::Invoke(BMessage *msg) BChannelControl::Invoke(BMessage* message)
{ {
bool notify = false; bool notify = false;
BMessage invokeMessage(InvokeKind(&notify)); BMessage invokeMessage(InvokeKind(&notify));
if (msg != NULL) if (message != NULL)
invokeMessage = *msg; invokeMessage = *message;
else if (Message() != NULL) else if (Message() != NULL)
invokeMessage = *Message(); invokeMessage = *Message();
@@ -273,25 +286,25 @@ BChannelControl::Invoke(BMessage *msg)
status_t status_t
BChannelControl::InvokeChannel(BMessage *msg, int32 fromChannel, BChannelControl::InvokeChannel(BMessage* message, int32 fromChannel,
int32 channelCount, const bool *inMask) int32 channelCount, const bool* _mask)
{ {
bool notify = false; bool notify = false;
BMessage invokeMessage(InvokeKind(&notify)); BMessage invokeMessage(InvokeKind(&notify));
if (msg != NULL) if (message != NULL)
invokeMessage = *msg; invokeMessage = *message;
else if (Message() != NULL) else if (Message() != NULL)
invokeMessage = *Message(); invokeMessage = *Message();
invokeMessage.AddInt32("be:current_channel", fCurrentChannel); invokeMessage.AddInt32("be:current_channel", fCurrentChannel);
if (channelCount < 0) if (channelCount < 0)
channelCount = fChannelCount - fromChannel; channelCount = fChannelCount - fromChannel;
for (int32 i = 0; i < channelCount; i++) { for (int32 i = 0; i < channelCount; i++) {
invokeMessage.AddInt32("be:channel_value", fChannelValues[fromChannel + i]); invokeMessage.AddInt32("be:channel_value",
invokeMessage.AddBool("be:channel_changed", inMask ? inMask[i] : true); fChannelValues[fromChannel + i]);
invokeMessage.AddBool("be:channel_changed", _mask ? _mask[i] : true);
} }
return BControl::Invoke(&invokeMessage); return BControl::Invoke(&invokeMessage);
@@ -299,11 +312,11 @@ BChannelControl::InvokeChannel(BMessage *msg, int32 fromChannel,
status_t status_t
BChannelControl::InvokeNotifyChannel(BMessage *msg, uint32 kind, BChannelControl::InvokeNotifyChannel(BMessage* message, uint32 kind,
int32 fromChannel, int32 channelCount, const bool *inMask) int32 fromChannel, int32 channelCount, const bool* _mask)
{ {
BeginInvokeNotify(kind); BeginInvokeNotify(kind);
status_t status = InvokeChannel(msg, fromChannel, channelCount, inMask); status_t status = InvokeChannel(message, fromChannel, channelCount, _mask);
EndInvokeNotify(); EndInvokeNotify();
return status; return status;
@@ -364,9 +377,9 @@ BChannelControl::SetChannelCount(int32 channel_count)
// TODO: Currently we only grow the buffer. Test what BeOS does // TODO: Currently we only grow the buffer. Test what BeOS does
if (channel_count > fChannelCount) { if (channel_count > fChannelCount) {
int32 *newMin = new int32[channel_count]; int32* newMin = new int32[channel_count];
int32 *newMax = new int32[channel_count]; int32* newMax = new int32[channel_count];
int32 *newVal = new int32[channel_count]; int32* newVal = new int32[channel_count];
memcpy(newMin, fChannelMin, fChannelCount); memcpy(newMin, fChannelMin, fChannelCount);
memcpy(newMax, fChannelMax, fChannelCount); memcpy(newMax, fChannelMax, fChannelCount);
@@ -399,7 +412,7 @@ BChannelControl::ValueFor(int32 channel) const
int32 int32
BChannelControl::GetValue(int32 *outValues, int32 fromChannel, BChannelControl::GetValue(int32* outValues, int32 fromChannel,
int32 channelCount) const int32 channelCount) const
{ {
int32 i = 0; int32 i = 0;
@@ -419,16 +432,16 @@ BChannelControl::SetValueFor(int32 channel, int32 value)
status_t status_t
BChannelControl::SetValue(int32 fromChannel, int32 channelCount, BChannelControl::SetValue(int32 fromChannel, int32 channelCount,
const int32 *inValues) const int32* values)
{ {
return StuffValues(fromChannel, channelCount, inValues); return StuffValues(fromChannel, channelCount, values);
} }
status_t status_t
BChannelControl::SetAllValue(int32 values) BChannelControl::SetAllValue(int32 values)
{ {
int32 *newValues = new int32[fChannelCount]; int32* newValues = new int32[fChannelCount];
for (int32 i = 0; i < fChannelCount; i++) { for (int32 i = 0; i < fChannelCount; i++) {
int32 limitedValue = max_c(values, MinLimitList()[i]); int32 limitedValue = max_c(values, MinLimitList()[i]);
limitedValue = min_c(limitedValue, MaxLimitList()[i]); limitedValue = min_c(limitedValue, MaxLimitList()[i]);
@@ -452,7 +465,8 @@ BChannelControl::SetLimitsFor(int32 channel, int32 minimum, int32 maximum)
status_t status_t
BChannelControl::GetLimitsFor(int32 channel, int32 *minimum, int32 *maximum) const BChannelControl::GetLimitsFor(int32 channel, int32* minimum,
int32* maximum) const
{ {
return GetLimitsFor(channel, 1, minimum, maximum); return GetLimitsFor(channel, 1, minimum, maximum);
} }
@@ -460,13 +474,15 @@ BChannelControl::GetLimitsFor(int32 channel, int32 *minimum, int32 *maximum) con
status_t status_t
BChannelControl::SetLimitsFor(int32 fromChannel, int32 channelCount, BChannelControl::SetLimitsFor(int32 fromChannel, int32 channelCount,
const int32 *minimum, const int32 *maximum) const int32* minimum, const int32* maximum)
{ {
if (fromChannel + channelCount > CountChannels()) if (fromChannel + channelCount > CountChannels())
channelCount = CountChannels() - fromChannel; channelCount = CountChannels() - fromChannel;
for (int i=0; i<channelCount; i++) {
for (int i = 0; i < channelCount; i++) {
if (minimum[i] > maximum[i]) if (minimum[i] > maximum[i])
return B_BAD_VALUE; return B_BAD_VALUE;
fChannelMin[fromChannel + i] = minimum[i]; fChannelMin[fromChannel + i] = minimum[i];
fChannelMax[fromChannel + i] = maximum[i]; fChannelMax[fromChannel + i] = maximum[i];
if (fChannelValues[fromChannel + i] < minimum[i]) if (fChannelValues[fromChannel + i] < minimum[i])
@@ -474,13 +490,14 @@ BChannelControl::SetLimitsFor(int32 fromChannel, int32 channelCount,
else if (fChannelValues[fromChannel + i] > maximum[i]) else if (fChannelValues[fromChannel + i] > maximum[i])
fChannelValues[fromChannel + i] = maximum[i]; fChannelValues[fromChannel + i] = maximum[i];
} }
return B_OK; return B_OK;
} }
status_t status_t
BChannelControl::GetLimitsFor(int32 fromChannel, int32 channelCount, BChannelControl::GetLimitsFor(int32 fromChannel, int32 channelCount,
int32 *minimum, int32 *maximum) const int32* minimum, int32* maximum) const
{ {
if (minimum == NULL || maximum == NULL) if (minimum == NULL || maximum == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -489,7 +506,8 @@ BChannelControl::GetLimitsFor(int32 fromChannel, int32 channelCount,
return B_ERROR; return B_ERROR;
if (fromChannel + channelCount > CountChannels()) if (fromChannel + channelCount > CountChannels())
channelCount = CountChannels() - fromChannel; channelCount = CountChannels() - fromChannel;
for (int i=0; i<channelCount; i++) {
for (int i = 0; i < channelCount; i++) {
minimum[i] = fChannelMin[fromChannel + i]; minimum[i] = fChannelMin[fromChannel + i];
maximum[i] = fChannelMax[fromChannel + i]; maximum[i] = fChannelMax[fromChannel + i];
} }
@@ -520,7 +538,7 @@ BChannelControl::SetLimits(int32 minimum, int32 maximum)
status_t status_t
BChannelControl::GetLimits(int32 *outMinimum, int32 *outMaximum) const BChannelControl::GetLimits(int32* outMinimum, int32* outMaximum) const
{ {
if (outMinimum == NULL || outMaximum == NULL) if (outMinimum == NULL || outMaximum == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -539,7 +557,7 @@ BChannelControl::GetLimits(int32 *outMinimum, int32 *outMaximum) const
status_t status_t
BChannelControl::SetLimitLabels(const char *minLabel, const char *maxLabel) BChannelControl::SetLimitLabels(const char* minLabel, const char* maxLabel)
{ {
if (minLabel != fMinLabel) if (minLabel != fMinLabel)
fMinLabel = minLabel; fMinLabel = minLabel;
@@ -553,14 +571,14 @@ BChannelControl::SetLimitLabels(const char *minLabel, const char *maxLabel)
} }
const char * const char*
BChannelControl::MinLimitLabel() const BChannelControl::MinLimitLabel() const
{ {
return fMinLabel.String(); return fMinLabel.String();
} }
const char * const char*
BChannelControl::MaxLimitLabel() const BChannelControl::MaxLimitLabel() const
{ {
return fMaxLabel.String(); return fMaxLabel.String();
@@ -568,27 +586,29 @@ BChannelControl::MaxLimitLabel() const
status_t status_t
BChannelControl::SetLimitLabelsFor(int32 channel, const char *minLabel, const char *maxLabel) BChannelControl::SetLimitLabelsFor(int32 channel, const char* minLabel,
const char* maxLabel)
{ {
return B_ERROR; return B_ERROR;
} }
status_t status_t
BChannelControl::SetLimitLabelsFor(int32 from_channel, int32 channel_count, const char *minLabel, const char *maxLabel) BChannelControl::SetLimitLabelsFor(int32 fromChannel, int32 channelCount,
const char* minLabel, const char* maxLabel)
{ {
return B_ERROR; return B_ERROR;
} }
const char * const char*
BChannelControl::MinLimitLabelFor(int32 channel) const BChannelControl::MinLimitLabelFor(int32 channel) const
{ {
return NULL; return NULL;
} }
const char * const char*
BChannelControl::MaxLimitLabelFor(int32 channel) const BChannelControl::MaxLimitLabelFor(int32 channel) const
{ {
return NULL; return NULL;
@@ -597,38 +617,42 @@ BChannelControl::MaxLimitLabelFor(int32 channel) const
status_t status_t
BChannelControl::StuffValues(int32 fromChannel, int32 channelCount, BChannelControl::StuffValues(int32 fromChannel, int32 channelCount,
const int32 *inValues) const int32* values)
{ {
if (inValues == NULL) if (values == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
if (fromChannel < 0 || fromChannel > fChannelCount if (fromChannel < 0 || fromChannel > fChannelCount
|| fromChannel + channelCount > fChannelCount) || fromChannel + channelCount > fChannelCount) {
return B_BAD_INDEX; return B_BAD_INDEX;
for (int32 i = 0; i < channelCount; i++) {
if (inValues[i] <= fChannelMax[fromChannel + i]
&& inValues[i] >= fChannelMin[fromChannel + i])
fChannelValues[fromChannel + i] = inValues[i];
} }
// If the current channel was updated, update also the control value for (int32 i = 0; i < channelCount; i++) {
if (fCurrentChannel >= fromChannel && fCurrentChannel <= fromChannel + channelCount) if (values[i] <= fChannelMax[fromChannel + i]
&& values[i] >= fChannelMin[fromChannel + i]) {
fChannelValues[fromChannel + i] = values[i];
}
}
// if the current channel was updated, update also the control value
if (fCurrentChannel >= fromChannel
&& fCurrentChannel <= fromChannel + channelCount) {
BControl::SetValue(fChannelValues[fCurrentChannel]); BControl::SetValue(fChannelValues[fCurrentChannel]);
}
return B_OK; return B_OK;
} }
void BChannelControl::_Reserverd_ChannelControl_0(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_0(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_1(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_1(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_2(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_2(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_3(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_3(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_4(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_4(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_5(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_5(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_6(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_6(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_7(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_7(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_8(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_8(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_9(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_9(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_10(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_10(void*, ...) {}
void BChannelControl::_Reserverd_ChannelControl_11(void *, ...) {} void BChannelControl::_Reserverd_ChannelControl_11(void*, ...) {}
+2 -2
View File
@@ -161,9 +161,9 @@ BCheckBox::FrameMoved(BPoint newPosition)
void void
BCheckBox::FrameResized(float width, float height) BCheckBox::FrameResized(float newWidth, float newHeight)
{ {
BControl::FrameResized(width, height); BControl::FrameResized(newWidth, newHeight);
} }
+23 -21
View File
@@ -56,19 +56,19 @@ BColorControl::BColorControl(BPoint leftTop, color_control_layout layout,
} }
BColorControl::BColorControl(BMessage* archive) BColorControl::BColorControl(BMessage* data)
: :
BControl(archive) BControl(data)
{ {
int32 layout; int32 layout;
float cellSize; float cellSize;
bool useOffscreen; bool useOffscreen;
archive->FindInt32("_layout", &layout); data->FindInt32("_layout", &layout);
archive->FindFloat("_csize", &cellSize); data->FindFloat("_csize", &cellSize);
archive->FindBool("_use_off", &useOffscreen); data->FindBool("_use_off", &useOffscreen);
_InitData((color_control_layout)layout, cellSize, useOffscreen, archive); _InitData((color_control_layout)layout, cellSize, useOffscreen, data);
} }
@@ -80,7 +80,7 @@ BColorControl::~BColorControl()
void void
BColorControl::_InitData(color_control_layout layout, float size, BColorControl::_InitData(color_control_layout layout, float size,
bool useOffscreen, BMessage* archive) bool useOffscreen, BMessage* data)
{ {
fPaletteMode = BScreen(B_MAIN_SCREEN_ID).ColorSpace() == B_CMAP8; fPaletteMode = BScreen(B_MAIN_SCREEN_ID).ColorSpace() == B_CMAP8;
//TODO: we don't support workspace and colorspace changing for now //TODO: we don't support workspace and colorspace changing for now
@@ -102,13 +102,13 @@ BColorControl::_InitData(color_control_layout layout, float size,
green = gSystemCatalog.GetString(green, "ColorControl"); green = gSystemCatalog.GetString(green, "ColorControl");
blue = gSystemCatalog.GetString(blue, "ColorControl"); blue = gSystemCatalog.GetString(blue, "ColorControl");
if (archive != NULL) { if (data != NULL) {
fRedText = (BTextControl*)FindView("_red"); fRedText = (BTextControl*)FindView("_red");
fGreenText = (BTextControl*)FindView("_green"); fGreenText = (BTextControl*)FindView("_green");
fBlueText = (BTextControl*)FindView("_blue"); fBlueText = (BTextControl*)FindView("_blue");
int32 value = 0; int32 value = 0;
archive->FindInt32("_val", &value); data->FindInt32("_val", &value);
SetValue(value); SetValue(value);
} else { } else {
@@ -219,26 +219,28 @@ BColorControl::_LayoutView()
BArchivable* BArchivable*
BColorControl::Instantiate(BMessage* archive) BColorControl::Instantiate(BMessage* data)
{ {
if (validate_instantiation(archive, "BColorControl")) if (validate_instantiation(data, "BColorControl"))
return new BColorControl(archive); return new BColorControl(data);
return NULL; return NULL;
} }
status_t status_t
BColorControl::Archive(BMessage* archive, bool deep) const BColorControl::Archive(BMessage* data, bool deep) const
{ {
status_t status = BControl::Archive(archive, deep); status_t status = BControl::Archive(data, deep);
if (status == B_OK) if (status == B_OK)
status = archive->AddInt32("_layout", Layout()); status = data->AddInt32("_layout", Layout());
if (status == B_OK) if (status == B_OK)
status = archive->AddFloat("_csize", fCellSize); status = data->AddFloat("_csize", fCellSize);
if (status == B_OK) if (status == B_OK)
status = archive->AddBool("_use_off", fOffscreenView != NULL); status = data->AddBool("_use_off", fOffscreenView != NULL);
return status; return status;
} }
@@ -985,16 +987,16 @@ BColorControl::Invoke(BMessage* message)
void void
BColorControl::FrameMoved(BPoint new_position) BColorControl::FrameMoved(BPoint newPosition)
{ {
BControl::FrameMoved(new_position); BControl::FrameMoved(newPosition);
} }
void void
BColorControl::FrameResized(float new_width, float new_height) BColorControl::FrameResized(float newWidth, float newHeight)
{ {
BControl::FrameResized(new_width, new_height); BControl::FrameResized(newWidth, newHeight);
} }
+4 -4
View File
@@ -258,14 +258,14 @@ BControl::MessageReceived(BMessage* message)
void void
BControl::MakeFocus(bool focused) BControl::MakeFocus(bool focus)
{ {
if (focused == IsFocus()) if (focus == IsFocus())
return; return;
BView::MakeFocus(focused); BView::MakeFocus(focus);
if (Window()) { if (Window() != NULL) {
fFocusChanging = true; fFocusChanging = true;
Invalidate(Bounds()); Invalidate(Bounds());
Flush(); Flush();
+16 -16
View File
@@ -160,22 +160,22 @@ BListView::Instantiate(BMessage* archive)
status_t status_t
BListView::Archive(BMessage* archive, bool deep) const BListView::Archive(BMessage* data, bool deep) const
{ {
status_t status = BView::Archive(archive, deep); status_t status = BView::Archive(data, deep);
if (status < B_OK) if (status < B_OK)
return status; return status;
status = archive->AddInt32("_lv_type", fListType); status = data->AddInt32("_lv_type", fListType);
if (status == B_OK && deep) { if (status == B_OK && deep) {
BListItem* item; BListItem* item;
int32 i = 0; int32 i = 0;
while ((item = ItemAt(i++))) { while ((item = ItemAt(i++)) != NULL) {
BMessage subData; BMessage subData;
status = item->Archive(&subData, true); status = item->Archive(&subData, true);
if (status >= B_OK) if (status >= B_OK)
status = archive->AddMessage("_l_items", &subData); status = data->AddMessage("_l_items", &subData);
if (status < B_OK) if (status < B_OK)
break; break;
@@ -183,10 +183,10 @@ BListView::Archive(BMessage* archive, bool deep) const
} }
if (status >= B_OK && InvocationMessage() != NULL) if (status >= B_OK && InvocationMessage() != NULL)
status = archive->AddMessage("_msg", InvocationMessage()); status = data->AddMessage("_msg", InvocationMessage());
if (status == B_OK && fSelectMessage != NULL) if (status == B_OK && fSelectMessage != NULL)
status = archive->AddMessage("_2nd_msg", fSelectMessage); status = data->AddMessage("_2nd_msg", fSelectMessage);
return status; return status;
} }
@@ -250,21 +250,21 @@ BListView::AllDetached()
void void
BListView::FrameResized(float width, float height) BListView::FrameResized(float newWidth, float newHeight)
{ {
_FixupScrollBar(); _FixupScrollBar();
} }
void void
BListView::FrameMoved(BPoint new_position) BListView::FrameMoved(BPoint newPosition)
{ {
BView::FrameMoved(new_position); BView::FrameMoved(newPosition);
} }
void void
BListView::TargetedByScrollView(BScrollView *view) BListView::TargetedByScrollView(BScrollView* view)
{ {
fScrollView = view; fScrollView = view;
// TODO: We could SetFlags(Flags() | B_FRAME_EVENTS) here, but that // TODO: We could SetFlags(Flags() | B_FRAME_EVENTS) here, but that
@@ -274,9 +274,9 @@ BListView::TargetedByScrollView(BScrollView *view)
void void
BListView::WindowActivated(bool state) BListView::WindowActivated(bool active)
{ {
BView::WindowActivated(state); BView::WindowActivated(active);
} }
@@ -1306,12 +1306,12 @@ BListView::ItemFrame(int32 index)
BHandler* BHandler*
BListView::ResolveSpecifier(BMessage* message, int32 index, BListView::ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form, const char* property) BMessage* specifier, int32 what, const char* property)
{ {
BPropertyInfo propInfo(sProperties); BPropertyInfo propInfo(sProperties);
if (propInfo.FindMatch(message, 0, specifier, form, property) < 0) { if (propInfo.FindMatch(message, 0, specifier, what, property) < 0) {
return BView::ResolveSpecifier(message, index, specifier, form, return BView::ResolveSpecifier(message, index, specifier, what,
property); property);
} }
+4 -4
View File
@@ -531,9 +531,9 @@ BMenuField::MessageReceived(BMessage* message)
void void
BMenuField::WindowActivated(bool state) BMenuField::WindowActivated(bool active)
{ {
BView::WindowActivated(state); BView::WindowActivated(active);
if (IsFocus()) if (IsFocus())
Invalidate(); Invalidate();
@@ -548,9 +548,9 @@ BMenuField::MouseMoved(BPoint point, uint32 code, const BMessage* message)
void void
BMenuField::MouseUp(BPoint point) BMenuField::MouseUp(BPoint where)
{ {
BView::MouseUp(point); BView::MouseUp(where);
} }
+3 -2
View File
@@ -505,10 +505,11 @@ BOutlineListView::IsExpanded(int32 fullListIndex)
BHandler* BHandler*
BOutlineListView::ResolveSpecifier(BMessage* msg, int32 index, BOutlineListView::ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 what, const char* property) BMessage* specifier, int32 what, const char* property)
{ {
return BListView::ResolveSpecifier(msg, index, specifier, what, property); return BListView::ResolveSpecifier(message, index, specifier, what,
property);
} }
+12 -11
View File
@@ -175,16 +175,16 @@ BPictureButton::FrameResized(float newWidth, float newHeight)
void void
BPictureButton::WindowActivated(bool state) BPictureButton::WindowActivated(bool active)
{ {
BControl::WindowActivated(state); BControl::WindowActivated(active);
} }
void void
BPictureButton::MakeFocus(bool state) BPictureButton::MakeFocus(bool focus)
{ {
BControl::MakeFocus(state); BControl::MakeFocus(focus);
} }
@@ -291,16 +291,16 @@ BPictureButton::MouseUp(BPoint where)
void void
BPictureButton::MouseMoved(BPoint where, uint32 transit, BPictureButton::MouseMoved(BPoint where, uint32 code,
const BMessage* message) const BMessage* dragMessage)
{ {
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 (transit == B_ENTERED_VIEW) else if (code == B_ENTERED_VIEW)
SetValue(B_CONTROL_ON); SetValue(B_CONTROL_ON);
} else } else
BControl::MouseMoved(where, transit, message); BControl::MouseMoved(where, code, dragMessage);
} }
@@ -397,9 +397,10 @@ BPictureButton::Invoke(BMessage* message)
BHandler* BHandler*
BPictureButton::ResolveSpecifier(BMessage* message, int32 index, BPictureButton::ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form, const char* property) BMessage* specifier, int32 what, const char* property)
{ {
return BControl::ResolveSpecifier(message, index, specifier, form, property); return BControl::ResolveSpecifier(message, index, specifier,
what, property);
} }
+4 -4
View File
@@ -351,10 +351,10 @@ BRadioButton::FrameMoved(BPoint newPosition)
void void
BRadioButton::FrameResized(float width, float height) BRadioButton::FrameResized(float newWidth, float newHeight)
{ {
Invalidate(); Invalidate();
BControl::FrameResized(width, height); BControl::FrameResized(newWidth, newHeight);
} }
@@ -368,9 +368,9 @@ BRadioButton::ResolveSpecifier(BMessage* message, int32 index,
void void
BRadioButton::MakeFocus(bool focused) BRadioButton::MakeFocus(bool focus)
{ {
BControl::MakeFocus(focused); BControl::MakeFocus(focus);
} }
+20 -9
View File
@@ -117,24 +117,24 @@ BRegion::operator==(const BRegion& other) const
// Set the region to contain just the given BRect. // Set the region to contain just the given BRect.
void void
BRegion::Set(BRect newBounds) BRegion::Set(BRect rect)
{ {
Set(_Convert(newBounds)); Set(_Convert(rect));
} }
//Set the region to contain just the given clipping_rect. //Set the region to contain just the given clipping_rect.
void void
BRegion::Set(clipping_rect newBounds) BRegion::Set(clipping_rect clipping)
{ {
_SetSize(1); _SetSize(1);
if (valid_rect(newBounds) && fData) { if (valid_rect(clipping) && fData != NULL) {
fCount = 1; fCount = 1;
// cheap convert to internal rect format // cheap convert to internal rect format
newBounds.right++; clipping.right++;
newBounds.bottom++; clipping.bottom++;
fData[0] = fBounds = newBounds; fData[0] = fBounds = clipping;
} else } else
MakeEmpty(); MakeEmpty();
} }
@@ -425,7 +425,12 @@ BRegion::ExclusiveInclude(const BRegion* region)
// #pragma mark - BRegion private methods // #pragma mark - BRegion private methods
// Takes over the data of a region and marks that region empty. /*!
\fn void BRegion::_AdoptRegionData(BRegion& region)
\brief Takes over the data of \a region and empties it.
\param region The \a region to adopt data from.
*/
void void
BRegion::_AdoptRegionData(BRegion& region) BRegion::_AdoptRegionData(BRegion& region)
{ {
@@ -447,7 +452,13 @@ BRegion::_AdoptRegionData(BRegion& region)
} }
// Reallocate the memory in the region. /*!
\fn bool BRegion::_SetSize(int32 newSize)
\brief Reallocate the memory in the region.
\param newSize The amount of rectangles that the region should be
able to hold.
*/
bool bool
BRegion::_SetSize(int32 newSize) BRegion::_SetSize(int32 newSize)
{ {
File diff suppressed because it is too large Load Diff
+172 -184
View File
@@ -1,6 +1,13 @@
/* /*
* Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de. * Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2009 Stephan Aßmus, superstippi@gmx.de.
* Copyright 2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*
* Authors:
* Stephan Aßmus, superstippi@gmx.de
* Axel Dörfler, axeld@pinc-software.de
* John Scipione, jscpione@gmail.com
*/ */
@@ -14,13 +21,15 @@
#include <binary_compatibility/Interface.h> #include <binary_compatibility/Interface.h>
static const float kFancyBorderSize = 2; static const float kFancyBorderSize = 2;
static const float kPlainBorderSize = 1; static const float kPlainBorderSize = 1;
BScrollView::BScrollView(const char *name, BView *target, uint32 resizingMode, BScrollView::BScrollView(const char* name, BView* target, uint32 resizingMode,
uint32 flags, bool horizontal, bool vertical, border_style border) uint32 flags, bool horizontal, bool vertical, border_style border)
: BView(_ComputeFrame(target, horizontal, vertical, border), name, :
BView(_ComputeFrame(target, horizontal, vertical, border), name,
resizingMode, _ModifyFlags(flags, border)), resizingMode, _ModifyFlags(flags, border)),
fTarget(target), fTarget(target),
fBorder(border) fBorder(border)
@@ -31,7 +40,8 @@ BScrollView::BScrollView(const char *name, BView *target, uint32 resizingMode,
BScrollView::BScrollView(const char* name, BView* target, uint32 flags, BScrollView::BScrollView(const char* name, BView* target, uint32 flags,
bool horizontal, bool vertical, border_style border) bool horizontal, bool vertical, border_style border)
: BView(name, _ModifyFlags(flags, border)), :
BView(name, _ModifyFlags(flags, border)),
fTarget(target), fTarget(target),
fBorder(border) fBorder(border)
{ {
@@ -39,15 +49,16 @@ BScrollView::BScrollView(const char* name, BView* target, uint32 flags,
} }
BScrollView::BScrollView(BMessage *archive) BScrollView::BScrollView(BMessage* archive)
: BView(archive), :
BView(archive),
fHighlighted(false) fHighlighted(false)
{ {
int32 border; int32 border;
fBorder = archive->FindInt32("_style", &border) == B_OK ? fBorder = archive->FindInt32("_style", &border) == B_OK ?
(border_style)border : B_FANCY_BORDER; (border_style)border : B_FANCY_BORDER;
// In a shallow archive, we may not have a target anymore. We must // in a shallow archive, we may not have a target anymore. We must
// be prepared for this case // be prepared for this case
// don't confuse our scroll bars with our (eventual) target // don't confuse our scroll bars with our (eventual) target
@@ -63,7 +74,7 @@ BScrollView::BScrollView(BMessage *archive)
fHorizontalScrollBar = NULL; fHorizontalScrollBar = NULL;
fVerticalScrollBar = NULL; fVerticalScrollBar = NULL;
BView *view; BView* view;
while ((view = ChildAt(firstBar++)) != NULL) { while ((view = ChildAt(firstBar++)) != NULL) {
BScrollBar *bar = dynamic_cast<BScrollBar *>(view); BScrollBar *bar = dynamic_cast<BScrollBar *>(view);
if (bar == NULL) if (bar == NULL)
@@ -85,7 +96,7 @@ BScrollView::~BScrollView()
} }
// #pragma mark - // #pragma mark - Archiving
BArchivable* BArchivable*
@@ -121,6 +132,9 @@ BScrollView::Archive(BMessage* archive, bool deep) const
} }
// #pragma mark - Hook methods
void void
BScrollView::AttachedToWindow() BScrollView::AttachedToWindow()
{ {
@@ -128,8 +142,9 @@ BScrollView::AttachedToWindow()
if ((fHorizontalScrollBar == NULL && fVerticalScrollBar == NULL) if ((fHorizontalScrollBar == NULL && fVerticalScrollBar == NULL)
|| (fHorizontalScrollBar != NULL && fVerticalScrollBar != NULL) || (fHorizontalScrollBar != NULL && fVerticalScrollBar != NULL)
|| Window()->Look() != B_DOCUMENT_WINDOW_LOOK) || Window()->Look() != B_DOCUMENT_WINDOW_LOOK) {
return; return;
}
// If we have only one bar, we need to check if we are in the // If we have only one bar, we need to check if we are in the
// bottom right edge of a window with the B_DOCUMENT_LOOK to // bottom right edge of a window with the B_DOCUMENT_LOOK to
@@ -139,8 +154,9 @@ BScrollView::AttachedToWindow()
BRect windowBounds = Window()->Frame(); BRect windowBounds = Window()->Frame();
if (bounds.right - _BorderSize() != windowBounds.right if (bounds.right - _BorderSize() != windowBounds.right
|| bounds.bottom - _BorderSize() != windowBounds.bottom) || bounds.bottom - _BorderSize() != windowBounds.bottom) {
return; return;
}
if (fHorizontalScrollBar) if (fHorizontalScrollBar)
fHorizontalScrollBar->ResizeBy(-B_V_SCROLL_BAR_WIDTH, 0); fHorizontalScrollBar->ResizeBy(-B_V_SCROLL_BAR_WIDTH, 0);
@@ -173,16 +189,17 @@ BScrollView::AllDetached()
void void
BScrollView::Draw(BRect updateRect) BScrollView::Draw(BRect updateRect)
{ {
if (be_control_look != NULL) {
uint32 flags = 0; uint32 flags = 0;
if (fHighlighted && Window()->IsActive()) if (fHighlighted && Window()->IsActive())
flags |= BControlLook::B_FOCUSED; flags |= BControlLook::B_FOCUSED;
BRect rect(Bounds()); BRect rect(Bounds());
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
BRect verticalScrollBarFrame(0, 0, -1, -1); BRect verticalScrollBarFrame(0, 0, -1, -1);
if (fVerticalScrollBar) if (fVerticalScrollBar)
verticalScrollBarFrame = fVerticalScrollBar->Frame(); verticalScrollBarFrame = fVerticalScrollBar->Frame();
BRect horizontalScrollBarFrame(0, 0, -1, -1); BRect horizontalScrollBarFrame(0, 0, -1, -1);
if (fHorizontalScrollBar) if (fHorizontalScrollBar)
horizontalScrollBarFrame = fHorizontalScrollBar->Frame(); horizontalScrollBarFrame = fHorizontalScrollBar->Frame();
@@ -190,43 +207,100 @@ BScrollView::Draw(BRect updateRect)
be_control_look->DrawScrollViewFrame(this, rect, updateRect, be_control_look->DrawScrollViewFrame(this, rect, updateRect,
verticalScrollBarFrame, horizontalScrollBarFrame, base, fBorder, verticalScrollBarFrame, horizontalScrollBarFrame, base, fBorder,
flags); flags);
return;
}
if (fBorder == B_PLAIN_BORDER) {
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
StrokeRect(Bounds());
return;
} else if (fBorder != B_FANCY_BORDER)
return;
BRect bounds = Bounds();
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
StrokeRect(bounds.InsetByCopy(1, 1));
if (fHighlighted && Window()->IsActive()) {
SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR));
StrokeRect(bounds);
} else {
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_1_TINT));
StrokeLine(bounds.LeftBottom(), bounds.LeftTop());
bounds.left++;
StrokeLine(bounds.LeftTop(), bounds.RightTop());
SetHighColor(ui_color(B_SHINE_COLOR));
StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
bounds.top++;
bounds.bottom--;
StrokeLine(bounds.RightBottom(), bounds.RightTop());
}
} }
// #pragma mark - void
BScrollView::FrameMoved(BPoint newPosition)
{
BView::FrameMoved(newPosition);
}
void
BScrollView::FrameResized(float newWidth, float newHeight)
{
BView::FrameResized(newWidth, newHeight);
if (fBorder == B_NO_BORDER)
return;
BRect bounds = Bounds();
float border = _BorderSize() - 1;
if (be_control_look && fHorizontalScrollBar && fVerticalScrollBar) {
BRect scrollCorner(bounds);
scrollCorner.left = min_c(
fPreviousWidth - fVerticalScrollBar->Frame().Height(),
fHorizontalScrollBar->Frame().right + 1);
scrollCorner.top = min_c(
fPreviousHeight - fHorizontalScrollBar->Frame().Width(),
fVerticalScrollBar->Frame().bottom + 1);
Invalidate(scrollCorner);
}
// changes in newWidth
if (bounds.Width() > fPreviousWidth) {
// invalidate the region between the old and the new right border
BRect rect = bounds;
rect.left += fPreviousWidth - border;
rect.right--;
Invalidate(rect);
} else if (bounds.Width() < fPreviousWidth) {
// invalidate the region of the new right border
BRect rect = bounds;
rect.left = rect.right - border;
Invalidate(rect);
}
// changes in newHeight
if (bounds.Height() > fPreviousHeight) {
// invalidate the region between the old and the new bottom border
BRect rect = bounds;
rect.top += fPreviousHeight - border;
rect.bottom--;
Invalidate(rect);
} else if (bounds.Height() < fPreviousHeight) {
// invalidate the region of the new bottom border
BRect rect = bounds;
rect.top = rect.bottom - border;
Invalidate(rect);
}
fPreviousWidth = uint16(bounds.Width());
fPreviousHeight = uint16(bounds.Height());
}
void
BScrollView::MessageReceived(BMessage* message)
{
BView::MessageReceived(message);
}
void
BScrollView::MouseDown(BPoint where)
{
BView::MouseDown(where);
}
void
BScrollView::MouseMoved(BPoint where, uint32 code,
const BMessage* dragMessage)
{
BView::MouseMoved(where, code, dragMessage);
}
void
BScrollView::MouseUp(BPoint where)
{
BView::MouseUp(where);
}
void void
@@ -239,28 +313,38 @@ BScrollView::WindowActivated(bool active)
} }
void // #pragma mark - Size methods
BScrollView::MakeFocus(bool state)
{
BView::MakeFocus(state);
}
// #pragma mark -
void void
BScrollView::GetPreferredSize(float *_width, float *_height) BScrollView::GetPreferredSize(float* _width, float* _height)
{ {
BSize size = PreferredSize(); BSize size = PreferredSize();
if (_width) if (_width)
*_width = size.width; *_width = size.width;
if (_height) if (_height)
*_height = size.height; *_height = size.height;
} }
void
BScrollView::ResizeToPreferred()
{
if (Window() == NULL)
return;
BView::ResizeToPreferred();
}
void
BScrollView::MakeFocus(bool focus)
{
BView::MakeFocus(focus);
}
BSize BSize
BScrollView::MinSize() BScrollView::MinSize()
{ {
@@ -291,120 +375,13 @@ BScrollView::PreferredSize()
} }
void // #pragma mark - BScrollView methods
BScrollView::ResizeToPreferred()
{
if (Window() == NULL)
return;
BView::ResizeToPreferred();
}
void
BScrollView::FrameMoved(BPoint position)
{
BView::FrameMoved(position);
}
void
BScrollView::FrameResized(float width, float height)
{
BView::FrameResized(width, height);
if (fBorder == B_NO_BORDER)
return;
BRect bounds = Bounds();
float border = _BorderSize() - 1;
if (be_control_look && fHorizontalScrollBar && fVerticalScrollBar) {
BRect scrollCorner(bounds);
scrollCorner.left = min_c(
fPreviousWidth - fVerticalScrollBar->Frame().Height(),
fHorizontalScrollBar->Frame().right + 1);
scrollCorner.top = min_c(
fPreviousHeight - fHorizontalScrollBar->Frame().Width(),
fVerticalScrollBar->Frame().bottom + 1);
Invalidate(scrollCorner);
}
// changes in width
if (bounds.Width() > fPreviousWidth) {
// invalidate the region between the old and the new right border
BRect rect = bounds;
rect.left += fPreviousWidth - border;
rect.right--;
Invalidate(rect);
} else if (bounds.Width() < fPreviousWidth) {
// invalidate the region of the new right border
BRect rect = bounds;
rect.left = rect.right - border;
Invalidate(rect);
}
// changes in height
if (bounds.Height() > fPreviousHeight) {
// invalidate the region between the old and the new bottom border
BRect rect = bounds;
rect.top += fPreviousHeight - border;
rect.bottom--;
Invalidate(rect);
} else if (bounds.Height() < fPreviousHeight) {
// invalidate the region of the new bottom border
BRect rect = bounds;
rect.top = rect.bottom - border;
Invalidate(rect);
}
fPreviousWidth = uint16(bounds.Width());
fPreviousHeight = uint16(bounds.Height());
}
// #pragma mark -
void
BScrollView::MessageReceived(BMessage* message)
{
switch (message->what) {
default:
BView::MessageReceived(message);
}
}
void
BScrollView::MouseDown(BPoint point)
{
BView::MouseDown(point);
}
void
BScrollView::MouseUp(BPoint point)
{
BView::MouseUp(point);
}
void
BScrollView::MouseMoved(BPoint point, uint32 code, const BMessage *dragMessage)
{
BView::MouseMoved(point, code, dragMessage);
}
// #pragma mark -
BScrollBar* BScrollBar*
BScrollView::ScrollBar(orientation posture) const BScrollView::ScrollBar(orientation direction) const
{ {
if (posture == B_HORIZONTAL) if (direction == B_HORIZONTAL)
return fHorizontalScrollBar; return fHorizontalScrollBar;
return fVerticalScrollBar; return fVerticalScrollBar;
@@ -482,21 +459,21 @@ BScrollView::Border() const
status_t status_t
BScrollView::SetBorderHighlighted(bool state) BScrollView::SetBorderHighlighted(bool highlight)
{ {
if (fHighlighted == state) if (fHighlighted == highlight)
return B_OK; return B_OK;
if (fBorder != B_FANCY_BORDER) if (fBorder != B_FANCY_BORDER)
// highlighting only works for B_FANCY_BORDER // highlighting only works for B_FANCY_BORDER
return B_ERROR; return B_ERROR;
fHighlighted = state; fHighlighted = highlight;
if (fHorizontalScrollBar != NULL) if (fHorizontalScrollBar != NULL)
fHorizontalScrollBar->SetBorderHighlighted(state); fHorizontalScrollBar->SetBorderHighlighted(highlight);
if (fVerticalScrollBar != NULL) if (fVerticalScrollBar != NULL)
fVerticalScrollBar->SetBorderHighlighted(state); fVerticalScrollBar->SetBorderHighlighted(highlight);
BRect bounds = Bounds(); BRect bounds = Bounds();
if (be_control_look != NULL) if (be_control_look != NULL)
@@ -521,7 +498,7 @@ BScrollView::IsBorderHighlighted() const
void void
BScrollView::SetTarget(BView *target) BScrollView::SetTarget(BView* target)
{ {
if (fTarget == target) if (fTarget == target)
return; return;
@@ -560,25 +537,28 @@ BScrollView::Target() const
} }
// #pragma mark - // #pragma mark - Scripting methods
BHandler* BHandler*
BScrollView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, BScrollView::ResolveSpecifier(BMessage* message, int32 index,
int32 form, const char* property) BMessage* specifier, int32 what, const char* property)
{ {
return BView::ResolveSpecifier(msg, index, specifier, form, property); return BView::ResolveSpecifier(message, index, specifier, what, property);
} }
status_t status_t
BScrollView::GetSupportedSuites(BMessage *data) BScrollView::GetSupportedSuites(BMessage* message)
{ {
return BView::GetSupportedSuites(data); return BView::GetSupportedSuites(message);
} }
// #pragma mark - Perform
status_t status_t
BScrollView::Perform(perform_code code, void* _data) BScrollView::Perform(perform_code code, void* _data)
{ {
@@ -587,22 +567,27 @@ BScrollView::Perform(perform_code code, void* _data)
((perform_data_min_size*)_data)->return_value ((perform_data_min_size*)_data)->return_value
= BScrollView::MinSize(); = BScrollView::MinSize();
return B_OK; return B_OK;
case PERFORM_CODE_MAX_SIZE: case PERFORM_CODE_MAX_SIZE:
((perform_data_max_size*)_data)->return_value ((perform_data_max_size*)_data)->return_value
= BScrollView::MaxSize(); = BScrollView::MaxSize();
return B_OK; return B_OK;
case PERFORM_CODE_PREFERRED_SIZE: case PERFORM_CODE_PREFERRED_SIZE:
((perform_data_preferred_size*)_data)->return_value ((perform_data_preferred_size*)_data)->return_value
= BScrollView::PreferredSize(); = BScrollView::PreferredSize();
return B_OK; return B_OK;
case PERFORM_CODE_LAYOUT_ALIGNMENT: case PERFORM_CODE_LAYOUT_ALIGNMENT:
((perform_data_layout_alignment*)_data)->return_value ((perform_data_layout_alignment*)_data)->return_value
= BScrollView::LayoutAlignment(); = BScrollView::LayoutAlignment();
return B_OK; return B_OK;
case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
((perform_data_has_height_for_width*)_data)->return_value ((perform_data_has_height_for_width*)_data)->return_value
= BScrollView::HasHeightForWidth(); = BScrollView::HasHeightForWidth();
return B_OK; return B_OK;
case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
{ {
perform_data_get_height_for_width* data perform_data_get_height_for_width* data
@@ -611,12 +596,14 @@ BScrollView::Perform(perform_code code, void* _data)
&data->preferred); &data->preferred);
return B_OK; return B_OK;
} }
case PERFORM_CODE_SET_LAYOUT: case PERFORM_CODE_SET_LAYOUT:
{ {
perform_data_set_layout* data = (perform_data_set_layout*)_data; perform_data_set_layout* data = (perform_data_set_layout*)_data;
BScrollView::SetLayout(data->layout); BScrollView::SetLayout(data->layout);
return B_OK; return B_OK;
} }
case PERFORM_CODE_LAYOUT_INVALIDATED: case PERFORM_CODE_LAYOUT_INVALIDATED:
{ {
perform_data_layout_invalidated* data perform_data_layout_invalidated* data
@@ -624,6 +611,7 @@ BScrollView::Perform(perform_code code, void* _data)
BScrollView::LayoutInvalidated(data->descendants); BScrollView::LayoutInvalidated(data->descendants);
return B_OK; return B_OK;
} }
case PERFORM_CODE_DO_LAYOUT: case PERFORM_CODE_DO_LAYOUT:
{ {
BScrollView::DoLayout(); BScrollView::DoLayout();
@@ -635,6 +623,9 @@ BScrollView::Perform(perform_code code, void* _data)
} }
// #pragma mark - Protected methods
void void
BScrollView::LayoutInvalidated(bool descendants) BScrollView::LayoutInvalidated(bool descendants)
{ {
@@ -644,11 +635,11 @@ BScrollView::LayoutInvalidated(bool descendants)
void void
BScrollView::DoLayout() BScrollView::DoLayout()
{ {
if (!(Flags() & B_SUPPORTS_LAYOUT)) if ((Flags() & B_SUPPORTS_LAYOUT) == 0)
return; return;
// If the user set a layout, we let the base class version call its hook. // If the user set a layout, we let the base class version call its hook.
if (GetLayout()) { if (GetLayout() != NULL) {
BView::DoLayout(); BView::DoLayout();
return; return;
} }
@@ -667,9 +658,7 @@ BScrollView::DoLayout()
} }
// #pragma mark - Private methods
// #pragma mark -
void void
@@ -882,10 +871,10 @@ BScrollView::_ModifyFlags(int32 flags, border_style border)
} }
// #pragma mark - // #pragma mark - FBC and forbidden
BScrollView & BScrollView&
BScrollView::operator=(const BScrollView &) BScrollView::operator=(const BScrollView &)
{ {
return *this; return *this;
@@ -907,4 +896,3 @@ B_IF_GCC_2(InvalidateLayout__11BScrollViewb,
view->Perform(PERFORM_CODE_LAYOUT_INVALIDATED, &data); view->Perform(PERFORM_CODE_LAYOUT_INVALIDATED, &data);
} }
+17 -18
View File
@@ -630,7 +630,7 @@ BTextView::MouseUp(BPoint where)
// Hook method that is called whenever the mouse cursor enters, exits // Hook method that is called whenever the mouse cursor enters, exits
// or moves inside the view. // or moves inside the view.
void void
BTextView::MouseMoved(BPoint where, uint32 code, const BMessage* message) BTextView::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage)
{ {
// Check if it's a "click'n'move" // Check if it's a "click'n'move"
if (_PerformMouseMoved(where, code)) if (_PerformMouseMoved(where, code))
@@ -639,18 +639,17 @@ BTextView::MouseMoved(BPoint where, uint32 code, const BMessage* message)
switch (code) { switch (code) {
case B_ENTERED_VIEW: case B_ENTERED_VIEW:
case B_INSIDE_VIEW: case B_INSIDE_VIEW:
_TrackMouse(where, message, true); _TrackMouse(where, dragMessage, true);
break; break;
case B_EXITED_VIEW: case B_EXITED_VIEW:
_DragCaret(-1); _DragCaret(-1);
if (Window()->IsActive() && message == NULL) if (Window()->IsActive() && dragMessage == NULL)
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT); SetViewCursor(B_CURSOR_SYSTEM_DEFAULT);
break; break;
default: default:
BView::MouseMoved(where, code, message); BView::MouseMoved(where, code, dragMessage);
break;
} }
} }
@@ -658,11 +657,11 @@ BTextView::MouseMoved(BPoint where, uint32 code, const BMessage* message)
// Hook method that is called when the window becomes the active window // Hook method that is called when the window becomes the active window
// or gives up that status. // or gives up that status.
void void
BTextView::WindowActivated(bool state) BTextView::WindowActivated(bool active)
{ {
BView::WindowActivated(state); BView::WindowActivated(active);
if (state && IsFocus()) { if (active && IsFocus()) {
if (!fActive) if (!fActive)
_Activate(); _Activate();
} else { } else {
@@ -779,9 +778,9 @@ BTextView::Pulse()
// Hook method that is called when the frame is resized. // Hook method that is called when the frame is resized.
void void
BTextView::FrameResized(float width, float height) BTextView::FrameResized(float newWidth, float newHeight)
{ {
BView::FrameResized(width, height); BView::FrameResized(newWidth, newHeight);
_UpdateScrollbars(); _UpdateScrollbars();
} }
@@ -789,11 +788,11 @@ BTextView::FrameResized(float width, float height)
// Highlight or unhighlight the selection when the view gets or loses its // Highlight or unhighlight the selection when the view gets or loses its
// focus state. // focus state.
void void
BTextView::MakeFocus(bool focusState) BTextView::MakeFocus(bool focus)
{ {
BView::MakeFocus(focusState); BView::MakeFocus(focus);
if (focusState && Window() && Window()->IsActive()) { if (focus && Window() != NULL && Window()->IsActive()) {
if (!fActive) if (!fActive)
_Activate(); _Activate();
} else { } else {
@@ -1964,12 +1963,12 @@ BTextView::CanEndLine(int32 offset)
// Returns the width of the line at the given index. // Returns the width of the line at the given index.
float float
BTextView::LineWidth(int32 lineNum) const BTextView::LineWidth(int32 lineNumber) const
{ {
if (lineNum < 0 || lineNum >= fLines->NumLines()) if (lineNumber < 0 || lineNumber >= fLines->NumLines())
return 0; return 0;
STELine* line = (*fLines)[lineNum]; STELine* line = (*fLines)[lineNumber];
int32 length = (line + 1)->offset - line->offset; int32 length = (line + 1)->offset - line->offset;
// skip newline at the end of the line, if any, as it does no contribute // skip newline at the end of the line, if any, as it does no contribute
@@ -1983,9 +1982,9 @@ BTextView::LineWidth(int32 lineNum) const
// Returns the height of the line at the given index. // Returns the height of the line at the given index.
float float
BTextView::LineHeight(int32 lineNum) const BTextView::LineHeight(int32 lineNumber) const
{ {
float lineHeight = TextHeight(lineNum, lineNum); float lineHeight = TextHeight(lineNumber, lineNumber);
if (lineHeight == 0.0) { if (lineHeight == 0.0) {
// We probably don't have text content yet. Take the initial // We probably don't have text content yet. Take the initial
// style's font height or fall back to the plain font. // style's font height or fall back to the plain font.
+16 -15
View File
@@ -1328,7 +1328,7 @@ BView::TargetedByScrollView(BScrollView* scroll_view)
void void
BView::WindowActivated(bool state) BView::WindowActivated(bool active)
{ {
// Hook function // Hook function
STRACE(("\tHOOK: BView(%s)::WindowActivated()\n", Name())); STRACE(("\tHOOK: BView(%s)::WindowActivated()\n", Name()));
@@ -1602,33 +1602,34 @@ BView::GetMouse(BPoint* _location, uint32* _buttons, bool checkMessageQueue)
void void
BView::MakeFocus(bool focusState) BView::MakeFocus(bool focus)
{ {
if (fOwner) { if (fOwner == NULL)
// TODO: If this view has focus and focusState==false, return;
// TODO: If this view has focus and focus == false,
// will there really be no other view with focus? No // will there really be no other view with focus? No
// cycling to the next one? // cycling to the next one?
BView* focus = fOwner->CurrentFocus(); BView* focusView = fOwner->CurrentFocus();
if (focusState) { if (focus) {
// Unfocus a previous focus view // Unfocus a previous focus view
if (focus && focus != this) if (focusView != NULL && focusView != this)
focus->MakeFocus(false); focusView->MakeFocus(false);
// if we want to make this view the current focus view // if we want to make this view the current focus view
fOwner->_SetFocus(this, true); fOwner->_SetFocus(this, true);
} else { } else {
// we want to unfocus this view, but only if it actually has focus // we want to unfocus this view, but only if it actually has focus
if (focus == this) { if (focusView == this)
fOwner->_SetFocus(NULL, true); fOwner->_SetFocus(NULL, true);
} }
}
}
} }
BScrollBar* BScrollBar*
BView::ScrollBar(orientation posture) const BView::ScrollBar(orientation direction) const
{ {
switch (posture) { switch (direction) {
case B_VERTICAL: case B_VERTICAL:
return fVerScroller; return fVerScroller;
@@ -1795,9 +1796,9 @@ BView::PopState()
void void
BView::SetOrigin(BPoint pt) BView::SetOrigin(BPoint where)
{ {
SetOrigin(pt.x, pt.y); SetOrigin(where.x, where.y);
} }
+1 -1
View File
@@ -2008,7 +2008,7 @@ BWindow::Activate(bool active)
void void
BWindow::WindowActivated(bool state) BWindow::WindowActivated(bool focus)
{ {
// hook function // hook function
// does nothing // does nothing