Use a tabview instead of an iconrule (without icons) in the notification preflet.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43161 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,117 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Copyright 2009, Pier Luigi Fiorini.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Pier Luigi Fiorini, [email protected]
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <Bitmap.h>
|
|
||||||
|
|
||||||
#include "IconItem.h"
|
|
||||||
#include "IconRule.h"
|
|
||||||
|
|
||||||
const int32 kEdgeOffset = 4;
|
|
||||||
|
|
||||||
|
|
||||||
BIconItem::BIconItem(BView* owner, const char* label, BBitmap* icon)
|
|
||||||
:
|
|
||||||
fLabel(label),
|
|
||||||
fIcon(icon),
|
|
||||||
fSelected(false),
|
|
||||||
fOwner(owner)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BIconItem::~BIconItem()
|
|
||||||
{
|
|
||||||
delete fIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BIconItem::Draw()
|
|
||||||
{
|
|
||||||
if (IsSelected()) {
|
|
||||||
rgb_color color;
|
|
||||||
rgb_color origHigh;
|
|
||||||
|
|
||||||
origHigh = fOwner->HighColor();
|
|
||||||
|
|
||||||
if (IsSelected())
|
|
||||||
color = ui_color(B_CONTROL_HIGHLIGHT_COLOR);
|
|
||||||
else
|
|
||||||
color = fOwner->ViewColor();
|
|
||||||
|
|
||||||
fOwner->SetHighColor(color);
|
|
||||||
fOwner->FillRect(fFrame);
|
|
||||||
fOwner->SetHighColor(origHigh);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fIcon)
|
|
||||||
{
|
|
||||||
fOwner->SetDrawingMode(B_OP_ALPHA);
|
|
||||||
fOwner->DrawBitmap(fIcon, BPoint(fFrame.top + kEdgeOffset,
|
|
||||||
fFrame.left + kEdgeOffset));
|
|
||||||
fOwner->SetDrawingMode(B_OP_COPY);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsSelected())
|
|
||||||
fOwner->SetDrawingMode(B_OP_OVER);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
fOwner->MovePenTo(frame.left + kEdgeOffset + fIconWidth + kEdgeOffset,
|
|
||||||
frame.bottom - fFontOffset);
|
|
||||||
#else
|
|
||||||
fOwner->MovePenTo(fFrame.left, fFrame.bottom - 10);
|
|
||||||
#endif
|
|
||||||
fOwner->SetHighColor(ui_color(B_CONTROL_TEXT_COLOR));
|
|
||||||
fOwner->DrawString(" ");
|
|
||||||
fOwner->DrawString(fLabel.String());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char*
|
|
||||||
BIconItem::Label() const
|
|
||||||
{
|
|
||||||
return fLabel.String();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconItem::SetFrame(BRect frame)
|
|
||||||
{
|
|
||||||
fFrame = frame;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BRect
|
|
||||||
BIconItem::Frame() const
|
|
||||||
{
|
|
||||||
return fFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconItem::Select()
|
|
||||||
{
|
|
||||||
fSelected = true;
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconItem::Deselect()
|
|
||||||
{
|
|
||||||
fSelected = false;
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
BIconItem::IsSelected() const
|
|
||||||
{
|
|
||||||
return fSelected;
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Copyright 2009, Pier Luigi Fiorini.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef _ICON_ITEM_H
|
|
||||||
#define _ICON_ITEM_H
|
|
||||||
|
|
||||||
#include <View.h>
|
|
||||||
#include <String.h>
|
|
||||||
|
|
||||||
class BBitmap;
|
|
||||||
|
|
||||||
class BIconItem {
|
|
||||||
public:
|
|
||||||
BIconItem(BView* owner, const char* label, BBitmap* icon);
|
|
||||||
virtual ~BIconItem();
|
|
||||||
|
|
||||||
void Draw();
|
|
||||||
|
|
||||||
const char* Label() const;
|
|
||||||
|
|
||||||
void SetFrame(BRect frame);
|
|
||||||
BRect Frame() const;
|
|
||||||
|
|
||||||
void Select();
|
|
||||||
void Deselect();
|
|
||||||
bool IsSelected() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
BString fLabel;
|
|
||||||
BBitmap* fIcon;
|
|
||||||
bool fSelected;
|
|
||||||
BView* fOwner;
|
|
||||||
BRect fFrame;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _ICON_ITEM_H
|
|
||||||
@@ -1,262 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Copyright 2009, Pier Luigi Fiorini.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Pier Luigi Fiorini, [email protected]
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <Message.h>
|
|
||||||
#include <Bitmap.h>
|
|
||||||
#include <Window.h>
|
|
||||||
|
|
||||||
#include "IconRule.h"
|
|
||||||
|
|
||||||
const int32 kEdgeOffset = 8;
|
|
||||||
const int32 kBorderOffset = 1;
|
|
||||||
|
|
||||||
// TODO: Do we need to inherit from BControl?
|
|
||||||
|
|
||||||
BIconRule::BIconRule(const char* name)
|
|
||||||
:
|
|
||||||
BView(name, B_WILL_DRAW),
|
|
||||||
fIcons(5, true),
|
|
||||||
fSelIndex(-1),
|
|
||||||
fMessage(NULL)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BIconRule::~BIconRule()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BIconRule::Invoke(BMessage* message)
|
|
||||||
{
|
|
||||||
bool notify = false;
|
|
||||||
uint32 kind = InvokeKind(¬ify);
|
|
||||||
|
|
||||||
BMessage clone(kind);
|
|
||||||
status_t err = B_BAD_VALUE;
|
|
||||||
|
|
||||||
if (!message && !notify)
|
|
||||||
message = Message();
|
|
||||||
|
|
||||||
if (!message) {
|
|
||||||
if (!IsWatched())
|
|
||||||
return err;
|
|
||||||
} else
|
|
||||||
clone = *message;
|
|
||||||
|
|
||||||
clone.AddInt64("when", (int64)system_time());
|
|
||||||
clone.AddPointer("source", this);
|
|
||||||
clone.AddMessenger("be:sender", BMessenger(this));
|
|
||||||
clone.AddInt32("index", fSelIndex);
|
|
||||||
|
|
||||||
if (message)
|
|
||||||
err = BInvoker::Invoke(&clone);
|
|
||||||
|
|
||||||
SendNotices(kind, &clone);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconRule::AttachedToWindow()
|
|
||||||
{
|
|
||||||
BView::AttachedToWindow();
|
|
||||||
|
|
||||||
if (!Messenger().IsValid())
|
|
||||||
SetTarget(Window(), NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconRule::MouseDown(BPoint point)
|
|
||||||
{
|
|
||||||
if (!IsFocus()) {
|
|
||||||
MakeFocus();
|
|
||||||
Sync();
|
|
||||||
Window()->UpdateIfNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 index = IndexOf(point);
|
|
||||||
if (index > -1)
|
|
||||||
SlideToIcon(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconRule::Draw(BRect updateRect)
|
|
||||||
{
|
|
||||||
int32 count = CountIcons();
|
|
||||||
if (count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
rgb_color panelColor = ui_color(B_PANEL_BACKGROUND_COLOR);
|
|
||||||
rgb_color lightColor = tint_color(panelColor, B_DARKEN_1_TINT);
|
|
||||||
rgb_color darkColor = tint_color(lightColor, B_DARKEN_2_TINT);
|
|
||||||
|
|
||||||
SetHighColor(darkColor);
|
|
||||||
StrokeLine(Bounds().LeftTop(), Bounds().RightTop());
|
|
||||||
StrokeLine(Bounds().LeftTop(), Bounds().LeftBottom());
|
|
||||||
|
|
||||||
SetHighColor(lightColor);
|
|
||||||
StrokeLine(Bounds().LeftBottom(), Bounds().RightBottom());
|
|
||||||
StrokeLine(Bounds().RightTop(), Bounds().RightBottom());
|
|
||||||
|
|
||||||
BRect itemFrame(kEdgeOffset, kBorderOffset, -1, kBorderOffset + 64);
|
|
||||||
for (int32 i = 0; i < count; i++) {
|
|
||||||
BIconItem* item = fIcons.ItemAt(i);
|
|
||||||
float width = StringWidth(item->Label()) + StringWidth(" ") * 2;
|
|
||||||
if (width < 64.0f)
|
|
||||||
width = 64.0f;
|
|
||||||
itemFrame.right = itemFrame.left + width - 1;
|
|
||||||
|
|
||||||
if (itemFrame.Intersects(updateRect)) {
|
|
||||||
item->SetFrame(itemFrame);
|
|
||||||
item->Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
itemFrame.left = itemFrame.right + kEdgeOffset + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BMessage*
|
|
||||||
BIconRule::SelectionMessage() const
|
|
||||||
{
|
|
||||||
return fMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconRule::SetSelectionMessage(BMessage* message)
|
|
||||||
{
|
|
||||||
delete fMessage;
|
|
||||||
fMessage = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconRule::AddIcon(const char* label, const BBitmap* icon)
|
|
||||||
{
|
|
||||||
BIconItem* item = new BIconItem(this, label, (BBitmap*)icon);
|
|
||||||
if (CountIcons() == 0) {
|
|
||||||
item->Select();
|
|
||||||
fSelIndex = 0;
|
|
||||||
}
|
|
||||||
fIcons.AddItem(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconRule::RemoveIconAt(int32 index)
|
|
||||||
{
|
|
||||||
delete fIcons.RemoveItemAt(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconRule::RemoveAllIcons()
|
|
||||||
{
|
|
||||||
fIcons.MakeEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32
|
|
||||||
BIconRule::CountIcons() const
|
|
||||||
{
|
|
||||||
return fIcons.CountItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconRule::SlideToIcon(int32 index)
|
|
||||||
{
|
|
||||||
BIconItem* item = fIcons.ItemAt(index);
|
|
||||||
if (item) {
|
|
||||||
// Deselect previously selected item
|
|
||||||
if (fSelIndex > -1) {
|
|
||||||
BIconItem* selItem = fIcons.ItemAt(fSelIndex);
|
|
||||||
selItem->Deselect();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Select this item
|
|
||||||
item->Select();
|
|
||||||
fSelIndex = index;
|
|
||||||
Invalidate();
|
|
||||||
|
|
||||||
// Invoke notification
|
|
||||||
InvokeNotify(fMessage, B_CONTROL_MODIFIED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconRule::SlideToNext()
|
|
||||||
{
|
|
||||||
SlideToIcon(fSelIndex + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BIconRule::SlideToPrevious()
|
|
||||||
{
|
|
||||||
SlideToIcon(fSelIndex - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32
|
|
||||||
BIconRule::IndexOf(BPoint point)
|
|
||||||
{
|
|
||||||
int32 low = 0;
|
|
||||||
int32 high = fIcons.CountItems() - 1;
|
|
||||||
int32 mid = -1;
|
|
||||||
float frameLeft = -1.0f;
|
|
||||||
float frameRight = 1.0f;
|
|
||||||
|
|
||||||
// Binary search the list
|
|
||||||
while (high >= low) {
|
|
||||||
mid = (low + high) / 2;
|
|
||||||
BIconItem* item = fIcons.ItemAt(mid);
|
|
||||||
frameLeft = item->Frame().left;
|
|
||||||
frameRight = item->Frame().right;
|
|
||||||
if (point.x < frameLeft)
|
|
||||||
high = mid - 1;
|
|
||||||
else if (point.x > frameRight)
|
|
||||||
low = mid + 1;
|
|
||||||
else
|
|
||||||
return mid;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
BSize
|
|
||||||
BIconRule::MinSize()
|
|
||||||
{
|
|
||||||
BSize minSize(BView::MinSize());
|
|
||||||
minSize.height = 64 + (kBorderOffset * 2);
|
|
||||||
return minSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BSize
|
|
||||||
BIconRule::MaxSize()
|
|
||||||
{
|
|
||||||
return BView::MaxSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BSize
|
|
||||||
BIconRule::PreferredSize()
|
|
||||||
{
|
|
||||||
return BView::PreferredSize();
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Copyright 2009, Pier Luigi Fiorini.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef _ICON_RULE_H
|
|
||||||
#define _ICON_RULE_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <Invoker.h>
|
|
||||||
#include <ObjectList.h>
|
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
#include "IconItem.h"
|
|
||||||
|
|
||||||
|
|
||||||
class BMessage;
|
|
||||||
|
|
||||||
class BIconRule : public BView, public BInvoker {
|
|
||||||
public:
|
|
||||||
BIconRule(const char* name);
|
|
||||||
virtual ~BIconRule();
|
|
||||||
|
|
||||||
status_t Invoke(BMessage* message);
|
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
|
||||||
|
|
||||||
virtual void MouseDown(BPoint point);
|
|
||||||
virtual void Draw(BRect updateRect);
|
|
||||||
|
|
||||||
BMessage* SelectionMessage() const;
|
|
||||||
void SetSelectionMessage(BMessage* message);
|
|
||||||
|
|
||||||
void AddIcon(const char* label, const BBitmap* icon);
|
|
||||||
void RemoveIconAt(int32 index);
|
|
||||||
void RemoveAllIcons();
|
|
||||||
|
|
||||||
int32 CountIcons() const;
|
|
||||||
|
|
||||||
void SlideToIcon(int32 index);
|
|
||||||
void SlideToNext();
|
|
||||||
void SlideToPrevious();
|
|
||||||
|
|
||||||
int32 IndexOf(BPoint point);
|
|
||||||
|
|
||||||
virtual BSize MinSize();
|
|
||||||
virtual BSize MaxSize();
|
|
||||||
virtual BSize PreferredSize();
|
|
||||||
|
|
||||||
private:
|
|
||||||
typedef BObjectList<BIconItem> IconItems;
|
|
||||||
IconItems fIcons;
|
|
||||||
int32 fSelIndex;
|
|
||||||
BMessage* fMessage;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _ICON_RULE_H
|
|
||||||
@@ -12,8 +12,6 @@ Application Notifications :
|
|||||||
GeneralView.cpp
|
GeneralView.cpp
|
||||||
DisplayView.cpp
|
DisplayView.cpp
|
||||||
NotificationsView.cpp
|
NotificationsView.cpp
|
||||||
IconRule.cpp
|
|
||||||
IconItem.cpp
|
|
||||||
: be translation libcolumnlistview.a libnotification.a $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS)
|
: be translation libcolumnlistview.a libnotification.a $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS)
|
||||||
: Notifications.rdef
|
: Notifications.rdef
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include "SettingsHost.h"
|
#include "SettingsHost.h"
|
||||||
#include "PrefletView.h"
|
#include "PrefletView.h"
|
||||||
#include "IconRule.h"
|
|
||||||
#include "GeneralView.h"
|
#include "GeneralView.h"
|
||||||
#include "DisplayView.h"
|
#include "DisplayView.h"
|
||||||
#include "NotificationsView.h"
|
#include "NotificationsView.h"
|
||||||
@@ -31,111 +30,44 @@ const int32 kPageSelected = '_LCH';
|
|||||||
|
|
||||||
PrefletView::PrefletView(SettingsHost* host)
|
PrefletView::PrefletView(SettingsHost* host)
|
||||||
:
|
:
|
||||||
BView("pages", B_WILL_DRAW)
|
BTabView("pages")
|
||||||
{
|
{
|
||||||
// Page selector
|
|
||||||
fRule = new BIconRule("icon_rule");
|
|
||||||
fRule->SetSelectionMessage(new BMessage(kPageSelected));
|
|
||||||
fRule->AddIcon(B_TRANSLATE("General"), NULL);
|
|
||||||
fRule->AddIcon(B_TRANSLATE("Display"), NULL);
|
|
||||||
//fRule->AddIcon(B_TRANSLATE("Notifications"), NULL);
|
|
||||||
|
|
||||||
// View for card layout
|
|
||||||
fPagesView = new BView("pages", B_WILL_DRAW);
|
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
GeneralView* general = new GeneralView(host);
|
GeneralView* general = new GeneralView(host);
|
||||||
DisplayView* display = new DisplayView(host);
|
DisplayView* display = new DisplayView(host);
|
||||||
NotificationsView* apps = new NotificationsView();
|
NotificationsView* apps = new NotificationsView();
|
||||||
|
|
||||||
// Calculate inset
|
// Page selector
|
||||||
float inset = ceilf(be_plain_font->Size() * 0.7f);
|
BTab* tab = new BTab();
|
||||||
|
AddTab(general, tab);
|
||||||
|
tab->SetLabel(B_TRANSLATE("General"));
|
||||||
|
|
||||||
// Build the layout
|
tab = new BTab();
|
||||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
AddTab(display, tab);
|
||||||
|
tab->SetLabel(B_TRANSLATE("Display"));
|
||||||
|
|
||||||
// Card layout for pages
|
tab = new BTab();
|
||||||
BCardLayout* layout = new BCardLayout();
|
AddTab(apps, tab);
|
||||||
fPagesView->SetLayout(layout);
|
tab->SetLabel(B_TRANSLATE("Notifications"));
|
||||||
layout->AddView(general);
|
|
||||||
layout->AddView(display);
|
|
||||||
layout->AddView(apps);
|
|
||||||
|
|
||||||
// Add childs
|
|
||||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, inset)
|
|
||||||
.Add(fRule)
|
|
||||||
.Add(fPagesView)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Select the first view
|
|
||||||
Select(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PrefletView::AttachedToWindow()
|
|
||||||
{
|
|
||||||
fRule->SetTarget(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PrefletView::MessageReceived(BMessage* message)
|
|
||||||
{
|
|
||||||
switch (message->what) {
|
|
||||||
case kPageSelected:
|
|
||||||
{
|
|
||||||
int32 index = B_ERROR;
|
|
||||||
if (message->FindInt32("index", &index) != B_OK)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Select(index);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
BView::MessageReceived(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PrefletView::Select(int32 index)
|
|
||||||
{
|
|
||||||
BCardLayout* layout
|
|
||||||
= dynamic_cast<BCardLayout*>(fPagesView->GetLayout());
|
|
||||||
if (layout)
|
|
||||||
layout->SetVisibleItem(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BView*
|
BView*
|
||||||
PrefletView::CurrentPage()
|
PrefletView::CurrentPage()
|
||||||
{
|
{
|
||||||
BCardLayout* layout
|
return PageAt(FocusTab());
|
||||||
= dynamic_cast<BCardLayout*>(fPagesView->GetLayout());
|
|
||||||
if (layout)
|
|
||||||
return layout->VisibleItem()->View();
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
PrefletView::CountPages() const
|
PrefletView::CountPages() const
|
||||||
{
|
{
|
||||||
BCardLayout* layout
|
return 3;
|
||||||
= dynamic_cast<BCardLayout*>(fPagesView->GetLayout());
|
|
||||||
if (layout)
|
|
||||||
return layout->CountItems();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BView*
|
BView*
|
||||||
PrefletView::PageAt(int32 index)
|
PrefletView::PageAt(int32 index)
|
||||||
{
|
{
|
||||||
BCardLayout* layout
|
return TabAt(index)->View();
|
||||||
= dynamic_cast<BCardLayout*>(fPagesView->GetLayout());
|
|
||||||
if (layout)
|
|
||||||
return layout->ItemAt(index)->View();
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,27 +6,19 @@
|
|||||||
#ifndef _PREFLET_VIEW_H
|
#ifndef _PREFLET_VIEW_H
|
||||||
#define _PREFLET_VIEW_H
|
#define _PREFLET_VIEW_H
|
||||||
|
|
||||||
#include <View.h>
|
#include <TabView.h>
|
||||||
|
|
||||||
class BIconRule;
|
class BIconRule;
|
||||||
|
|
||||||
class SettingsHost;
|
class SettingsHost;
|
||||||
|
|
||||||
class PrefletView : public BView {
|
class PrefletView : public BTabView {
|
||||||
public:
|
public:
|
||||||
PrefletView(SettingsHost* host);
|
PrefletView(SettingsHost* host);
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
|
||||||
|
|
||||||
void Select(int32 index);
|
|
||||||
BView* CurrentPage();
|
BView* CurrentPage();
|
||||||
int32 CountPages() const;
|
int32 CountPages() const;
|
||||||
BView* PageAt(int32 index);
|
BView* PageAt(int32 index);
|
||||||
|
|
||||||
private:
|
|
||||||
BIconRule* fRule;
|
|
||||||
BView* fPagesView;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PREFLETVIEW_H
|
#endif // PREFLETVIEW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user