Add a first non-functional version of the default media theme.
Implemented all needed functionality in BMediaTheme to use this default theme - it's currently disabled, though (or should be). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3491 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
** Distributed under the terms of the OpenBeOS License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "DefaultMediaTheme.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
#include <ParameterWeb.h>
|
||||||
|
|
||||||
|
|
||||||
|
using namespace BPrivate;
|
||||||
|
|
||||||
|
|
||||||
|
DefaultMediaTheme::DefaultMediaTheme()
|
||||||
|
: BMediaTheme("BeOS Theme", "BeOS built-in theme version 0.1")
|
||||||
|
{
|
||||||
|
CALLED();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BControl *
|
||||||
|
DefaultMediaTheme::MakeControlFor(BParameter *parameter)
|
||||||
|
{
|
||||||
|
CALLED();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BView *
|
||||||
|
DefaultMediaTheme::MakeViewFor(BParameterWeb *web, const BRect *hintRect)
|
||||||
|
{
|
||||||
|
CALLED();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BView *
|
||||||
|
DefaultMediaTheme::MakeViewFor(BParameterGroup *group, const BRect *hintRect)
|
||||||
|
{
|
||||||
|
CALLED();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BControl *
|
||||||
|
DefaultMediaTheme::MakeViewFor(BParameter *parameter, const BRect *hintRect)
|
||||||
|
{
|
||||||
|
switch (parameter->Type()) {
|
||||||
|
case BParameter::B_NULL_PARAMETER:
|
||||||
|
// there is no default view for a null parameter
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
case BParameter::B_DISCRETE_PARAMETER:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BParameter::B_CONTINUOUS_PARAMETER:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
FATAL("BMediaTheme: Don't know parameter type: 0x%lx\n", parameter->Type());
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
+106
-38
@@ -1,44 +1,60 @@
|
|||||||
/***********************************************************************
|
/* Author: Marcus Overhagen
|
||||||
* AUTHOR: Marcus Overhagen
|
** Axel Dörfler, [email protected]
|
||||||
* FILE: MediaTheme.cpp
|
**
|
||||||
* DESCR:
|
** This file may be used under the terms of the OpenBeOS License.
|
||||||
***********************************************************************/
|
*/
|
||||||
|
|
||||||
#include <MediaTheme.h>
|
#include <MediaTheme.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
#include <Locker.h>
|
||||||
|
#include <Autolock.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "DefaultMediaTheme.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
static BLocker sLock;
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* static BMediaTheme variables
|
||||||
|
*************************************************************/
|
||||||
|
|
||||||
|
BMediaTheme * BMediaTheme::_mDefaultTheme;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
* public BMediaTheme
|
* public BMediaTheme
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
|
|
||||||
BMediaTheme::~BMediaTheme()
|
BMediaTheme::~BMediaTheme()
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
CALLED();
|
||||||
|
|
||||||
|
free(_mName);
|
||||||
|
free(_mInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
BMediaTheme::Name()
|
BMediaTheme::Name()
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
return _mName;
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
BMediaTheme::Info()
|
BMediaTheme::Info()
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
return _mInfo;
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
BMediaTheme::ID()
|
BMediaTheme::ID()
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
return _mID;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -52,29 +68,73 @@ BMediaTheme::GetRef(entry_ref *out_ref)
|
|||||||
|
|
||||||
|
|
||||||
BView *
|
BView *
|
||||||
BMediaTheme::ViewFor(BParameterWeb *web,
|
BMediaTheme::ViewFor(BParameterWeb *web, const BRect *hintRect, BMediaTheme *usingTheme)
|
||||||
const BRect *hintRect,
|
|
||||||
BMediaTheme *using_theme)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
CALLED();
|
||||||
return new BStringView(BRect(0,0,200,30), "", "No BMediaTheme, sorry!");
|
|
||||||
|
// use default theme if none was specified
|
||||||
|
|
||||||
|
if (usingTheme == NULL) {
|
||||||
|
BAutolock locker(sLock);
|
||||||
|
|
||||||
|
if (_mDefaultTheme == NULL)
|
||||||
|
_mDefaultTheme = new BPrivate::DefaultMediaTheme();
|
||||||
|
|
||||||
|
//usingTheme = _mDefaultTheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (usingTheme == NULL)
|
||||||
|
return new BStringView(BRect(0, 0, 200, 30), "", "No BMediaTheme available, sorry!");
|
||||||
|
|
||||||
|
return usingTheme->MakeViewFor(web, hintRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaTheme::SetPreferredTheme(BMediaTheme *default_theme)
|
BMediaTheme::SetPreferredTheme(BMediaTheme *defaultTheme)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
CALLED();
|
||||||
|
|
||||||
return B_ERROR;
|
// ToDo: this method should probably set some global settings file
|
||||||
|
// to make the new preferred theme available to all applications
|
||||||
|
|
||||||
|
BAutolock locker(sLock);
|
||||||
|
|
||||||
|
if (defaultTheme == NULL) {
|
||||||
|
// if the current preferred theme is not the default media theme,
|
||||||
|
// delete it, and set it back to the default
|
||||||
|
if (dynamic_cast<BPrivate::DefaultMediaTheme *>(_mDefaultTheme) == NULL)
|
||||||
|
_mDefaultTheme = new BPrivate::DefaultMediaTheme();
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this method takes possession of the BMediaTheme passed, even
|
||||||
|
// if it fails, so it has to delete it
|
||||||
|
if (defaultTheme != _mDefaultTheme)
|
||||||
|
delete _mDefaultTheme;
|
||||||
|
|
||||||
|
_mDefaultTheme = defaultTheme;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BMediaTheme *
|
BMediaTheme *
|
||||||
BMediaTheme::PreferredTheme()
|
BMediaTheme::PreferredTheme()
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
CALLED();
|
||||||
return NULL;
|
|
||||||
|
BAutolock locker(sLock);
|
||||||
|
|
||||||
|
// ToDo: should look in the global prefs file for the preferred
|
||||||
|
// add-on and load this from disk - in the meantime, just use
|
||||||
|
// the default theme
|
||||||
|
|
||||||
|
if (_mDefaultTheme == NULL)
|
||||||
|
_mDefaultTheme = new BPrivate::DefaultMediaTheme();
|
||||||
|
|
||||||
|
return _mDefaultTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -90,7 +150,7 @@ rgb_color
|
|||||||
BMediaTheme::BackgroundColorFor(bg_kind bg)
|
BMediaTheme::BackgroundColorFor(bg_kind bg)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
rgb_color dummy = {0,0,0};
|
rgb_color dummy = {0, 0, 0};
|
||||||
|
|
||||||
return dummy;
|
return dummy;
|
||||||
}
|
}
|
||||||
@@ -100,31 +160,44 @@ rgb_color
|
|||||||
BMediaTheme::ForegroundColorFor(fg_kind fg)
|
BMediaTheme::ForegroundColorFor(fg_kind fg)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
rgb_color dummy = {255,255,255};
|
rgb_color dummy = {255, 255, 255};
|
||||||
|
|
||||||
return dummy;
|
return dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
* protected BMediaTheme
|
* protected BMediaTheme
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
|
|
||||||
BMediaTheme::BMediaTheme(const char *name,
|
|
||||||
const char *info,
|
BMediaTheme::BMediaTheme(const char *name, const char *info, const entry_ref *ref, int32 id)
|
||||||
const entry_ref *add_on,
|
:
|
||||||
int32 theme_id)
|
_mID(id)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
_mName = strdup(name);
|
||||||
|
_mInfo = strdup(info);
|
||||||
|
|
||||||
|
// ToDo: is there something else here, which has to be done?
|
||||||
|
|
||||||
|
if (ref) {
|
||||||
|
_mAddOn = true;
|
||||||
|
_mAddOnRef = *ref;
|
||||||
|
} else
|
||||||
|
_mAddOn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BControl *
|
BControl *
|
||||||
BMediaTheme::MakeFallbackViewFor(BParameter *control)
|
BMediaTheme::MakeFallbackViewFor(BParameter *parameter)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
if (parameter == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
return BPrivate::DefaultMediaTheme::MakeViewFor(parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
* private BMediaTheme
|
* private BMediaTheme
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
@@ -145,8 +218,3 @@ status_t BMediaTheme::_Reserved_ControlTheme_5(void *) { return B_ERROR; }
|
|||||||
status_t BMediaTheme::_Reserved_ControlTheme_6(void *) { return B_ERROR; }
|
status_t BMediaTheme::_Reserved_ControlTheme_6(void *) { return B_ERROR; }
|
||||||
status_t BMediaTheme::_Reserved_ControlTheme_7(void *) { return B_ERROR; }
|
status_t BMediaTheme::_Reserved_ControlTheme_7(void *) { return B_ERROR; }
|
||||||
|
|
||||||
/*************************************************************
|
|
||||||
* static BMediaTheme variables
|
|
||||||
*************************************************************/
|
|
||||||
|
|
||||||
BMediaTheme * BMediaTheme::_mDefaultTheme;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user