⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kr_kpage.h

📁 这是法国Kaleido公司提供了一个手机mmi设计平台
💻 H
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************
						KR_KPage.h  -  
						-------------------
	begin                : Tue Mar 3 2004
	copyright            : (C) 2004 by DigitalAirways
	email                : info@digitalairways.com
***************************************************************************/

/*
* Copyright (c) 2000-2004 DigitalAirways, sarl. All Rights Reserved.
*
* 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.
*/

/*
**************************************************************
* TODO
**************************************************************

- 



**************************************************************
* HISTORY
**************************************************************

- 
*/

#ifndef __KR_KPAGE__
#define __KR_KPAGE__

#include "SmallArrayList.h"

#include "EB_GContext.h"
#include "KR_KRuntime.h"
#include "KR_Option.h"
#include "KR_Group.h"
#include "KR_View.h"
#include "KR_Comparator.h"

#define UPDOWN		0
#define RIGHTLEFT	2


class StampComparator :public Comparator {
	public:
		
		DEFINE_NEW(StampComparator);
		DEFINE_DELETE(StampComparator);	
		StampComparator() {}
		virtual ~StampComparator() {}
		virtual long compare(void* arg0, void* arg1) ;
		virtual boolean equals(void* /*obj*/) {
			return false;
			}
	};

class Option4ActionNode : public LinkedListNode {

protected:

		Option* fOption;
		long fAction;

public:
		
		DEFINE_NEW(Option4ActionNode);
		DEFINE_DELETE(Option4ActionNode);	

		Option4ActionNode() : LinkedListNode () {
			fOption=NULL;
			fAction=0;
		}

		/**
		returns info associated to the given key
			*/
		static Option* find (BigIntMap* map, long action) {
			
			Option4ActionNode* current = (Option4ActionNode*)map->getFirst();
			
			while (current != NULL) {
				if (current->fAction != action)
					current = (Option4ActionNode*)current->getNext();
				else {
					// found
					return current->fOption;
				}
			}
			// not found
			return NULL;
		 }

	};


class KREBDLIBS_API KPage {

	friend class KRContext;
	friend class GContext;
	friend class EBContext;
	friend class Group;
	friend class Option;
	friend class Layout;

protected:

	GContext* fContext ;	// Global context
	Layout* fLayout ; // Layout that is owning this page
	long fRestoredFileVersion;
	
	// --- Page information ---
	char* fName; // Layout Name in KDesign->
	long fSaveNumber;
	long fModelBuildNumber;
	long fLoaderMsgType ; // Type of the message that has loaded this layout
	SmallArrayList* /* Group* */	fGroupArray; //  to allow external exploration without the cost of accessors->
	SmallArrayList* /* View */	fViewArray;
	Group* fInitialGroup;
	
	boolean fMileStone;
	LinksJumpMap* /* char* */ fLinksJumpTable;
	long fAcceptKey;
	
	// --- Activation information ---
	long fPreviousActivateBaseStamp;
	long fActivateBaseStamp;
	long fActivateStamp;
	SmallArrayList* /* Option* */ fHistory; 
	
	Option4ActionMap* /* Option* */ fOptionForAction;
	Option4AccessKeyMap* /* Option* */ fOptionForAccessKey;
	BigIntMap* /* Slot* */ fSlotForAccessKey;
	
	boolean fShouldBeRendered;

	StampComparator* fComparator;
	
	boolean fBreakAction;

private:
		
	void restoreObjects(Serializer* serializer, int nb, ObjectReader* reader);
	 
	void newActivation();
	 
	 long getPreviousActivateBaseStamp() {
			  return fPreviousActivateBaseStamp;
	 }
	 
	 long getActivateBaseStamp() {
			  return fActivateBaseStamp;
	 }
	 
	 long getNextActivateStamp() {
			  return fActivateStamp++;
	 }
	 
	 void render()  ;
	 
	 void HistoryActivate()  ;

protected:

	// takes v ownership
	void setSlotForAccessKey(BigIntMap* v) {
		fSlotForAccessKey=v;
	}

	// does NOT give up ownership
	BigIntMap* getSlotForAccessKey() {
		return fSlotForAccessKey;
	}


public:

	DEFINE_NEW(KPage);
	DEFINE_DELETE(KPage);	

	KPage(GContext* newGContext) ;	

	void init(long nbGroup, long nbView);

	virtual ~KPage();

#ifdef DEV_DEBUG
	void verboseGroups();
	char* renderStr()  ;
#endif // def DEV_DEBUG
	 


	void activate();

	void activateLoop();
	 
	boolean doAction(long actionid, char* value);

	void setLayout(Layout* newLayout) { 
		fLayout = newLayout; 
	}

	Layout* getLayout(){ 
		return fLayout; 
	}

	/*
<kaleidoc>
<filename>KPage</filename>
<page>
<api>
    <class>KPage</class>
    <method>getLoaderMsgType</method>
    <java></java>
    <cpp>long getLoaderMsgType()</cpp>
    <descr>
    <p>The method returns the type of the message that was being processed when this object was instanciated.</p>
    </descr>
</api>
</page>
</kaleidoc>
*/
	long getLoaderMsgType() { 
		return fLoaderMsgType ; 
		}

	//deprecated
	void setBootstrapGroup(Group* g) {
		fInitialGroup=g;
	}

	void setInitialGroup(Group* g) {
		fInitialGroup=g;
	}

	Group* getInitialGroup() {
		return fInitialGroup;
	}

/*
<kaleidoc>
<filename>KPage</filename>
<page>
<api>
    <class>KPage</class>
    <method>navigate</method>
    <java>final public void navigate(String url) throws Throwable</java>
    <cpp>void navigate(char* url)</cpp>
    <descr>
    <p>Navigates to the layout with the given url. </p>
        <p>KPage.navigate() posts a MSG_LOADLAYOUT as before, and more:
            it calls Group.aboutToNavigate() method for each group and each group's populator GroupPopulator.aboutToNavigate().
            This gives the opportunity to get code be called before the layout switches.</p>
        <p>If a populator is associated to the group, overriding GroupPopulator.aboutToNavigate() is easy.
            If not, a Group Plugin should be done and Group.aboutToNavigate() should be overriden.</p>
            <p>KPage.navigate() should not be overriden but may be called directly by a KPage.navigate()-like function.</p>
        <p>A particular value "back" as the URL provides the back.</p>
        <code>getPage()->navigate("back");</code>
        <p>Another particular value "null" as the URL provides a no-navigate action. This allows to take advantage of unloadable layouts.
            This also allows to disable a global jumplink at the layout level by registering a local jumplink with "null" as target layout name.</p>
        <note>In these cases,  aboutToNavigate() methods are also called.</note>

    </descr>
</api>
</page>
</kaleidoc>
*/
	void navigate(char* url, char* accept, char* agent) ;
	void navigate(char* url)  { 
		navigate(url, NULL, NULL); 
		}
	
	void aboutToNavigate();
	
	void resetBeforeUse();

#ifdef USE_DEPRECATED
	void resetOptions() {
		deleteOptions();
		}
#endif

	/*
<kaleidoc>
<filename>KPage</filename>
<page>
<api>
   <class>KPage</class>
   <method>deleteOptions</method>
   <cpp>void deleteOptions()</cpp>
   <java>final public void deleteOptions()</java>
   <descr>
       <p>Group.deleteOptions() deletes the options in the Group's cache.
			 If a populator is associated, needed options will be generated again.
           KPage.deleteOptions() calls this method for all groups.</p>
   </descr>
   <notes></notes>
   <examples></examples>
</api>
</page>
</kaleidoc>
*/
	void deleteOptions();

#ifdef USE_DEPRECATED
	void resetLazy() {
		deleteLazy();
		}
	void deleteLazy();
#endif

	/*
<kaleidoc>
<filename>KPage</filename>
<page>
<api>
 <class>KPage</class>
 <method>deleteLazyOptions</method>
 <cpp>void deleteLazyOptions()</cpp>
 <java></java>
 <descr>
     <p>Group.deleteLazyOptions() deletes only options that comes from a populator and are not in the accept History. Thus, the latter options will not be refreshed since they are not deleted.
         KPage.deleteLazyOptions() calls Group.deleteLazyOptions() for all groups.</p>
 </descr>
 <notes></notes>
 <examples></examples>
</api>
</page>
</kaleidoc>
*/
	void deleteLazyOptions();

	int restore(ObjectReader* reader, int version);

	/*
<kaleidoc>
<filename>KPage</filename>
<page>
<api>
    <class>KPage</class>
    <method>getGroup</method>
    <java>Group getGroup(String name)</java>
    <cpp>Group* getGroup(char* name)</cpp>
    <descr>
    <p>Returns a reference to an instantiated Group from its name, or NULL if such a Group does not exist.</p>
    </descr>
</api>
</page>
</kaleidoc>
*/
	Group* getGroup(char* name);
	void registerGroup(Group* g);
	void registerView(View* v);
/*
<kaleidoc>
<filename>KPage</filename>
<page>
<api>
    <class>KPage</class>
    <method>getView</method>
    <java>View getView(String name)</java>
    <cpp>View* getView(char* name)</cpp>
    <descr>
    <p>Returns a reference to an instantiated View from its name, or NULL if such a View does not exist.</p>
    </descr>
</api>
</page>
</kaleidoc>
*/
	View* getView(char* name);

	/*
<kaleidoc>
<filename>KPage</filename>
<page>
<api>
    <class>KPage</class>
    <method>setShouldBeRendered</method>
    <java>void setShouldBeRendered(boolean isOutdated)</java>
    <cpp>void setShouldBeRendered(boolean isOutdated)</cpp>
    <descr>
    <p>Invalidates the current state because the page has been changed. The layout page should be rendered to update the display.</p>
    </descr>
</api>
</page>
</kaleidoc>
*/
	 boolean shouldBeRendered() {
		 return fShouldBeRendered;
	 }
	 
	 void setShouldBeRendered(boolean v) {
		 fShouldBeRendered = v;
	 }
	 
/*
<kaleidoc>
<filename>KPage</filename>
<page>
<api>
    <class>KPage</class>
    <method>setBreakAction</method>
    <java>public final void  setBreakAction(boolean v)</java>
    <cpp>void setBreakAction(boolean v)</cpp>
    <descr>
    <p>This method sets the breakAction Flag. When set, it breaks the KPage.doAction() process and makes other following action handler not handling the action.
The breakAction flag can be tested with a call to KPage.isBreakAction()</p>
    </descr>
</api>
</page>
</kaleidoc>
*/
	 void setBreakAction(boolean v) {
		 fBreakAction = v;
	 }
	 
/*
<kaleidoc>
<filename>KPage</filename>
<page>
<api>
    <class>KPage</class>
    <method>isBreakAction</method>
    <java>public final boolean isBreakAction()</java>
    <cpp>boolean isBreakAction()</cpp>
    <descr>
    <p>Returns true if the breakAction Flag is set.</p>
     </descr>
</api>
</page>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -