?? eb_ebcontext.h
字號:
/*
* Created on 24 may 2004
*
* @author DigitalAirways (c) 2004
*
* This software is the confidential and proprietary information of
* DigitalAirways, sarl. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with DigitalAirways.
* A copy of this license is included in the licence.txt file included
* in this software package.
*
*/
#ifndef __EB_EBCONTEXT__
#define __EB_EBCONTEXT__
#include "KR_Object.h"
#include "SmallArrayList.h"
#include "EB_Defs.h"
#include "EB_CacheManager.h"
class GContext ;
class KRMessage ;
class Layout ;
class KeyProxy ;
class PFWImage ;
class Graphics;
#ifdef FONT_CACHE
#include "EB_Font.h"
#endif // def FONT_CACHE
typedef int (*messageProcessor) (GContext* gContext, KRMessage* msg) ;
typedef boolean (*layoutSwitchHandler) (GContext* gContext, Layout* newLayout) ;
typedef void* (*instanciatorGetter) (char* className, int* classType, SmallArrayList* instantiatorTables) ;
// These flags are used to define the informations that must be displayed
// by calls to analyzeLayout(...)
// To display only cached options
#define DMP_LAYOUT_CACHEDOPTIONS 0x00000001
// To display only slotted options
#define DMP_LAYOUT_SLOTTEDOPTIONS 0x00000002
// To display only options' captions
#define DMP_LAYOUT_CAPTIONS 0x00000004
// To display the group's class getInfo() data
#define DMP_LAYOUT_INTRO_GROUP 0x00000100
// To display the group's populator's class getInfo() data
#define DMP_LAYOUT_INTRO_GPOPULATOR 0x00000200
// To display the option's class getInfo() data
#define DMP_LAYOUT_INTRO_OPTION 0x00000400
// To display the option's jitmapper getInfo() data
#define DMP_LAYOUT_INTRO_OJITMAPPER 0x00000800
// Useful aggregations
#define DMP_LAYOUT_INTRO_ALL (DMP_LAYOUT_INTRO_GROUP | DMP_LAYOUT_INTRO_GPOPULATOR | DMP_LAYOUT_INTRO_OPTION | DMP_LAYOUT_INTRO_OJITMAPPER)
class KREBDLIBS_API EBContext
{
private:
GContext* gContext ;
// Used by global store
#ifdef GSHASH
HashTable* fGlobalStore;
#else
SmallArrayList* sfKeys;
SmallArrayList* sfValues;
#endif
// Browsing history
char *historyURLs[MAX_HISTORY] ;
unsigned long historyVals[MAX_HISTORY] ;
unsigned long historyFlags[MAX_HISTORY] ;
int historyNum ;
// Message processor
messageProcessor msgProcessor ;
// InstanciatorGetter
instanciatorGetter currentInstanciatorGetter ;
// InstanciatorTables
SmallArrayList* instantiatorTables ;
// Current time manager
KALEIDO_TIME_TYPE currentTime ;
// Current Layout
layoutSwitchHandler localLayoutSwitchHandler ;
Layout *currentLayout;
// Current KeyProxy
KeyProxy* currentKeyProxy;
// Font caches
#ifdef FONT_CACHE
Font* cachedFontData[FONT_CACHE_LEN];
char* cachedFontName[FONT_CACHE_LEN];
int cachedFontNum ;
#endif // def FONT_CACHE
// Image pool
ObjectPool* imagePool;
// This is a pointer to the current screen's Graphics
Graphics* screenGraphics ;
// This is a pointer to the last realized snapshot of the current screen
PFWImage* lastSnapshot ;
//
void setStackValue(int index , unsigned long val, unsigned long flag) ;
void updateHistoryStack(Layout* previousLayout);
public:
DEFINE_NEW(EBContext);
DEFINE_DELETE(EBContext);
EBContext(GContext* newGContext);
~EBContext();
// Current screen's Graphics
void setCurrentScreenGraphics(Graphics* newScreenGraphics) ;
Graphics* getCurrentScreenGraphics() ;
#ifndef GSHASH
// Used by global store
int findKeyIndex(char* key);
#endif
// See EB_GContext for parameters info.
void addData(char* key, void* value) ;
void replaceData(char* key, void* value) ;
void replaceObjectData(char* key, void* value);
void replaceMemData(char* key, void* value) ;
void replaceIntData(char* key, void* value) ;
void* findData(char* key) ;
int findData(char* key, int defValue) ;
void removeData(char* key) ;
#ifndef GSHASH
void removeData(long i) ;
#endif
void takeDatas(char* keyBegin) ;
void packDatas(boolean verbose);
void* takeData(char* key);
#ifndef GSHASH
void changeDataKey(char* key, char* newkey) ;
#endif
#ifdef DEV_DEBUG
void dumpData();
void analyzeLayout(int verbosity, int level, Layout* layout);
#endif // def DEV_DEBUG
// Browsing history
void stackURL(char* url) ;
/**
* loads the specified url in the current browser with the specified user-
* agent and accept header
* @param url the url to load
* @param accept the value of the accept header
* @param userAgent the value of the user-agent header
*/
void loadLayout(char* url,char* accept, char* userAgent);
//
void backLayout();
void deleteHistory(int index, int keepValue=false);
void flushHistory() ;
void unstackHistory() ;
#ifdef DEV_DEBUG
void dumpHistory() ;
#endif // def DEV_DEBUG
void setCurrentStackValue(unsigned long val, unsigned long flag) ;
int getHistoryNum() { return historyNum ;}
unsigned long getCurrentStackValue(unsigned long *flag=NULL) ;
unsigned long getPreviousStackValue(unsigned long defValue, unsigned long *flag=NULL) ;
void getStackContent( int index, char** newHistoryURLs, unsigned long* newHistoryVals, unsigned long* newHistoryFlags) ;
// Message processor
void setMessageProcessor(messageProcessor newMsgProcessor)
{ msgProcessor = newMsgProcessor ; }
int processMessage(KRMessage* msg);
// InstanciatorGetter
void setInstanciatorGetter(instanciatorGetter newInstanciatorGetter)
{currentInstanciatorGetter=newInstanciatorGetter;}
instanciatorGetter getInstanciatorGetter()
{return currentInstanciatorGetter;}
// InstantiatorTables
void setInstantiatorTables(SmallArrayList* newInstantiatorTables)
{ instantiatorTables = newInstantiatorTables ; }
SmallArrayList* getInstantiatorTables()
{ return instantiatorTables; }
// Current time manager
void setCurrentTime(KALEIDO_TIME_TYPE newCurrentTime)
{ currentTime=newCurrentTime ; }
KALEIDO_TIME_TYPE getCurrentTime()
{ return currentTime; }
// Current Layout
void setLayoutSwitchHandler(layoutSwitchHandler newLayoutSwitchHandler)
{localLayoutSwitchHandler = newLayoutSwitchHandler ;}
boolean setCurrentLayout(Layout* newCurrentLayout) ;
Layout* getCurrentLayout()
{ return currentLayout; }
// Current KeyProxy
void setCurrentKeyProxy(KeyProxy* newCurrentKeyProxy)
{ currentKeyProxy = newCurrentKeyProxy ; }
KeyProxy* getCurrentKeyProxy()
{ return currentKeyProxy; }
// Font caches
#ifdef FONT_CACHE
Font* getCachedFont(char* newFont);
/*
*/
void putCachedFont(char* newFontName, Font* newFontData);
#endif // def FONT_CACHE
// Image pool
//
ObjectPool* getImagePool(void)
{ return imagePool; }
Graphics* getPooledImage(unsigned char* src);
//
// int getPooledImage(Graphics* data) ;
//
void putPooledImage(unsigned char* src, Graphics* img, objectDestructor dtor);
// Return -1 when img has not been found in the pool.
int derefPooledImage(Graphics* img, boolean flushIfUnreferenced);
void checkPendingGraphics() ;
// Snapshots management
// Create a copy of the current screen content.
void makeSnapshot() ;
//
PFWImage* getLastSnapshot()
{ return lastSnapshot ; }
// PFWGraphics factory
Graphics* createGraphics();
Graphics* createGraphics(int width, int height, int onScreen);
Graphics* createGraphics(unsigned char* src);
} ;
#endif // ndef __EB_EBCONTEXT__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -