* The "no theme available" string is now resized as needed.

* Rewrote header, cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19170 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-11-02 12:54:33 +00:00
parent 7ca295180f
commit 9d00b1d56d
2 changed files with 101 additions and 141 deletions
+51 -78
View File
@@ -1,17 +1,8 @@
/*******************************************************************************
/
/ File: ControlTheme.h
/
/ Description: A BMediaTheme is something which can live in an add-on and is
/ responsible for creating BViews or BControls from a BParameterWeb and its
/ set of BMControls. This way, different "looks" for Media Kit control panels
/ can be achieved.
/
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_CONTROL_THEME_H)
/*
* Copyright 2006, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CONTROL_THEME_H
#define _CONTROL_THEME_H
@@ -21,30 +12,22 @@
class BParameterWeb;
class BMediaTheme
{
public:
virtual ~BMediaTheme();
class BMediaTheme {
public:
virtual ~BMediaTheme();
const char * Name();
const char * Info();
const char* Name();
const char* Info();
int32 ID();
bool GetRef(
entry_ref * out_ref);
bool GetRef(entry_ref* ref);
static BView * ViewFor(
BParameterWeb * web,
const BRect * hintRect = NULL,
BMediaTheme * using_theme = NULL);
static BView* ViewFor(BParameterWeb* web, const BRect* hintRect = NULL,
BMediaTheme* usingTheme = NULL);
/* This function takes possession of default_theme, even it if returns error */
static status_t SetPreferredTheme(
BMediaTheme * default_theme = NULL);
static status_t SetPreferredTheme(BMediaTheme* defaultTheme = NULL);
static BMediaTheme* PreferredTheme();
static BMediaTheme * PreferredTheme();
virtual BControl * MakeControlFor(
BParameter * control) = 0;
virtual BControl* MakeControlFor(BParameter* control) = 0;
enum bg_kind {
B_GENERAL_BG = 0,
@@ -63,60 +46,50 @@ virtual BControl * MakeControlFor(
B_HILITE_FG
};
virtual BBitmap * BackgroundBitmapFor(
bg_kind bg = B_GENERAL_BG);
virtual rgb_color BackgroundColorFor(
bg_kind bg = B_GENERAL_BG);
virtual rgb_color ForegroundColorFor(
fg_kind fg = B_GENERAL_FG);
virtual BBitmap* BackgroundBitmapFor(bg_kind bg = B_GENERAL_BG);
virtual rgb_color BackgroundColorFor(bg_kind bg = B_GENERAL_BG);
virtual rgb_color ForegroundColorFor(fg_kind fg = B_GENERAL_FG);
protected:
BMediaTheme(
const char * name,
const char * info,
const entry_ref * add_on = 0,
int32 theme_id = 0);
protected:
BMediaTheme(const char* name, const char* info,
const entry_ref* addOn = NULL, int32 themeID = 0);
virtual BView * MakeViewFor(
BParameterWeb * web,
const BRect * hintRect = NULL) = 0;
virtual BView* MakeViewFor(BParameterWeb* web,
const BRect* hintRect = NULL) = 0;
static BControl * MakeFallbackViewFor(
BParameter * control);
private:
static BControl* MakeFallbackViewFor(BParameter* control);
private:
BMediaTheme(); /* private unimplemented */
BMediaTheme(
const BMediaTheme & clone);
BMediaTheme & operator=(
const BMediaTheme & clone);
BMediaTheme(const BMediaTheme& other);
BMediaTheme& operator=(const BMediaTheme& other);
/* Mmmh, stuffing! */
virtual status_t _Reserved_ControlTheme_0(void *);
virtual status_t _Reserved_ControlTheme_1(void *);
virtual status_t _Reserved_ControlTheme_2(void *);
virtual status_t _Reserved_ControlTheme_3(void *);
virtual status_t _Reserved_ControlTheme_4(void *);
virtual status_t _Reserved_ControlTheme_5(void *);
virtual status_t _Reserved_ControlTheme_6(void *);
virtual status_t _Reserved_ControlTheme_7(void *);
virtual status_t _Reserved_ControlTheme_0(void *);
virtual status_t _Reserved_ControlTheme_1(void *);
virtual status_t _Reserved_ControlTheme_2(void *);
virtual status_t _Reserved_ControlTheme_3(void *);
virtual status_t _Reserved_ControlTheme_4(void *);
virtual status_t _Reserved_ControlTheme_5(void *);
virtual status_t _Reserved_ControlTheme_6(void *);
virtual status_t _Reserved_ControlTheme_7(void *);
char * _mName;
char * _mInfo;
int32 _mID;
bool _mAddOn;
entry_ref _mAddOnRef;
uint32 _reserved_control_theme_[8];
char* fName;
char* fInfo;
int32 fID;
bool fIsAddOn;
entry_ref fAddOnRef;
static BMediaTheme * _mDefaultTheme;
uint32 _reserved[8];
static BMediaTheme* sDefaultTheme;
};
/* Theme add-ons should export the functions: */
#if defined(_BUILDING_THEME_ADDON)
extern "C" _EXPORT BMediaTheme * make_theme(int32 id, image_id you);
extern "C" _EXPORT status_t get_theme_at(int32 n, const char ** out_name, const char ** out_info, int32 * out_id);
#endif /* _BUILDING_THEME_ADDON */
#endif /* _CONTROL_THEME_H */
// Theme add-ons should export these functions:
#if defined(_BUILDING_THEME_ADDON)
extern "C" BMediaTheme* make_theme(int32 id, image_id you);
extern "C" status_t get_theme_at(int32 index, const char** _name,
const char** _info, int32* _id);
#endif // _BUILDING_THEME_ADDON
#endif // _CONTROL_THEME_H