Style fixes to BSeparatorItem class.
Mostly meant for documentation with a few other style corrections as well. Update copyright header.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2001-2014 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SEPARATOR_ITEM_H
|
||||
#define _SEPARATOR_ITEM_H
|
||||
|
||||
|
||||
|
||||
#include <MenuItem.h>
|
||||
|
||||
@@ -17,11 +17,11 @@ public:
|
||||
BSeparatorItem(BMessage* archive);
|
||||
virtual ~BSeparatorItem();
|
||||
|
||||
static BArchivable* Instantiate(BMessage* archive);
|
||||
virtual status_t Archive(BMessage* archive,
|
||||
static BArchivable* Instantiate(BMessage* data);
|
||||
virtual status_t Archive(BMessage* data,
|
||||
bool deep = true) const;
|
||||
|
||||
virtual void SetEnabled(bool state);
|
||||
virtual void SetEnabled(bool enable);
|
||||
|
||||
protected:
|
||||
virtual void GetContentSize(float* _width, float* _height);
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2010, Haiku, Inc.
|
||||
* Copyright (c) 2001-2014 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Authors:
|
||||
* Marc Flerackers ([email protected])
|
||||
* Bill Hayden ([email protected])
|
||||
* Stefano Ceccherini ([email protected])
|
||||
* Stefano Ceccherini, [email protected]
|
||||
* Marc Flerackers, [email protected]
|
||||
* Bill Hayden, [email protected]
|
||||
*/
|
||||
|
||||
/*! Display separator item for BMenu class */
|
||||
|
||||
|
||||
#include <SeparatorItem.h>
|
||||
|
||||
#include <Font.h>
|
||||
|
||||
|
||||
BSeparatorItem::BSeparatorItem()
|
||||
: BMenuItem("", NULL)
|
||||
:
|
||||
BMenuItem("", NULL)
|
||||
{
|
||||
BMenuItem::SetEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
BSeparatorItem::BSeparatorItem(BMessage* archive)
|
||||
: BMenuItem(archive)
|
||||
BSeparatorItem::BSeparatorItem(BMessage* data)
|
||||
:
|
||||
BMenuItem(data)
|
||||
{
|
||||
BMenuItem::SetEnabled(false);
|
||||
}
|
||||
@@ -35,13 +36,13 @@ BSeparatorItem::~BSeparatorItem()
|
||||
|
||||
|
||||
status_t
|
||||
BSeparatorItem::Archive(BMessage* archive, bool deep) const
|
||||
BSeparatorItem::Archive(BMessage* data, bool deep) const
|
||||
{
|
||||
return BMenuItem::Archive(archive, deep);
|
||||
return BMenuItem::Archive(data, deep);
|
||||
}
|
||||
|
||||
|
||||
BArchivable *
|
||||
BArchivable*
|
||||
BSeparatorItem::Instantiate(BMessage* archive)
|
||||
{
|
||||
if (validate_instantiation(archive, "BSeparatorItem"))
|
||||
@@ -52,7 +53,7 @@ BSeparatorItem::Instantiate(BMessage* archive)
|
||||
|
||||
|
||||
void
|
||||
BSeparatorItem::SetEnabled(bool state)
|
||||
BSeparatorItem::SetEnabled(bool enable)
|
||||
{
|
||||
// Don't do anything - we don't want to get enabled ever
|
||||
}
|
||||
@@ -66,8 +67,9 @@ BSeparatorItem::GetContentSize(float* _width, float* _height)
|
||||
|
||||
if (_height != NULL) {
|
||||
BFont font(be_plain_font);
|
||||
if (Menu())
|
||||
if (Menu() != NULL)
|
||||
Menu()->GetFont(&font);
|
||||
|
||||
const float height = floorf((font.Size() * 0.8) / 2) * 2;
|
||||
*_height = max_c(4, height);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user