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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _SEPARATOR_ITEM_H
|
#ifndef _SEPARATOR_ITEM_H
|
||||||
#define _SEPARATOR_ITEM_H
|
#define _SEPARATOR_ITEM_H
|
||||||
|
|
||||||
|
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
|
|
||||||
@@ -17,11 +17,11 @@ public:
|
|||||||
BSeparatorItem(BMessage* archive);
|
BSeparatorItem(BMessage* archive);
|
||||||
virtual ~BSeparatorItem();
|
virtual ~BSeparatorItem();
|
||||||
|
|
||||||
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 SetEnabled(bool state);
|
virtual void SetEnabled(bool enable);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void GetContentSize(float* _width, float* _height);
|
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.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Marc Flerackers ([email protected])
|
* Stefano Ceccherini, [email protected]
|
||||||
* Bill Hayden ([email protected])
|
* Marc Flerackers, [email protected]
|
||||||
* Stefano Ceccherini ([email protected])
|
* Bill Hayden, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! Display separator item for BMenu class */
|
|
||||||
|
|
||||||
|
|
||||||
#include <SeparatorItem.h>
|
#include <SeparatorItem.h>
|
||||||
|
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
|
|
||||||
|
|
||||||
BSeparatorItem::BSeparatorItem()
|
BSeparatorItem::BSeparatorItem()
|
||||||
: BMenuItem("", NULL)
|
:
|
||||||
|
BMenuItem("", NULL)
|
||||||
{
|
{
|
||||||
BMenuItem::SetEnabled(false);
|
BMenuItem::SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BSeparatorItem::BSeparatorItem(BMessage* archive)
|
BSeparatorItem::BSeparatorItem(BMessage* data)
|
||||||
: BMenuItem(archive)
|
:
|
||||||
|
BMenuItem(data)
|
||||||
{
|
{
|
||||||
BMenuItem::SetEnabled(false);
|
BMenuItem::SetEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -35,13 +36,13 @@ BSeparatorItem::~BSeparatorItem()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
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)
|
BSeparatorItem::Instantiate(BMessage* archive)
|
||||||
{
|
{
|
||||||
if (validate_instantiation(archive, "BSeparatorItem"))
|
if (validate_instantiation(archive, "BSeparatorItem"))
|
||||||
@@ -52,7 +53,7 @@ BSeparatorItem::Instantiate(BMessage* archive)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BSeparatorItem::SetEnabled(bool state)
|
BSeparatorItem::SetEnabled(bool enable)
|
||||||
{
|
{
|
||||||
// Don't do anything - we don't want to get enabled ever
|
// 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) {
|
if (_height != NULL) {
|
||||||
BFont font(be_plain_font);
|
BFont font(be_plain_font);
|
||||||
if (Menu())
|
if (Menu() != NULL)
|
||||||
Menu()->GetFont(&font);
|
Menu()->GetFont(&font);
|
||||||
|
|
||||||
const float height = floorf((font.Size() * 0.8) / 2) * 2;
|
const float height = floorf((font.Size() * 0.8) / 2) * 2;
|
||||||
*_height = max_c(4, height);
|
*_height = max_c(4, height);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user