зеркало из https://github.com/mozilla/pjs.git
Demo UI stuff and support for application/ui in DTD and parser
This commit is contained in:
Родитель
54ecbf4d5c
Коммит
262fdb8beb
|
@ -814,8 +814,6 @@ nsresult nsCalendarShell::LoadUI()
|
|||
res = mDocumentContainer->LoadURL(pUI,nsnull);
|
||||
mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_JULIAN_UI_XML_CALENDAR,pUI,&i);
|
||||
res = mDocumentContainer->LoadURL(pUI,nsnull);
|
||||
mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_JULIAN_UI_XML_TOOLBAR,pUI,&i);
|
||||
res = mDocumentContainer->LoadURL(pUI,nsnull);
|
||||
#endif
|
||||
|
||||
mShellInstance->ShowApplicationWindow(PR_TRUE) ;
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" standalone="no" encoding="UTF-8"?>
|
||||
<!DOCTYPE julian SYSTEM "http://kirkwood.mcom.com/julian.dtd">
|
||||
<Calendar>
|
||||
|
||||
<!-- This is the User Heading Rule -->
|
||||
<panel name="UserHeadingRule" >
|
||||
<tcc backgroundcolor="#C0C0C0" foregroundcolor="#0000FF" name="PrevDay" orientation="west" control="MultiCalendarEventWeekView" major="tbh" usectxrule="day-1" weightminor="0" weightmajor="0"/>
|
||||
<object class="timebaruserheading" backgroundcolor="#C0C0C0" name="tuh" title="Julian Calendar 0.1" weightmajor="1"/>
|
||||
<tcc foregroundcolor="#0000FF" backgroundcolor="#C0C0C0" name="NextDay" orientation="east" control="MultiCalendarEventWeekView" usectxrule="day+1" weightminor="0" weightmajor="0"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the Timebar Scale Rule -->
|
||||
<panel name="ScaleViewRule">
|
||||
<tcc foregroundcolor="#0000FF" name="PrevHour" orientation="north" control="MultiCalendarEventWeekView" usectxrule="hour-1" weightminor="0" weightmajor="0"/>
|
||||
<timebarscale name="TimebarScale" weightminor="0" weightmajor="1"/>
|
||||
<tcc foregroundcolor="#0000FF" name="NextHour" orientation="south" control="MultiCalendarEventWeekView" usectxrule="hour+1" weightminor="0" weightmajor="0"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the MonthController and Todo List -->
|
||||
<panel name="ToDoCalViewRule">
|
||||
<mcc name="MiniCalendar" control="MultiCalendarEventWeekView" usectxrule="DayList"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the MultiDayView and Command Bar -->
|
||||
<panel name="MultiDayViewRule">
|
||||
<multidayviewcanvas name="MultiCalendarEventWeekView" control="MiniCalendar" repeatable="DayContext" minrepeat="1" maxrepeat="1" count="1" >
|
||||
</panel>
|
||||
|
||||
|
||||
<!-- This is the MultiDay, Scale and Todo together -->
|
||||
<panel name="MultiCalendarEventWeekViewPanel">
|
||||
<control rule="ScaleViewRule" layout="ybox" weightmajor="0" weightminor="0"/>
|
||||
<control rule="MultiDayViewRule" layout="ybox" width="400" weightmajor="1"/>
|
||||
<control rule="ToDoCalViewRule" layout="ybox" weightmajor="0" weightminor="0"/>
|
||||
</panel>
|
||||
|
||||
|
||||
<!-- This is the user header with the big Multi One -->
|
||||
<panel id="MultiCalendarUserEventWeekView" label="Day View">
|
||||
<control id="uhr" rule="UserHeadingRule" layout="xbox" weightminor="0" weightmajor="0"/>
|
||||
<control id="mcewv" rule="MultiCalendarEventWeekViewPanel" layout="xbox"/>
|
||||
</panel>
|
||||
|
||||
<!-- Calendar with Folder Views -->
|
||||
<panel id="CalendarAndFolder" label="CalendarAndFolder">
|
||||
<control id="mcuewv" rule="MultiCalendarUserEventWeekView" layout="ybox"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the root GUI panel. This is where life begins -->
|
||||
<rootpanel id="MainCalendarPanel" label="Calendar UI">
|
||||
<control id="uhr" rule="CalendarAndFolder" layout="xbox"/>
|
||||
<ctx id="StartContext" majorinterval="PT01H" minorinterval="PT15M" default="today"/>
|
||||
</rootpanel>
|
||||
|
||||
|
||||
</Calendar>
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" standalone="no" encoding="UTF-8"?>
|
||||
<!DOCTYPE julian SYSTEM "http://kirkwood.mcom.com/julian.dtd">
|
||||
<Calendar>
|
||||
|
||||
<!-- This is the User Heading Rule -->
|
||||
<panel name="UserHeadingRule" >
|
||||
<tcc backgroundcolor="#C0C0C0" foregroundcolor="#0000FF" name="PrevDay" orientation="west" control="MultiCalendarEventWeekView" major="tbh" usectxrule="day-1" weightminor="0" weightmajor="0"/>
|
||||
<object class="timebaruserheading" backgroundcolor="#C0C0C0" name="tuh" title="Julian Calendar 0.1" weightmajor="1"/>
|
||||
<tcc foregroundcolor="#0000FF" backgroundcolor="#C0C0C0" name="NextDay" orientation="east" control="MultiCalendarEventWeekView" usectxrule="day+1" weightminor="0" weightmajor="0"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the Timebar Scale Rule -->
|
||||
<panel name="ScaleViewRule">
|
||||
<tcc foregroundcolor="#0000FF" name="PrevHour" orientation="north" control="MultiCalendarEventWeekView" usectxrule="hour-1" weightminor="0" weightmajor="0"/>
|
||||
<timebarscale name="TimebarScale" weightminor="0" weightmajor="1"/>
|
||||
<tcc foregroundcolor="#0000FF" name="NextHour" orientation="south" control="MultiCalendarEventWeekView" usectxrule="hour+1" weightminor="0" weightmajor="0"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the MonthController and Todo List -->
|
||||
<panel name="ToDoCalViewRule">
|
||||
<mcc name="MiniCalendar" control="MultiCalendarEventWeekView" usectxrule="DayList"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the MultiDayView and Command Bar -->
|
||||
<panel name="MultiDayViewRule">
|
||||
<multidayviewcanvas name="MultiCalendarEventWeekView" control="MiniCalendar" repeatable="DayContext" minrepeat="1" maxrepeat="17" >
|
||||
</panel>
|
||||
|
||||
|
||||
<!-- This is the MultiDay, Scale and Todo together -->
|
||||
<panel name="MultiCalendarEventWeekViewPanel">
|
||||
<!-- <control rule="FolderViewRule" layout="ybox" weightmajor="0" weightminor="0"/> -->
|
||||
<control rule="ScaleViewRule" layout="ybox" weightmajor="0" weightminor="0"/>
|
||||
<control rule="MultiDayViewRule" layout="ybox" width="400" weightmajor="1"/>
|
||||
<control rule="ToDoCalViewRule" layout="ybox" weightmajor="0" weightminor="0"/>
|
||||
</panel>
|
||||
|
||||
|
||||
<!-- This is the user header with the big Multi One -->
|
||||
<panel id="MultiCalendarUserEventWeekView" label="Day View">
|
||||
<control id="uhr" rule="UserHeadingRule" layout="xbox" weightminor="0" weightmajor="0"/>
|
||||
<control id="mcewv" rule="MultiCalendarEventWeekViewPanel" layout="xbox"/>
|
||||
</panel>
|
||||
|
||||
<!-- Calendar with Folder Views -->
|
||||
<panel id="CalendarAndFolder" label="CalendarAndFolder">
|
||||
<!--
|
||||
<control rule="FolderViewRule" layout="ybox" weightminor="0" weightmajor="0"/>
|
||||
-->
|
||||
<control id="mcuewv" rule="MultiCalendarUserEventWeekView" layout="ybox"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the root GUI panel. This is where life begins -->
|
||||
<rootpanel id="MainCalendarPanel" label="Calendar UI">
|
||||
<control id="uhr" rule="CalendarAndFolder" layout="xbox"/>
|
||||
<ctx id="StartContext" majorinterval="PT01H" minorinterval="PT15M" default="today"/>
|
||||
</rootpanel>
|
||||
|
||||
|
||||
</Calendar>
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" standalone="no" encoding="UTF-8"?>
|
||||
<!DOCTYPE julian SYSTEM "http://kirkwood.mcom.com/julian.dtd">
|
||||
<Calendar>
|
||||
|
||||
<!-- This is the User Heading Rule -->
|
||||
<panel name="UserHeadingRule" >
|
||||
<tcc backgroundcolor="#C0C0C0" foregroundcolor="#0000FF" name="PrevDay" orientation="west" control="MultiCalendarEventWeekView" major="tbh" usectxrule="day-1" weightminor="0" weightmajor="0"/>
|
||||
<object class="timebaruserheading" backgroundcolor="#C0C0C0" name="tuh" title="Julian Calendar 0.1" weightmajor="1"/>
|
||||
<tcc foregroundcolor="#0000FF" backgroundcolor="#C0C0C0" name="NextDay" orientation="east" control="MultiCalendarEventWeekView" usectxrule="day+1" weightminor="0" weightmajor="0"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the HTML Pane -->
|
||||
<panel name="FolderViewRule">
|
||||
<object class="timebaruserheading" backgroundcolor="#C0C0C0" title="Folders" weightmajor="0"/>
|
||||
<foldercanvas >
|
||||
<xpitem label="Trex" halign="left" valign="bottom" fullimage="resource://res/ui/trex_full.gif" />
|
||||
<xpitem label="Inbox" halign="left" valign="bottom" fullimage="resource://res/ui/inbox_full.gif" />
|
||||
<xpitem label="Outbox" halign="left" valign="bottom" fullimage="resource://res/ui/outbox_full.gif" />
|
||||
<xpitem label="Sent" halign="left" valign="bottom" fullimage="resource://res/ui/sent_full.gif" />
|
||||
<xpitem label="Trash" halign="left" valign="bottom" fullimage="resource://res/ui/trash_full.gif" />
|
||||
<xpitem label="Portal" halign="left" valign="bottom" fullimage="resource://res/ui/portal_full.gif" />
|
||||
<xpitem label="Mail" halign="left" valign="bottom" fullimage="resource://res/ui/mail_full.gif" />
|
||||
<xpitem label="Browser" halign="left" valign="bottom" fullimage="resource://res/ui/browser_full.gif" />
|
||||
<xpitem label="Address Book" halign="left" valign="bottom" fullimage="resource://res/ui/addrbook_full.gif" />
|
||||
</foldercanvas>
|
||||
</panel>
|
||||
|
||||
<!-- This is the Timebar Scale Rule -->
|
||||
<panel name="ScaleViewRule">
|
||||
<tcc foregroundcolor="#0000FF" name="PrevHour" orientation="north" control="MultiCalendarEventWeekView" usectxrule="hour-1" weightminor="0" weightmajor="0"/>
|
||||
<timebarscale name="TimebarScale" weightminor="0" weightmajor="1"/>
|
||||
<tcc foregroundcolor="#0000FF" name="NextHour" orientation="south" control="MultiCalendarEventWeekView" usectxrule="hour+1" weightminor="0" weightmajor="0"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the MonthController and Todo List -->
|
||||
<panel name="ToDoCalViewRule">
|
||||
<mcc name="MiniCalendar" control="MultiCalendarEventWeekView" usectxrule="DayList"/>
|
||||
<todocanvas name="ToDoCanvas"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the MultiDayView and Command Bar -->
|
||||
<panel name="MultiDayViewRule">
|
||||
<multidayviewcanvas name="MultiCalendarEventWeekView" control="MiniCalendar" repeatable="DayContext" minrepeat="1" maxrepeat="17" >
|
||||
<commandcanvas name="CommandCanvas" weightmajor="0" weightminor="0">
|
||||
</panel>
|
||||
|
||||
|
||||
<!-- This is the MultiDay, Scale and Todo together -->
|
||||
<panel name="MultiCalendarEventWeekViewPanel">
|
||||
<!-- <control rule="FolderViewRule" layout="ybox" weightmajor="0" weightminor="0"/> -->
|
||||
<control rule="ScaleViewRule" layout="ybox" weightmajor="0" weightminor="0"/>
|
||||
<control rule="MultiDayViewRule" layout="ybox" width="400" weightmajor="1"/>
|
||||
<control rule="ToDoCalViewRule" layout="ybox" weightmajor="0" weightminor="0"/>
|
||||
<!<!-- <set tag="Canvas" type="EventComponentCanvas"/>-->
|
||||
</panel>
|
||||
|
||||
|
||||
<!-- This is the user header with the big Multi One -->
|
||||
<panel id="MultiCalendarUserEventWeekView" label="Day View">
|
||||
<control id="uhr" rule="UserHeadingRule" layout="xbox" weightminor="0" weightmajor="0"/>
|
||||
<control id="mcewv" rule="MultiCalendarEventWeekViewPanel" layout="xbox"/>
|
||||
</panel>
|
||||
|
||||
<!-- Calendar with Folder Views -->
|
||||
<panel id="CalendarAndFolder" label="CalendarAndFolder">
|
||||
<!--
|
||||
<control rule="FolderViewRule" layout="ybox" weightminor="0" weightmajor="0"/>
|
||||
-->
|
||||
<control id="mcuewv" rule="MultiCalendarUserEventWeekView" layout="ybox"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the root GUI panel. This is where life begins -->
|
||||
<rootpanel id="MainCalendarPanel" label="Calendar UI">
|
||||
<control id="uhr" rule="CalendarAndFolder" layout="xbox"/>
|
||||
<ctx id="StartContext" majorinterval="PT01H" minorinterval="PT15M" default="today"/>
|
||||
</rootpanel>
|
||||
|
||||
|
||||
</Calendar>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" standalone="no" encoding="UTF-8"?>
|
||||
<!DOCTYPE julian SYSTEM "http://kirkwood.mcom.com/julian.dtd">
|
||||
<Calendar>
|
||||
|
||||
<panel name="HTMLCanvas">
|
||||
<object class="htmlcanvas" src="http://my.netscape.com" weightminor="1" weightmajor="1"/>
|
||||
</panel>
|
||||
|
||||
<rootpanel id="MainCalendarPanel" label="Calendar UI">
|
||||
<control id="uhr" rule="HTMLCanvas" layout="xbox" weightminor="1" weightmajor="1"/>
|
||||
<ctx id="StartContext" majorinterval="PT01H" minorinterval="PT15M" default="today"/>
|
||||
</rootpanel>
|
||||
|
||||
|
||||
</Calendar>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" standalone="no" encoding="UTF-8"?>
|
||||
<!DOCTYPE application SYSTEM "http://kirkwood.mcom.com/ui.dtd">
|
||||
<UI>
|
||||
|
||||
<!-- This is the Application XML
|
||||
|
||||
In general, this file will reference other XML files
|
||||
defining things like Toolbars, MenuBars, App-specific
|
||||
widgets, HTML Views, etc....
|
||||
|
||||
In our case, it defines the references to separate XML
|
||||
files which compose a specific window. It does not define
|
||||
application specific features.
|
||||
-->
|
||||
|
||||
<!-- This is the Application Definition -->
|
||||
<application name="Trex 0.1" layout="ybox">
|
||||
<canvas src="resource://res/ui/demo/julian1.cal"/>
|
||||
</application>
|
||||
|
||||
</UI>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" standalone="no" encoding="UTF-8"?>
|
||||
<!DOCTYPE application SYSTEM "http://kirkwood.mcom.com/ui.dtd">
|
||||
<UI>
|
||||
|
||||
<!-- This is the Application XML
|
||||
|
||||
In general, this file will reference other XML files
|
||||
defining things like Toolbars, MenuBars, App-specific
|
||||
widgets, HTML Views, etc....
|
||||
|
||||
In our case, it defines the references to separate XML
|
||||
files which compose a specific window. It does not define
|
||||
application specific features.
|
||||
-->
|
||||
|
||||
<!-- This is the Application Definition -->
|
||||
<application name="Trex 0.1" layout="ybox">
|
||||
<canvas src="resource://res/ui/toolbar.ui"/>
|
||||
<canvas src="resource://res/ui/demo/julian2.cal"/>
|
||||
</application>
|
||||
|
||||
</UI>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" standalone="no" encoding="UTF-8"?>
|
||||
<!DOCTYPE application SYSTEM "http://kirkwood.mcom.com/ui.dtd">
|
||||
<UI>
|
||||
|
||||
<!-- This is the Application XML
|
||||
|
||||
In general, this file will reference other XML files
|
||||
defining things like Toolbars, MenuBars, App-specific
|
||||
widgets, HTML Views, etc....
|
||||
|
||||
In our case, it defines the references to separate XML
|
||||
files which compose a specific window. It does not define
|
||||
application specific features.
|
||||
-->
|
||||
|
||||
<!-- This is the Application Definition -->
|
||||
<application name="Trex 0.1" layout="ybox">
|
||||
<canvas src="resource://res/ui/demo/julian3.cal"/>
|
||||
</application>
|
||||
|
||||
</UI>
|
||||
|
|
@ -9,6 +9,8 @@
|
|||
#
|
||||
GDEPTH = ../../../..
|
||||
|
||||
DIRS_LIBS = demo
|
||||
|
||||
MODULE = trex
|
||||
|
||||
REQUIRES = raptor
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
<!-- This is the ToolBar Definition -->
|
||||
<toolbar backgroundcolor="#C0C0C0" name="ToolBar" layout="xbox" hgap="3" vgap="3" weightmajor="0" weightminor="0" icons="mini" dockable="true" floatable="true" tooltips="true">
|
||||
<xpbutton weightmajor="0" halign="center" valign="bottom" weightminor="0" label="InTray" miniimage="intray_mini.gif" fullimage="resource://res/ui/intray_full.gif" fullhoverimage="resource://res/ui/intray_hover_full.gif" fullpressedimage="resource://res/ui/intray_pressed_full.gif"/>
|
||||
<xpbutton command="LoadUrl?resource://res/ui/demo/julian4.cal" weightmajor="0" halign="center" valign="bottom" weightminor="0" label="InTray" miniimage="intray_mini.gif" fullimage="resource://res/ui/intray_full.gif" fullhoverimage="resource://res/ui/intray_hover_full.gif" fullpressedimage="resource://res/ui/intray_pressed_full.gif"/>
|
||||
<xpbutton label="Agenda" halign="center" valign="bottom" enable="True" weightmajor="0" weightminor="0" miniimage="resource://res/ui/agenda_mini.gif" fullimage="resource://res/ui/agenda_full.gif" fullhoverimage="resource://res/ui/agenda_hover_full.gif" fullpressedimage="resource://res/ui/agenda_pressed_full.gif"/>
|
||||
<xpbutton halign="center" valign="bottom" weightmajor="0" weightminor="0" label="Tasks" miniimage="tasks_mini.gif" fullimage="resource://res/ui/tasks_full.gif" fullhoverimage="resource://res/ui/tasks_hover_full.gif" fullpressedimage="resource://res/ui/tasks_pressed_full.gif"/>
|
||||
<object class="separator" weightmajor="0" weightminor="0"/>
|
||||
|
|
|
@ -15,9 +15,8 @@
|
|||
|
||||
<!-- This is the Application Definition -->
|
||||
<application name="Trex 0.1" layout="ybox">
|
||||
<object class="panel" src="menubar.ui"/>
|
||||
<object class="panel" src="toolbar.ui"/>
|
||||
<object class="panel" src="julian.cal"/>
|
||||
<panel src="toolbar.ui"/>
|
||||
<panel src="julian.cal"/>
|
||||
</application>
|
||||
|
||||
</UI>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#define XPFC_STRING_BOTTOM "bottom"
|
||||
#define XPFC_STRING_CENTER "center"
|
||||
#define XPFC_STRING_CLASS "class"
|
||||
#define XPFC_STRING_COMMAND "command"
|
||||
#define XPFC_STRING_CONTAINER "container"
|
||||
#define XPFC_STRING_ENABLE "enable"
|
||||
#define XPFC_STRING_FOLDER_CANVAS "foldercanvas"
|
||||
|
|
|
@ -29,6 +29,7 @@ enum eXPFCXMLTags
|
|||
eXPFCXMLTag_doctype,
|
||||
eXPFCXMLTag_xml,
|
||||
|
||||
eXPFCXMLTag_application,
|
||||
eXPFCXMLTag_button,
|
||||
eXPFCXMLTag_canvas,
|
||||
eXPFCXMLTag_dialog,
|
||||
|
|
|
@ -56,10 +56,11 @@ static NS_DEFINE_IID(kCXPFCTabWidgetCID, NS_XPFC_TABWIDGET_CID);
|
|||
static NS_DEFINE_IID(kCXPFCTextWidgetCID, NS_XPFC_TEXTWIDGET_CID);
|
||||
static NS_DEFINE_IID(kIXPFCXMLContentSinkIID, NS_IXPFC_XML_CONTENT_SINK_IID);
|
||||
|
||||
#define XPFC_PARSING_STATE_UNKNOWN 0
|
||||
#define XPFC_PARSING_STATE_TOOLBAR 1
|
||||
#define XPFC_PARSING_STATE_MENUBAR 2
|
||||
#define XPFC_PARSING_STATE_DIALOG 3
|
||||
#define XPFC_PARSING_STATE_UNKNOWN 0
|
||||
#define XPFC_PARSING_STATE_TOOLBAR 1
|
||||
#define XPFC_PARSING_STATE_MENUBAR 2
|
||||
#define XPFC_PARSING_STATE_DIALOG 3
|
||||
#define XPFC_PARSING_STATE_APPLICATION 4
|
||||
|
||||
class ContainerListEntry {
|
||||
public:
|
||||
|
@ -195,6 +196,37 @@ NS_IMETHODIMP nsXPFCXMLContentSink::OpenContainer(const nsIParserNode& aNode)
|
|||
mState = XPFC_PARSING_STATE_TOOLBAR;
|
||||
else if (eXPFCXMLTag_dialog == tag)
|
||||
mState = XPFC_PARSING_STATE_DIALOG;
|
||||
else if (eXPFCXMLTag_application == tag)
|
||||
mState = XPFC_PARSING_STATE_APPLICATION;
|
||||
|
||||
if (mState == XPFC_PARSING_STATE_APPLICATION)
|
||||
{
|
||||
if (eXPFCXMLTag_canvas == tag)
|
||||
{
|
||||
PRInt32 i = 0;
|
||||
nsString key,value;
|
||||
|
||||
for (i = 0; i < aNode.GetAttributeCount(); i++)
|
||||
{
|
||||
|
||||
key = aNode.GetKeyAt(i);
|
||||
value = aNode.GetValueAt(i);
|
||||
|
||||
key.StripChars("\"");
|
||||
value.StripChars("\"");
|
||||
|
||||
if (key.EqualsIgnoreCase("src"))
|
||||
{
|
||||
// Load the url!
|
||||
mViewerContainer->LoadURL(value,nsnull);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsString text = aNode.GetText();
|
||||
|
||||
|
@ -578,6 +610,7 @@ NS_IMETHODIMP nsXPFCXMLContentSink::CIDFromTag(eXPFCXMLTags tag, nsCID &aClass)
|
|||
aClass = kCXPFCDialogCID;
|
||||
break;
|
||||
|
||||
case eXPFCXMLTag_application:
|
||||
case eXPFCXMLTag_canvas:
|
||||
case eXPFCXMLTag_separator:
|
||||
aClass = kCXPFCCanvasCID;
|
||||
|
|
|
@ -40,6 +40,8 @@ static const char* kToolbarXMLTextContentType = "ui/toolbar";
|
|||
static const char* kToolbarXMLDocHeader= "<!DOCTYPE toolbar";
|
||||
static const char* kDialogXMLTextContentType = "ui/dialog";
|
||||
static const char* kDialogXMLDocHeader= "<!DOCTYPE dialog";
|
||||
static const char* kApplicationXMLTextContentType = "ui/application";
|
||||
static const char* kApplicationXMLDocHeader= "<!DOCTYPE application";
|
||||
|
||||
struct nsXPFCXMLTagEntry {
|
||||
char mName[32];
|
||||
|
@ -51,6 +53,7 @@ nsXPFCXMLTagEntry gXPFCXMLTagTable[] =
|
|||
{"!!UNKNOWN", eXPFCXMLTag_unknown},
|
||||
{"!DOCTYPE", eXPFCXMLTag_doctype},
|
||||
{"?XML", eXPFCXMLTag_xml},
|
||||
{"application", eXPFCXMLTag_application},
|
||||
{"button", eXPFCXMLTag_button},
|
||||
{"canvas", eXPFCXMLTag_canvas},
|
||||
{"dialog", eXPFCXMLTag_dialog},
|
||||
|
@ -163,7 +166,7 @@ nsXPFCXMLDTD::~nsXPFCXMLDTD()
|
|||
|
||||
PRBool nsXPFCXMLDTD::CanParse(nsString& aContentType, PRInt32 aVersion)
|
||||
{
|
||||
if (aContentType == kMenuXMLTextContentType || aContentType == kToolbarXMLTextContentType || aContentType == kDialogXMLTextContentType)
|
||||
if (aContentType == kMenuXMLTextContentType || aContentType == kToolbarXMLTextContentType || aContentType == kDialogXMLTextContentType || aContentType == kApplicationXMLTextContentType)
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
|
@ -189,6 +192,12 @@ eAutoDetectResult nsXPFCXMLDTD::AutoDetectContentType(nsString& aBuffer,nsString
|
|||
return eValidDetect;
|
||||
}
|
||||
|
||||
if ((aType == kApplicationXMLTextContentType) || (aBuffer.Find(kApplicationXMLDocHeader) != -1))
|
||||
{
|
||||
aType = kApplicationXMLTextContentType;
|
||||
return eValidDetect;
|
||||
}
|
||||
|
||||
return eUnknownDetect;
|
||||
}
|
||||
|
||||
|
@ -267,6 +276,7 @@ nsresult nsXPFCXMLDTD::HandleStartToken(CToken* aToken)
|
|||
case eXPFCXMLTag_menucontainer:
|
||||
case eXPFCXMLTag_toolbar:
|
||||
case eXPFCXMLTag_canvas:
|
||||
case eXPFCXMLTag_application:
|
||||
case eXPFCXMLTag_dialog:
|
||||
{
|
||||
mSink->OpenContainer(*attrNode);
|
||||
|
@ -337,6 +347,7 @@ nsresult nsXPFCXMLDTD::HandleEndToken(CToken* aToken)
|
|||
case eXPFCXMLTag_toolbar:
|
||||
case eXPFCXMLTag_canvas:
|
||||
case eXPFCXMLTag_dialog:
|
||||
case eXPFCXMLTag_application:
|
||||
{
|
||||
mSink->CloseContainer(*attrNode);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,9 @@ public:
|
|||
NS_IMETHOD GetRootCanvas(nsIXPFCCanvas ** aCanvas);
|
||||
NS_IMETHOD_(EVENT_CALLBACK) GetShellEventCallback() ;
|
||||
|
||||
NS_IMETHOD SetApplicationShell(nsIApplicationShell * aApplicationShell) ;
|
||||
NS_IMETHOD_(nsIApplicationShell *) GetApplicationShell() ;
|
||||
|
||||
protected:
|
||||
~nsXPFCToolkit();
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ public:
|
|||
NS_IMETHOD GetRootCanvas(nsIXPFCCanvas ** aCanvas) = 0;
|
||||
NS_IMETHOD_(EVENT_CALLBACK) GetShellEventCallback() = 0;
|
||||
|
||||
NS_IMETHOD SetApplicationShell(nsIApplicationShell * aApplicationShell) = 0;
|
||||
NS_IMETHOD_(nsIApplicationShell *) GetApplicationShell() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIXPFCToolkit_h___ */
|
||||
|
|
|
@ -84,6 +84,17 @@ nsIXPFCObserverManager * nsXPFCToolkit::GetObserverManager()
|
|||
return (mObserverManager);
|
||||
}
|
||||
|
||||
nsresult nsXPFCToolkit::SetApplicationShell(nsIApplicationShell * aApplicationShell)
|
||||
{
|
||||
mApplicationShell = aApplicationShell;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIApplicationShell * nsXPFCToolkit::GetApplicationShell()
|
||||
{
|
||||
return (mApplicationShell);
|
||||
}
|
||||
|
||||
nsresult nsXPFCToolkit::SetCanvasManager(nsIXPFCCanvasManager * aCanvasManager)
|
||||
{
|
||||
mCanvasManager = aCanvasManager;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "nsITimer.h"
|
||||
#include "nsIThrobber.h"
|
||||
#include "nsXPItem.h"
|
||||
#include "nsIWebViewerContainer.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kCXPButtonCID, NS_XP_BUTTON_CID);
|
||||
|
@ -42,6 +43,8 @@ static NS_DEFINE_IID(kInsButtonIID, NS_IBUTTON_IID);
|
|||
#define DEFAULT_WIDTH 50
|
||||
#define DEFAULT_HEIGHT 50
|
||||
|
||||
nsString gCommandString;
|
||||
|
||||
nsXPButton :: nsXPButton(nsISupports* outer) : nsXPItem(outer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
@ -120,6 +123,13 @@ nsresult nsXPButton :: SetParameter(nsString& aKey, nsString& aValue)
|
|||
|
||||
mFullPressedImageRequest = RequestImage(aValue);
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_COMMAND)) {
|
||||
|
||||
// XXX: Total hack here for demo purposes ... sorry
|
||||
|
||||
aValue.Mid(gCommandString,8,aValue.Length()-8);
|
||||
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_ENABLE)) {
|
||||
|
||||
|
||||
|
@ -327,6 +337,19 @@ nsEventStatus nsXPButton :: OnLeftButtonUp(nsGUIEvent *aEvent)
|
|||
{
|
||||
mState &= ~eButtonState_pressed;
|
||||
GetWidget()->Invalidate(PR_FALSE);
|
||||
|
||||
if (gCommandString.Length() > 0)
|
||||
{
|
||||
nsIWebViewerContainer * webViewerContainer = nsnull;
|
||||
gXPFCToolkit->GetApplicationShell()->GetWebViewerContainer(&webViewerContainer);
|
||||
|
||||
if (webViewerContainer != nsnull)
|
||||
{
|
||||
webViewerContainer->LoadURL(gCommandString,nsnull);
|
||||
NS_RELEASE(webViewerContainer);
|
||||
}
|
||||
}
|
||||
|
||||
return (nsXPItem::OnLeftButtonUp(aEvent));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче