From 5f2db70ffb61959e967b7380fd9253be3a13cfdd Mon Sep 17 00:00:00 2001 From: Markus Himmel Date: Sat, 26 Dec 2015 22:12:29 +0100 Subject: [PATCH] Interface Kit: Add BCardView Signed-off-by: Augustin Cavalier --- headers/os/interface/CardView.h | 47 +++++++++++++++++++ src/kits/interface/CardView.cpp | 81 +++++++++++++++++++++++++++++++++ src/kits/interface/Jamfile | 1 + 3 files changed, 129 insertions(+) create mode 100644 headers/os/interface/CardView.h create mode 100644 src/kits/interface/CardView.cpp diff --git a/headers/os/interface/CardView.h b/headers/os/interface/CardView.h new file mode 100644 index 0000000000..4973aa9273 --- /dev/null +++ b/headers/os/interface/CardView.h @@ -0,0 +1,47 @@ +/* + * Copyright 2015, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _CARD_VIEW_H +#define _CARD_VIEW_H + +#include + +class BCardLayout; + +class BCardView : public BView { +public: + BCardView(); + BCardView(const char* name); + BCardView(BMessage* from); + virtual ~BCardView(); + + virtual void SetLayout(BLayout* layout); + BCardLayout* CardLayout() const; + + static BArchivable* Instantiate(BMessage* from); + + virtual status_t Perform(perform_code d, void* arg); + +private: + + // FBC padding - prevent breaking compatibility when methods are added + virtual void _ReservedCardView1(); + virtual void _ReservedCardView2(); + virtual void _ReservedCardView3(); + virtual void _ReservedCardView4(); + virtual void _ReservedCardView5(); + virtual void _ReservedCardView6(); + virtual void _ReservedCardView7(); + virtual void _ReservedCardView8(); + virtual void _ReservedCardView9(); + virtual void _ReservedCardView10(); + + // forbitten methods + BCardView(const BCardView&); + void operator =(const BCardView&); + + uint32 _reserved[10]; +}; + +#endif // _CARD_VIEW_H diff --git a/src/kits/interface/CardView.cpp b/src/kits/interface/CardView.cpp new file mode 100644 index 0000000000..25c31c7158 --- /dev/null +++ b/src/kits/interface/CardView.cpp @@ -0,0 +1,81 @@ +/* + * Copyright 2015, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT license. + */ + + +#include +#include + + +BCardView::BCardView() + : + BView(NULL, 0, new BCardLayout()) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); +} + + +BCardView::BCardView(const char* name) + : + BView(name, 0, new BCardLayout()) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); +} + + +BCardView::BCardView(BMessage* from) + : + BView(from) +{ +} + + +BCardView::~BCardView() +{ +} + + +void +BCardView::SetLayout(BLayout* layout) +{ + if (dynamic_cast(layout) == NULL) + return; + + BView::SetLayout(layout); +} + + +BCardLayout* +BCardView::CardLayout() const +{ + return static_cast(GetLayout()); +} + + +BArchivable* +BCardView::Instantiate(BMessage* from) +{ + if (validate_instantiation(from, "BCardView")) + return new BCardView(from); + return NULL; +} + + +status_t +BCardView::Perform(perform_code d, void* arg) +{ + return BView::Perform(d, arg); +} + + +void BCardView::_ReservedCardView1() {} +void BCardView::_ReservedCardView2() {} +void BCardView::_ReservedCardView3() {} +void BCardView::_ReservedCardView4() {} +void BCardView::_ReservedCardView5() {} +void BCardView::_ReservedCardView6() {} +void BCardView::_ReservedCardView7() {} +void BCardView::_ReservedCardView8() {} +void BCardView::_ReservedCardView9() {} +void BCardView::_ReservedCardView10() {} diff --git a/src/kits/interface/Jamfile b/src/kits/interface/Jamfile index cec0540f17..c02b07b8d2 100644 --- a/src/kits/interface/Jamfile +++ b/src/kits/interface/Jamfile @@ -51,6 +51,7 @@ for architectureObject in [ MultiArchSubDirSetup ] { Box.cpp Button.cpp CardLayout.cpp + CardView.cpp ChannelControl.cpp ChannelSlider.cpp CheckBox.cpp