xp button and folder birth
@ -37,6 +37,7 @@ enum eCalXMLTags
|
||||
eCalXMLTag_control,
|
||||
eCalXMLTag_ctx,
|
||||
eCalXMLTag_doctype,
|
||||
eCalXMLTag_foldercanvas,
|
||||
eCalXMLTag_htmlcanvas,
|
||||
eCalXMLTag_leaf,
|
||||
eCalXMLTag_mcc,
|
||||
@ -50,6 +51,7 @@ enum eCalXMLTags
|
||||
eCalXMLTag_timebaruserheading,
|
||||
eCalXMLTag_todocanvas,
|
||||
eCalXMLTag_xml,
|
||||
eCalXMLTag_xpitem,
|
||||
|
||||
eCalXMLTag_userdefined
|
||||
};
|
||||
|
@ -4,9 +4,25 @@
|
||||
|
||||
<!-- This is the User Heading Rule -->
|
||||
<panel name="UserHeadingRule" >
|
||||
<tcc foregroundcolor="#0000FF" name="PrevDay" orientation="west" control="MultiCalendarEventWeekView" major="tbh" usectxrule="day-1" weightminor="0" weightmajor="0"/>
|
||||
<object class="timebaruserheading" foregroundcolor="#FFFFFF" backgroundimage="resource://res/ui/image.jpg" name="tuh" title="Julian Calendar 0.1" weightmajor="1"/>
|
||||
<tcc foregroundcolor="#0000FF" name="NextDay" orientation="east" control="MultiCalendarEventWeekView" usectxrule="day+1" weightminor="0" weightmajor="0"/>
|
||||
<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 -->
|
||||
@ -31,7 +47,8 @@
|
||||
|
||||
<!-- This is the MultiDay, Scale and Todo together -->
|
||||
<panel name="MultiCalendarEventWeekViewPanel">
|
||||
<control rule="ScaleViewRule" layout="ybox" weightmajor="0" weightminor="0"/>
|
||||
<!-- <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"/>-->
|
||||
@ -44,9 +61,15 @@
|
||||
<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="MultiCalendarUserEventWeekView" layout="ybox"/>
|
||||
<control id="uhr" rule="CalendarAndFolder" layout="xbox"/>
|
||||
<ctx id="StartContext" majorinterval="PT01H" minorinterval="PT15M" default="today"/>
|
||||
</rootpanel>
|
||||
|
||||
|
@ -3,17 +3,33 @@
|
||||
<Calendar>
|
||||
|
||||
<!-- This is the User Heading Rule -->
|
||||
<panel name="UserHeadingRule">
|
||||
<tcc foregroundcolor="#0000FF" name="PrevDay" orientation="west" control="MultiCalendarEventWeekView" major="tbh" usectxrule="day-1" weightminor="0" weightmajor="0"/>
|
||||
<object class="timebaruserheading" name="tuh" title="Julian Calendar 0.1" weightmajor="1"/>
|
||||
<tcc foregroundcolor="#0000FF" name="NextDay" orientation="east" control="MultiCalendarEventWeekView" usectxrule="day+1" weightminor="0" weightmajor="0"/>
|
||||
<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" height="tbh" usectxrule="hour-4" weightminor="0" weightmajor="0"/>
|
||||
<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+4" weightminor="0" weightmajor="0"/>
|
||||
<tcc foregroundcolor="#0000FF" name="NextHour" orientation="south" control="MultiCalendarEventWeekView" usectxrule="hour+1" weightminor="0" weightmajor="0"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the MonthController and Todo List -->
|
||||
@ -22,11 +38,6 @@
|
||||
<todocanvas name="ToDoCanvas"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the HTML Pane -->
|
||||
<panel name="HTMLViewRule">
|
||||
<object class="htmlcanvas" src="resource://res/samples/test1.html"/>
|
||||
</panel>
|
||||
|
||||
<!-- This is the MultiDayView and Command Bar -->
|
||||
<panel name="MultiDayViewRule">
|
||||
<multidayviewcanvas name="MultiCalendarEventWeekView" control="MiniCalendar" repeatable="DayContext" minrepeat="1" maxrepeat="5" >
|
||||
@ -36,10 +47,10 @@
|
||||
|
||||
<!-- This is the MultiDay, Scale and Todo together -->
|
||||
<panel name="MultiCalendarEventWeekViewPanel">
|
||||
<control rule="ScaleViewRule" layout="ybox" weightmajor="0" weightminor="0"/>
|
||||
<!-- <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"/>
|
||||
<control rule="HTMLViewRule" layout="ybox" />
|
||||
<!<!-- <set tag="Canvas" type="EventComponentCanvas"/>-->
|
||||
</panel>
|
||||
|
||||
@ -50,9 +61,15 @@
|
||||
<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="MultiCalendarUserEventWeekView" layout="ybox"/>
|
||||
<control id="uhr" rule="CalendarAndFolder" layout="xbox"/>
|
||||
<ctx id="StartContext" majorinterval="PT01H" minorinterval="PT15M" default="today"/>
|
||||
</rootpanel>
|
||||
|
||||
|
83
calendar/modules/parser/calxml/res/julianht.cal
Normal file
@ -0,0 +1,83 @@
|
||||
<?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>
|
||||
|
||||
<panel name="HTMLCanvas">
|
||||
<object class="htmlcanvas" src="resource://res/samples/test1.html" weightminor="1" weightmajor="1"/>
|
||||
</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="5" >
|
||||
<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"/>
|
||||
<control id="uhr" rule="HTMLCanvas" layout="xbox" weightminor="1" weightmajor="1"/>
|
||||
<!<!-- <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>
|
||||
|
@ -15,6 +15,6 @@ REQUIRES = raptor
|
||||
|
||||
libs::
|
||||
$(INSTALL) julian.cal $(DIST)/bin/res/ui
|
||||
$(INSTALL) julianht.cal $(DIST)/bin/res/ui
|
||||
$(INSTALL) julian_day.cal $(DIST)/bin/res/ui
|
||||
$(INSTALL) julian_html.cal $(DIST)/bin/res/ui
|
||||
$(INSTALL) julian_cal_html.cal $(DIST)/bin/res/ui
|
||||
|
@ -56,6 +56,8 @@ static NS_DEFINE_IID(kCalTimebarCanvasCID, NS_CAL_TIMEBARCANVAS_CID);
|
||||
|
||||
static NS_DEFINE_IID(kCalContextcontrollerIID, NS_ICAL_CONTEXT_CONTROLLER_IID);
|
||||
static NS_DEFINE_IID(kIXPFCXMLContentSinkIID, NS_IXPFC_XML_CONTENT_SINK_IID);
|
||||
static NS_DEFINE_IID(kCXPFolderCanvas, NS_XP_FOLDER_CANVAS_CID);
|
||||
static NS_DEFINE_IID(kCXPItem, NS_XP_ITEM_CID);
|
||||
|
||||
|
||||
|
||||
@ -393,6 +395,14 @@ NS_IMETHODIMP nsCalXMLContentSink::CIDFromTag(eCalXMLTags tag, nsCID &aClass)
|
||||
case eCalXMLTag_htmlcanvas:
|
||||
aClass = kCXPFCHTMLCanvasCID;
|
||||
break;
|
||||
|
||||
case eCalXMLTag_foldercanvas:
|
||||
aClass = kCXPFolderCanvas;
|
||||
break;
|
||||
|
||||
case eCalXMLTag_xpitem:
|
||||
aClass = kCXPItem;
|
||||
break;
|
||||
|
||||
default:
|
||||
return (NS_ERROR_UNEXPECTED);
|
||||
|
@ -56,6 +56,7 @@ nsCalXMLTagEntry gCalXMLTagTable[] =
|
||||
{"comment", eCalXMLTag_comment},
|
||||
{"control", eCalXMLTag_control},
|
||||
{"ctx", eCalXMLTag_ctx},
|
||||
{"foldercanvas", eCalXMLTag_foldercanvas},
|
||||
{"htmlcanvas", eCalXMLTag_htmlcanvas},
|
||||
{"leaf", eCalXMLTag_leaf},
|
||||
{"mcc", eCalXMLTag_mcc},
|
||||
@ -68,6 +69,7 @@ nsCalXMLTagEntry gCalXMLTagTable[] =
|
||||
{"timebarscale", eCalXMLTag_timebarscale},
|
||||
{"timebaruserheading", eCalXMLTag_timebaruserheading},
|
||||
{"todocanvas", eCalXMLTag_todocanvas},
|
||||
{"xpitem", eCalXMLTag_xpitem},
|
||||
};
|
||||
|
||||
|
||||
@ -256,6 +258,7 @@ nsresult nsCalXMLDTD::HandleStartToken(CToken* aToken)
|
||||
case eCalXMLTag_object:
|
||||
case eCalXMLTag_rootpanel:
|
||||
case eCalXMLTag_panel:
|
||||
case eCalXMLTag_foldercanvas:
|
||||
{
|
||||
mSink->OpenContainer(*attrNode);
|
||||
}
|
||||
@ -269,6 +272,7 @@ nsresult nsCalXMLDTD::HandleStartToken(CToken* aToken)
|
||||
case eCalXMLTag_timebarscale:
|
||||
case eCalXMLTag_timebaruserheading:
|
||||
case eCalXMLTag_todocanvas:
|
||||
case eCalXMLTag_xpitem:
|
||||
case eCalXMLTag_htmlcanvas:
|
||||
{
|
||||
mSink->AddLeaf(*attrNode);
|
||||
@ -327,6 +331,7 @@ nsresult nsCalXMLDTD::HandleEndToken(CToken* aToken)
|
||||
case eCalXMLTag_object:
|
||||
case eCalXMLTag_panel:
|
||||
case eCalXMLTag_rootpanel:
|
||||
case eCalXMLTag_foldercanvas:
|
||||
{
|
||||
mSink->CloseContainer(*attrNode);
|
||||
}
|
||||
@ -342,6 +347,7 @@ nsresult nsCalXMLDTD::HandleEndToken(CToken* aToken)
|
||||
case eCalXMLTag_todocanvas:
|
||||
case eCalXMLTag_htmlcanvas:
|
||||
case eCalXMLTag_control:
|
||||
case eCalXMLTag_xpitem:
|
||||
break;
|
||||
|
||||
case eCalXMLTag_set:
|
||||
@ -377,6 +383,10 @@ eCalXMLTags nsCalXMLDTD::TagTypeFromObject(const nsIParserNode& aNode)
|
||||
return eCalXMLTag_timebaruserheading;
|
||||
if (value.EqualsIgnoreCase(XPFC_STRING_HTML_CANVAS))
|
||||
return eCalXMLTag_htmlcanvas;
|
||||
if (value.EqualsIgnoreCase(XPFC_STRING_FOLDER_CANVAS))
|
||||
return eCalXMLTag_foldercanvas;
|
||||
if (value.EqualsIgnoreCase(XPFC_STRING_XPITEM))
|
||||
return eCalXMLTag_xpitem;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ static NS_DEFINE_IID(kCXPFCDTD, NS_IXPFCXML_DTD_IID);
|
||||
static NS_DEFINE_IID(kCXPFCContentSink, NS_XPFCXMLCONTENTSINK_IID);
|
||||
static NS_DEFINE_IID(kCXPFCCommandServerCID, NS_XPFC_COMMAND_SERVER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCHTMLCanvasCID, NS_XPFC_HTML_CANVAS_CID);
|
||||
static NS_DEFINE_IID(kCXPFolderCanvasCID, NS_XP_FOLDER_CANVAS_CID);
|
||||
|
||||
static NS_DEFINE_IID(kViewManagerCID, NS_VIEW_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kIViewManagerIID, NS_IVIEWMANAGER_IID);
|
||||
@ -606,6 +607,7 @@ nsresult nsCalendarContainer::RegisterFactories()
|
||||
nsRepository::RegisterFactory(kCXPFCCommandCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPFCCanvasCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPFCHTMLCanvasCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPFolderCanvasCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPFCCanvasCID, XPFC_DLL, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kCXPFCCanvasManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPFCMethodInvokerCommandCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
|
@ -27,7 +27,6 @@ LD_LIBS += \
|
||||
nsjpn$(MOZ_BITS)30 \
|
||||
nscnv$(MOZ_BITS)30 \
|
||||
nssb$(MOZ_BITS)30 \
|
||||
calnetwork10 \
|
||||
xpfc10 \
|
||||
$(XP_REG_LIB)
|
||||
|
||||
|
BIN
calendar/modules/ui/res/addrbook_full.gif
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
calendar/modules/ui/res/agenda_full.gif
Normal file
After Width: | Height: | Size: 992 B |
BIN
calendar/modules/ui/res/agenda_hover_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/agenda_mini.gif
Normal file
After Width: | Height: | Size: 172 B |
BIN
calendar/modules/ui/res/agenda_pressed_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/browser_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/day_full.gif
Normal file
After Width: | Height: | Size: 955 B |
BIN
calendar/modules/ui/res/day_hover_full.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
calendar/modules/ui/res/day_pressed_full.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
calendar/modules/ui/res/inbox_full.gif
Normal file
After Width: | Height: | Size: 1000 B |
BIN
calendar/modules/ui/res/intray_full.gif
Normal file
After Width: | Height: | Size: 1013 B |
BIN
calendar/modules/ui/res/intray_hover_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/intray_pressed_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/mail_full.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
@ -19,3 +19,40 @@ libs::
|
||||
$(INSTALL) test.ui $(DIST)/bin/res/ui
|
||||
$(INSTALL) compose_event.ui $(DIST)/bin/res/ui
|
||||
$(INSTALL) image.jpg $(DIST)/bin/res/ui
|
||||
$(INSTALL) agenda_mini.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) agenda_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) agenda_pressed_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) agenda_hover_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) intray_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) intray_pressed_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) intray_hover_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) tasks_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) tasks_hover_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) tasks_pressed_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) day_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) day_hover_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) day_pressed_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) week_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) week_hover_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) week_pressed_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) month_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) month_hover_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) month_pressed_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) newentry_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) newentry_hover_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) newentry_pressed_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) newtask_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) newtask_hover_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) newtask_pressed_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) print_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) print_hover_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) print_pressed_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) inbox_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) sent_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) outbox_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) trash_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) browser_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) mail_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) addrbook_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) portal_full.gif $(DIST)/bin/res/ui
|
||||
$(INSTALL) trex_full.gif $(DIST)/bin/res/ui
|
||||
|
BIN
calendar/modules/ui/res/month_full.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
calendar/modules/ui/res/month_hover_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/month_pressed_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/newentry_full.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
calendar/modules/ui/res/newentry_hover_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/newentry_pressed_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/newtask_full.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
calendar/modules/ui/res/newtask_hover_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/newtask_pressed_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/outbox_full.gif
Normal file
After Width: | Height: | Size: 1000 B |
BIN
calendar/modules/ui/res/portal_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/print_full.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
calendar/modules/ui/res/print_hover_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/print_pressed_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/sent_full.gif
Normal file
After Width: | Height: | Size: 1000 B |
BIN
calendar/modules/ui/res/tasks_full.gif
Normal file
After Width: | Height: | Size: 1009 B |
BIN
calendar/modules/ui/res/tasks_hover_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/tasks_pressed_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
@ -30,8 +30,8 @@
|
||||
type - The type of widget to use (buttons, separators, text, etc...)
|
||||
commandkey - The command key equivalent
|
||||
shortcut - shortcut that applies
|
||||
miniicon - miniicon to use
|
||||
fullicon - fullicon to use
|
||||
miniimage - miniimage to use
|
||||
fullimage - fullimage to use
|
||||
rule - rule that gets applied, can modify appearance (or lack thereof)
|
||||
|
||||
(widget properties that typically are used)
|
||||
@ -44,24 +44,24 @@
|
||||
|
||||
-->
|
||||
|
||||
<!-- This is the MenuBar Definition -->
|
||||
<toolbar name="ToolBar" layout="xbox" weightmajor="0" weightminor="0" icons="mini" dockable="true" floatable="true" tooltips="true">
|
||||
<object class="button" weightmajor="0" weightminor="0" label="InTray" miniicon="intray_mini.gif" fullicon="intray_full.gif"/>
|
||||
<button label="Agenda" weightmajor="0" weightminor="0" miniicon="agenda_mini.gif" fullicon="agenda_full.gif"/>
|
||||
<object class="button" weightmajor="0" weightminor="0" label="Tasks" miniicon="tasks_mini.gif" fullicon="tasks_full.gif"/>
|
||||
<!-- 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 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"/>
|
||||
<button label="Day" weightmajor="0" weightminor="0" miniicon="day_mini.gif" fullicon="day_full.gif" rule="ViewListRule"/>
|
||||
<button label="Week" weightmajor="0" weightminor="0" miniicon="week_mini.gif" fullicon="week_full.gif" rule="ViewListRule"/>
|
||||
<button label="Month" weightmajor="0" weightminor="0" miniicon="month_mini.gif" fullicon="month_full.gif" rule="ViewListRule"/>
|
||||
<xpbutton halign="center" valign="bottom" label="Day" weightmajor="0" weightminor="0" miniimage="day_mini.gif" fullimage="resource://res/ui/day_full.gif" rule="ViewListRule" fullhoverimage="resource://res/ui/day_hover_full.gif" fullpressedimage="resource://res/ui/day_pressed_full.gif"/>
|
||||
<xpbutton halign="center" valign="bottom" label="Week" weightmajor="0" weightminor="0" miniimage="week_mini.gif" fullimage="resource://res/ui/week_full.gif" rule="ViewListRule" fullhoverimage="resource://res/ui/week_hover_full.gif" fullpressedimage="resource://res/ui/week_pressed_full.gif"/>
|
||||
<xpbutton halign="center" valign="bottom" label="Month" weightmajor="0" weightminor="0" miniimage="month_mini.gif" fullimage="resource://res/ui/month_full.gif" rule="ViewListRule" fullhoverimage="resource://res/ui/month_hover_full.gif" fullpressedimage="resource://res/ui/month_pressed_full.gif"/>
|
||||
<object class="separator" weightmajor="0" weightminor="0"/>
|
||||
<button label="New Entry" weightmajor="0" weightminor="0" miniicon="newentry_mini.gif" fullicon="newentry_full.gif"/>
|
||||
<button label="New Task" weightmajor="0" weightminor="0" miniicon="newtask_mini.gif" fullicon="newtask_full.gif"/>
|
||||
<xpbutton halign="center" valign="bottom" label="New Entry" weightmajor="0" weightminor="0" miniimage="newentry_mini.gif" fullimage="resource://res/ui/newentry_full.gif" fullhoverimage="resource://res/ui/newentry_hover_full.gif" fullpressedimage="resource://res/ui/newentry_pressed_full.gif"/>
|
||||
<xpbutton halign="center" valign="bottom" label="New Task" weightmajor="0" weightminor="0" miniimage="newtask_mini.gif" fullimage="resource://res/ui/newtask_full.gif" fullhoverimage="resource://res/ui/newtask_hover_full.gif" fullpressedimage="resource://res/ui/newtask_pressed_full.gif"/>
|
||||
<object class="separator" weightmajor="0" weightminor="0" />
|
||||
<button label="Print..." weightmajor="0" weightminor="0" miniicon="print_mini.gif" fullicon="print_full.gif"/>
|
||||
<xpbutton halign="center" valign="bottom" label="Print..." weightmajor="0" weightminor="0" miniimage="print_mini.gif" fullimage="resource://res/ui/print_full.gif" fullhoverimage="resource://res/ui/print_hover_full.gif" fullpressedimage="resource://res/ui/print_pressed_full.gif"/>
|
||||
<object class="separator" weightmajor="0" weightminor="0"/>
|
||||
<object class="editfield" weightmajor="1" weightminor="1" label=""/>
|
||||
<object class="separator"weightmajor="0" weightminor="0" />
|
||||
<button label="Throbber" weightmajor="0" weightminor="0" miniicon="throbber_mini##.gif" fullicon="throbber_full##.gif" align="right"/>
|
||||
<button label="Throbber" weightmajor="0" weightminor="0" miniimage="throbber_mini##.gif" fullimage="throbber_full##.gif" align="right"/>
|
||||
</toolbar>
|
||||
|
||||
</UI>
|
||||
|
BIN
calendar/modules/ui/res/trash_full.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
calendar/modules/ui/res/trex_full.gif
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
calendar/modules/ui/res/week_full.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
calendar/modules/ui/res/week_hover_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
calendar/modules/ui/res/week_pressed_full.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
@ -13,6 +13,7 @@ EXPORTS = \
|
||||
nsXPFCCanvas.h \
|
||||
nsXPFCHTMLCanvas.h \
|
||||
nsXPFCCanvasManager.h \
|
||||
nsXPFolderCanvas.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
NS_IMETHOD CreateIterator(nsIIterator ** aIterator) ;
|
||||
NS_IMETHOD Layout() ;
|
||||
NS_IMETHOD_(nsILayout *) GetLayout();
|
||||
NS_IMETHOD SetLayout(nsILayout * aLayout) ;
|
||||
|
||||
|
||||
NS_IMETHOD_(nsString&) GetNameID();
|
||||
NS_IMETHOD SetNameID(nsString& aString);
|
||||
@ -244,6 +246,9 @@ public:
|
||||
|
||||
protected:
|
||||
~nsXPFCCanvas();
|
||||
NS_IMETHOD CreateImageGroup();
|
||||
NS_IMETHOD CreateDefaultLayout();
|
||||
NS_IMETHOD_(nsIImageRequest *) RequestImage(nsString aUrl);
|
||||
|
||||
|
||||
public:
|
||||
@ -269,8 +274,6 @@ private:
|
||||
nsFont mFont;
|
||||
PRUint32 mTabID;
|
||||
PRUint32 mTabGroup;
|
||||
nsIImageGroup* mImageGroup;
|
||||
nsIImageRequest* mImageRequest;
|
||||
|
||||
// nsIWidget Aggregation
|
||||
protected:
|
||||
@ -288,6 +291,8 @@ protected:
|
||||
|
||||
nsIRenderingContext *mRenderingContext;
|
||||
nsIXPFCCanvas * mParent;
|
||||
nsIImageRequest* mImageRequest;
|
||||
nsIImageGroup* mImageGroup;
|
||||
|
||||
public:
|
||||
nsIView *mView;
|
||||
|
@ -45,9 +45,16 @@ public:
|
||||
NS_IMETHOD SetRootCanvas(nsIXPFCCanvas * aCanvas);
|
||||
NS_IMETHOD Register(nsIXPFCCanvas * aCanvas, nsIView * aView);
|
||||
NS_IMETHOD Unregister(nsIXPFCCanvas * aCanvas);
|
||||
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) GetFocusedCanvas();
|
||||
NS_IMETHOD SetFocusedCanvas(nsIXPFCCanvas * aCanvas);
|
||||
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) GetPressedCanvas();
|
||||
NS_IMETHOD SetPressedCanvas(nsIXPFCCanvas * aCanvas);
|
||||
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) GetMouseOverCanvas();
|
||||
NS_IMETHOD SetMouseOverCanvas(nsIXPFCCanvas * aCanvas);
|
||||
|
||||
// nsIViewObserver Interfaces
|
||||
NS_IMETHOD Paint(nsIView * aView,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
@ -71,6 +78,8 @@ public:
|
||||
private:
|
||||
nsIXPFCCanvas * mRootCanvas;
|
||||
nsIXPFCCanvas * mFocusedCanvas;
|
||||
nsIXPFCCanvas * mMouseOverCanvas ;
|
||||
nsIXPFCCanvas * mPressedCanvas ;
|
||||
|
||||
};
|
||||
|
||||
|
54
xpfc/canvas/inc/nsXPFolderCanvas.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsXPFolderCanvas_h___
|
||||
#define nsXPFolderCanvas_h___
|
||||
|
||||
#include "nsXPFCCanvas.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsXPFolderCanvas : public nsXPFCCanvas
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
nsXPFolderCanvas(nsISupports* outer);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init();
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
|
||||
// nsIXMLParserObject methods
|
||||
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
|
||||
|
||||
protected:
|
||||
~nsXPFolderCanvas();
|
||||
NS_IMETHOD CreateDefaultLayout();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsXPFolderCanvas_h___ */
|
@ -91,6 +91,7 @@ public:
|
||||
* @result nsILayout pointer, nsnull if no layout object assigned, else a pointer to the layout object
|
||||
*/
|
||||
NS_IMETHOD_(nsILayout *) GetLayout() = 0;
|
||||
NS_IMETHOD SetLayout(nsILayout * aLayout) = 0;
|
||||
|
||||
/**
|
||||
* Get the Name of this canvas, relative to itself
|
||||
|
@ -94,6 +94,32 @@ public:
|
||||
*/
|
||||
NS_IMETHOD SetFocusedCanvas(nsIXPFCCanvas * aCanvas) = 0;
|
||||
|
||||
/**
|
||||
* Get the canvas with Keyboard Focus
|
||||
* @result nsIXPFCCanvas pointer, the canvas with focus
|
||||
*/
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) GetPressedCanvas() = 0;
|
||||
|
||||
/**
|
||||
* Set the canvas with Keyboard Focus
|
||||
* @param nsIXPFCCanvas pointer, the canvas to set focus to
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetPressedCanvas(nsIXPFCCanvas * aCanvas) = 0;
|
||||
|
||||
/**
|
||||
* Get the canvas with Keyboard Focus
|
||||
* @result nsIXPFCCanvas pointer, the canvas with focus
|
||||
*/
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) GetMouseOverCanvas() = 0;
|
||||
|
||||
/**
|
||||
* Set the canvas with Keyboard Focus
|
||||
* @param nsIXPFCCanvas pointer, the canvas to set focus to
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetMouseOverCanvas(nsIXPFCCanvas * aCanvas) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIXPFCCanvasManager_h___ */
|
||||
|
@ -20,6 +20,7 @@ MODULE = xpfc
|
||||
CPPSRCS = \
|
||||
nsXPFCCanvas.cpp \
|
||||
nsXPFCHTMLCanvas.cpp \
|
||||
nsXPFolderCanvas.cpp \
|
||||
nsXPFCCanvasManager.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
@ -371,6 +371,50 @@ nsresult nsXPFCCanvas :: SetFocus()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvas :: CreateImageGroup()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if ((mImageGroup != nsnull) && (GetWidget() != nsnull))
|
||||
return NS_OK;
|
||||
|
||||
res = NS_NewImageGroup(&mImageGroup);
|
||||
|
||||
if (NS_OK == res)
|
||||
{
|
||||
|
||||
nsIDeviceContext * deviceCtx = GetWidget()->GetDeviceContext();
|
||||
|
||||
mImageGroup->Init(deviceCtx);
|
||||
|
||||
NS_RELEASE(deviceCtx);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
nsIImageRequest * nsXPFCCanvas :: RequestImage(nsString aUrl)
|
||||
{
|
||||
char * url = aUrl.ToNewCString();
|
||||
|
||||
nsIImageRequest * request ;
|
||||
|
||||
nscolor bgcolor = NS_RGB(0, 0, 0);
|
||||
|
||||
request = mImageGroup->GetImage(url,
|
||||
(nsIImageRequestObserver *)this,
|
||||
&bgcolor,
|
||||
mBounds.width,
|
||||
mBounds.height,
|
||||
0);
|
||||
|
||||
delete url;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsXPFCCanvas :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
{
|
||||
PRInt32 error = 0;
|
||||
@ -446,35 +490,9 @@ nsresult nsXPFCCanvas :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
* Request to load the image
|
||||
*/
|
||||
|
||||
nsresult res;
|
||||
|
||||
res = NS_NewImageGroup(&mImageGroup);
|
||||
|
||||
if (NS_OK == res)
|
||||
{
|
||||
|
||||
nsIDeviceContext * deviceCtx = GetWidget()->GetDeviceContext();
|
||||
|
||||
mImageGroup->Init(deviceCtx);
|
||||
|
||||
NS_RELEASE(deviceCtx);
|
||||
|
||||
char * url = aValue.ToNewCString();
|
||||
|
||||
nscolor bgcolor = NS_RGB(0, 0, 0);
|
||||
|
||||
|
||||
mImageRequest = mImageGroup->GetImage(url,
|
||||
(nsIImageRequestObserver *)this,
|
||||
&bgcolor,
|
||||
mBounds.width,
|
||||
mBounds.height,
|
||||
0);
|
||||
|
||||
delete url;
|
||||
}
|
||||
|
||||
CreateImageGroup();
|
||||
|
||||
mImageRequest = RequestImage(aValue);
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_WEIGHTMAJOR)) {
|
||||
|
||||
@ -500,6 +518,14 @@ nsresult nsXPFCCanvas :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
|
||||
SetMinorAxisWeight(aValue.ToFloat(&error));
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_HGAP)) {
|
||||
|
||||
((nsBoxLayout *)GetLayout())->SetHorizontalGap(aValue.ToInteger(&error));
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_VGAP)) {
|
||||
|
||||
((nsBoxLayout *)GetLayout())->SetVerticalGap(aValue.ToInteger(&error));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -636,6 +662,12 @@ nsILayout * nsXPFCCanvas :: GetLayout()
|
||||
return mLayout;
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvas :: SetLayout(nsILayout * aLayout)
|
||||
{
|
||||
mLayout = aLayout;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvas :: Init()
|
||||
{
|
||||
|
||||
@ -665,7 +697,15 @@ nsresult nsXPFCCanvas :: Init()
|
||||
|
||||
mChildWidgets->Init();
|
||||
|
||||
// XXX Box Layout is the default, but probably should not be
|
||||
CreateDefaultLayout();
|
||||
|
||||
return res ;
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvas :: CreateDefaultLayout()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
res = nsRepository::CreateInstance(kCBoxLayoutCID,
|
||||
nsnull,
|
||||
kCBoxLayoutCID,
|
||||
@ -676,7 +716,7 @@ nsresult nsXPFCCanvas :: Init()
|
||||
|
||||
((nsBoxLayout *)mLayout)->Init(this);
|
||||
|
||||
return res ;
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvas :: Init(nsNativeWidget aNativeParent, const nsRect& aBounds, EVENT_CALLBACK aHandleEventFunction)
|
||||
@ -1347,30 +1387,40 @@ nsEventStatus nsXPFCCanvas :: HandleEvent(nsGUIEvent *aEvent)
|
||||
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
{
|
||||
gXPFCToolkit->GetCanvasManager()->SetPressedCanvas(canvas);
|
||||
canvas->OnLeftButtonDown(aEvent);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||
{
|
||||
gXPFCToolkit->GetCanvasManager()->SetPressedCanvas(nsnull);
|
||||
canvas->OnLeftButtonUp(aEvent);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
{
|
||||
gXPFCToolkit->GetCanvasManager()->SetPressedCanvas(canvas);
|
||||
canvas->OnLeftButtonDown(aEvent);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_RIGHT_BUTTON_UP:
|
||||
{
|
||||
gXPFCToolkit->GetCanvasManager()->SetPressedCanvas(nsnull);
|
||||
canvas->OnLeftButtonUp(aEvent);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_MOVE:
|
||||
{
|
||||
if ((gXPFCToolkit->GetCanvasManager()->GetMouseOverCanvas() != nsnull) && (gXPFCToolkit->GetCanvasManager()->GetMouseOverCanvas() != canvas))
|
||||
{
|
||||
gXPFCToolkit->GetCanvasManager()->GetMouseOverCanvas()->OnMouseExit(aEvent);
|
||||
canvas->OnMouseEnter(aEvent);
|
||||
}
|
||||
gXPFCToolkit->GetCanvasManager()->SetMouseOverCanvas(canvas);
|
||||
canvas->OnMouseMove(aEvent);
|
||||
}
|
||||
break;
|
||||
@ -2029,6 +2079,8 @@ void nsXPFCCanvas::Notify(nsIImageRequest *aImageRequest,
|
||||
PRInt32 aParam1, PRInt32 aParam2,
|
||||
void *aParam3)
|
||||
{
|
||||
if (aNotificationType == nsImageNotification_kImageComplete)
|
||||
GetWidget()->Invalidate(PR_FALSE);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,8 @@ nsXPFCCanvasManager :: nsXPFCCanvasManager()
|
||||
monitor = nsnull;
|
||||
mRootCanvas = nsnull;
|
||||
mFocusedCanvas = nsnull;
|
||||
mMouseOverCanvas = nsnull;
|
||||
mPressedCanvas = nsnull;
|
||||
}
|
||||
|
||||
nsXPFCCanvasManager :: ~nsXPFCCanvasManager()
|
||||
@ -223,6 +225,28 @@ nsIXPFCCanvas * nsXPFCCanvasManager::GetFocusedCanvas()
|
||||
return(mFocusedCanvas);
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvasManager::SetPressedCanvas(nsIXPFCCanvas * aCanvas)
|
||||
{
|
||||
mPressedCanvas = aCanvas;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIXPFCCanvas * nsXPFCCanvasManager::GetPressedCanvas()
|
||||
{
|
||||
return(mPressedCanvas);
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvasManager::SetMouseOverCanvas(nsIXPFCCanvas * aCanvas)
|
||||
{
|
||||
mMouseOverCanvas = aCanvas;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIXPFCCanvas * nsXPFCCanvasManager::GetMouseOverCanvas()
|
||||
{
|
||||
return(mMouseOverCanvas);
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvasManager::Paint(nsIView * aView,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
|
128
xpfc/canvas/src/nsXPFolderCanvas.cpp
Normal file
@ -0,0 +1,128 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsXPFolderCanvas.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsFont.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nspr.h"
|
||||
#include "nsxpfcstrings.h"
|
||||
#include "nsListLayout.h"
|
||||
|
||||
static NS_DEFINE_IID(kCListLayoutCID, NS_LISTLAYOUT_CID);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kXPFolderCanvasCID, NS_XP_FOLDER_CANVAS_CID);
|
||||
|
||||
#define DEFAULT_WIDTH 50
|
||||
#define DEFAULT_HEIGHT 50
|
||||
|
||||
nsXPFolderCanvas :: nsXPFolderCanvas(nsISupports* outer) : nsXPFCCanvas(outer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsXPFolderCanvas :: ~nsXPFolderCanvas()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsXPFolderCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kClassIID, kXPFolderCanvasCID);
|
||||
if (aIID.Equals(kClassIID)) {
|
||||
*aInstancePtr = (void*) (nsXPFolderCanvas *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr));
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsXPFolderCanvas)
|
||||
NS_IMPL_RELEASE(nsXPFolderCanvas)
|
||||
|
||||
nsresult nsXPFolderCanvas :: Init()
|
||||
{
|
||||
return (nsXPFCCanvas::Init());
|
||||
}
|
||||
|
||||
nsEventStatus nsXPFolderCanvas :: OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
return (nsXPFCCanvas::OnResize(aX, aY, aWidth, aHeight));
|
||||
}
|
||||
|
||||
nsresult nsXPFolderCanvas :: SetBounds(const nsRect &aBounds)
|
||||
{
|
||||
return (nsXPFCCanvas::SetBounds(aBounds));
|
||||
}
|
||||
|
||||
|
||||
nsEventStatus nsXPFolderCanvas :: OnPaint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
|
||||
{
|
||||
return (nsXPFCCanvas::OnPaint(aRenderingContext,aDirtyRect));
|
||||
}
|
||||
|
||||
nsEventStatus nsXPFolderCanvas :: HandleEvent(nsGUIEvent *aEvent)
|
||||
{
|
||||
return (nsXPFCCanvas::HandleEvent(aEvent));
|
||||
}
|
||||
|
||||
nsresult nsXPFolderCanvas :: GetClassPreferredSize(nsSize& aSize)
|
||||
{
|
||||
aSize.width = DEFAULT_WIDTH;
|
||||
aSize.height = DEFAULT_HEIGHT;
|
||||
return (NS_OK);
|
||||
}
|
||||
|
||||
|
||||
nsresult nsXPFolderCanvas :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
{
|
||||
return (nsXPFCCanvas::SetParameter(aKey,aValue));
|
||||
}
|
||||
|
||||
nsresult nsXPFolderCanvas :: CreateDefaultLayout()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsListLayout * layout ;
|
||||
|
||||
res = nsRepository::CreateInstance(kCListLayoutCID,
|
||||
nsnull,
|
||||
kCListLayoutCID,
|
||||
(void **)&layout);
|
||||
|
||||
if (NS_OK != res)
|
||||
return res ;
|
||||
|
||||
SetLayout(layout);
|
||||
|
||||
layout->Init(this);
|
||||
|
||||
return res;
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
#include "nsXPFCToolbar.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nspr.h"
|
||||
#include "nsBoxLayout.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kCXPFCToolbarCID, NS_XPFC_TOOLBAR_CID);
|
||||
@ -27,6 +28,8 @@ static NS_DEFINE_IID(kCIXPFCToolbarIID, NS_IXPFC_TOOLBAR_IID);
|
||||
#define DEFAULT_WIDTH 50
|
||||
#define DEFAULT_HEIGHT 50
|
||||
|
||||
#define DEFAULT_GAP 2
|
||||
|
||||
nsXPFCToolbar :: nsXPFCToolbar(nsISupports* outer) : nsXPFCCanvas(outer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
@ -66,7 +69,12 @@ NS_IMPL_RELEASE(nsXPFCToolbar)
|
||||
|
||||
nsresult nsXPFCToolbar :: Init()
|
||||
{
|
||||
return (nsXPFCCanvas::Init());
|
||||
nsresult res = nsXPFCCanvas::Init();
|
||||
|
||||
((nsBoxLayout *)GetLayout())->SetHorizontalGap(DEFAULT_GAP);
|
||||
((nsBoxLayout *)GetLayout())->SetVerticalGap(DEFAULT_GAP);
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
nsresult nsXPFCToolbar :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
|
@ -52,6 +52,16 @@
|
||||
{ 0x55395780, 0x3b98, 0x11d2, \
|
||||
{0xbe, 0xe0, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
// 22070fb0-4a92-11d2-bee2-00805f8a8dbd
|
||||
#define NS_XP_BUTTON_CID \
|
||||
{ 0x22070fb0, 0x4a92, 0x11d2, \
|
||||
{0xbe, 0xe2, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
//23432750-4a9c-11d2-bee2-00805f8a8dbd
|
||||
#define NS_XP_ITEM_CID \
|
||||
{ 0x23432750, 0x4a9c, 0x11d2, \
|
||||
{0xbe, 0xe2, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
// cd53e4b0-3b99-11d2-bee0-00805f8a8dbd
|
||||
#define NS_XPFC_TEXTWIDGET_CID \
|
||||
{ 0xcd53e4b0, 0x3b99, 0x11d2, \
|
||||
@ -131,6 +141,11 @@
|
||||
{ 0x96562f50, 0xfb29, 0x11d1, \
|
||||
{ 0xbe, 0xcb, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
|
||||
|
||||
//f3dddca0-4b30-11d2-bee2-00805f8a8dbd
|
||||
#define NS_LISTLAYOUT_CID \
|
||||
{ 0xf3dddca0, 0x4b30, 0x11d2, \
|
||||
{ 0xbe, 0xe2, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
|
||||
|
||||
//0241c670-1f57-11d2-bed9-00805f8a8dbd
|
||||
#define NS_XPFC_OBSERVERMANAGER_CID \
|
||||
{ 0x0241c670, 0x1f57, 0x11d2, \
|
||||
@ -161,6 +176,11 @@
|
||||
{ 0x0b4ff5b0, 0x3dda, 0x11d2, \
|
||||
{ 0xbe, 0xe1, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
|
||||
|
||||
//cc2e92e0-4a9f-11d2-bee2-00805f8a8dbd
|
||||
#define NS_XP_FOLDER_CANVAS_CID \
|
||||
{ 0xcc2e92e0, 0x4a9f, 0x11d2, \
|
||||
{ 0xbe, 0xe2, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
|
||||
|
||||
//92789710-28a6-11d2-9246-00805f8a7ab6
|
||||
#define NS_XPFC_CANVASMANAGER_CID \
|
||||
{ 0x92789710, 0x28a6, 0x11d2, \
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "nsXPFCToolbar.h"
|
||||
#include "nsXPFCDialog.h"
|
||||
#include "nsXPFCButton.h"
|
||||
#include "nsXPButton.h"
|
||||
#include "nsXPItem.h"
|
||||
#include "nsXPFCTabWidget.h"
|
||||
#include "nsXPFCTextWidget.h"
|
||||
#include "nsMenuContainer.h"
|
||||
@ -46,6 +48,7 @@
|
||||
#include "nsStack.h"
|
||||
#include "nsLayout.h"
|
||||
#include "nsBoxLayout.h"
|
||||
#include "nsListLayout.h"
|
||||
#include "nsXPFCObserver.h"
|
||||
#include "nsXPFCObserverManager.h"
|
||||
#include "nsXPFCSubject.h"
|
||||
@ -56,6 +59,7 @@
|
||||
#include "nsXPFCActionCommand.h"
|
||||
#include "nsCommandServer.h"
|
||||
#include "nsXPFCHTMLCanvas.h"
|
||||
#include "nsXPFolderCanvas.h"
|
||||
|
||||
static NS_DEFINE_IID(kCShellInstance, NS_XPFC_SHELL_INSTANCE_CID);
|
||||
static NS_DEFINE_IID(kCMenuItem, NS_MENUITEM_CID);
|
||||
@ -72,6 +76,8 @@ static NS_DEFINE_IID(kCXPFCToolbar, NS_XPFC_TOOLBAR_CID);
|
||||
static NS_DEFINE_IID(kCToolbarManager, NS_TOOLBAR_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCDialog, NS_XPFC_DIALOG_CID);
|
||||
static NS_DEFINE_IID(kCXPFCButton, NS_XPFC_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCXPButton, NS_XP_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCXPItem, NS_XP_ITEM_CID);
|
||||
static NS_DEFINE_IID(kCXPFCTabWidget, NS_XPFC_TABWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCXPFCTextWidget, NS_XPFC_TEXTWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCVector, NS_VECTOR_CID);
|
||||
@ -79,12 +85,14 @@ static NS_DEFINE_IID(kCVectorIterator, NS_VECTOR_ITERATOR_CID);
|
||||
static NS_DEFINE_IID(kCLayout, NS_LAYOUT_CID);
|
||||
static NS_DEFINE_IID(kILayout, NS_ILAYOUT_IID);
|
||||
static NS_DEFINE_IID(kCBoxLayout, NS_BOXLAYOUT_CID);
|
||||
static NS_DEFINE_IID(kCListLayout, NS_LISTLAYOUT_CID);
|
||||
static NS_DEFINE_IID(kCXPFCObserver, NS_XPFC_OBSERVER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCObserverManager, NS_XPFC_OBSERVERMANAGER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCSubject, NS_XPFC_SUBJECT_CID);
|
||||
static NS_DEFINE_IID(kCXPFCCommand, NS_XPFC_COMMAND_CID);
|
||||
static NS_DEFINE_IID(kCXPFCCanvas, NS_XPFC_CANVAS_CID);
|
||||
static NS_DEFINE_IID(kCXPFCHTMLCanvas, NS_XPFC_HTML_CANVAS_CID);
|
||||
static NS_DEFINE_IID(kCXPFolderCanvas, NS_XP_FOLDER_CANVAS_CID);
|
||||
static NS_DEFINE_IID(kCXPFCCanvasManager, NS_XPFC_CANVASMANAGER_CID);
|
||||
static NS_DEFINE_IID(kIXPFCCanvas, NS_IXPFC_CANVAS_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
@ -22,28 +22,46 @@
|
||||
#define XPFC_STRING_QUESTIONMARK "?"
|
||||
#define XPFC_STRING_BACKGROUNDCOLOR "backgroundcolor"
|
||||
#define XPFC_STRING_BACKGROUNDIMAGE "backgroundimage"
|
||||
#define XPFC_STRING_BOTTOM "bottom"
|
||||
#define XPFC_STRING_CENTER "center"
|
||||
#define XPFC_STRING_CLASS "class"
|
||||
#define XPFC_STRING_CONTAINER "container"
|
||||
#define XPFC_STRING_ENABLE "enable"
|
||||
#define XPFC_STRING_FOLDER_CANVAS "foldercanvas"
|
||||
#define XPFC_STRING_FOREGROUNDCOLOR "foregroundcolor"
|
||||
#define XPFC_STRING_FULLIMAGE "fullimage"
|
||||
#define XPFC_STRING_FULLHOVERIMAGE "fullhoverimage"
|
||||
#define XPFC_STRING_FULLPRESSEDIMAGE "fullpressedimage"
|
||||
#define XPFC_STRING_GETBACKGROUNDCOLOR "getbackgroundcolor"
|
||||
#define XPFC_STRING_HALIGN "halign"
|
||||
#define XPFC_STRING_HEIGHT "height"
|
||||
#define XPFC_STRING_HELP "help"
|
||||
#define XPFC_STRING_HGAP "hgap"
|
||||
#define XPFC_STRING_HTML_CANVAS "htmlcanvas"
|
||||
#define XPFC_STRING_ID "id"
|
||||
#define XPFC_STRING_KEYBOARDFOCUS "keyboardfocus"
|
||||
#define XPFC_STRING_LABEL "label"
|
||||
#define XPFC_STRING_LAYOUT "layout"
|
||||
#define XPFC_STRING_LEFT "left"
|
||||
#define XPFC_STRING_MINIIMAGE "miniimage"
|
||||
#define XPFC_STRING_MINIHOVERIMAGE "minihoverimage"
|
||||
#define XPFC_STRING_MINIPRESSEDIMAGE "minipressedimage"
|
||||
#define XPFC_STRING_MENUCONTAINER "menucontainer"
|
||||
#define XPFC_STRING_NAME "name"
|
||||
#define XPFC_STRING_RIGHT "right"
|
||||
#define XPFC_STRING_SETBACKGROUNDCOLOR "setbackgroundcolor"
|
||||
#define XPFC_STRING_SRC "src"
|
||||
#define XPFC_STRING_TABGROUP "tabgroup"
|
||||
#define XPFC_STRING_TABID "tabid"
|
||||
#define XPFC_STRING_TOP "top"
|
||||
#define XPFC_STRING_USEPREFERREDSIZE "usepreferredsize"
|
||||
#define XPFC_STRING_VALIGN "valign"
|
||||
#define XPFC_STRING_VGAP "vgap"
|
||||
#define XPFC_STRING_WEIGHTMAJOR "weightmajor"
|
||||
#define XPFC_STRING_WEIGHTMINOR "weightminor"
|
||||
#define XPFC_STRING_WIDTH "width"
|
||||
#define XPFC_STRING_XBOX "xbox"
|
||||
#define XPFC_STRING_XPITEM "xpitem"
|
||||
#define XPFC_STRING_YBOX "ybox"
|
||||
|
||||
#endif
|
||||
|
@ -92,6 +92,9 @@ nsresult nsxpfcFactory::CreateInstance(nsISupports *aOuter,
|
||||
} else if (mClassID.Equals(kCXPFCHTMLCanvas)) {
|
||||
nsXPFCHTMLCanvas * canvas = (nsXPFCHTMLCanvas *)new nsXPFCHTMLCanvas(aOuter);
|
||||
canvas->QueryInterface(kISupportsIID,(void **)&inst);
|
||||
} else if (mClassID.Equals(kCXPFolderCanvas)) {
|
||||
nsXPFolderCanvas * canvas = (nsXPFolderCanvas *)new nsXPFolderCanvas(aOuter);
|
||||
canvas->QueryInterface(kISupportsIID,(void **)&inst);
|
||||
} else if (mClassID.Equals(kCMenuContainer)) {
|
||||
inst = (nsISupports *)(nsIMenuContainer *)new nsMenuContainer();
|
||||
} else if (mClassID.Equals(kCXPFCToolbar)) {
|
||||
@ -100,6 +103,10 @@ nsresult nsxpfcFactory::CreateInstance(nsISupports *aOuter,
|
||||
inst = (nsISupports *)(nsIXPFCDialog *)new nsXPFCDialog(aOuter);
|
||||
} else if (mClassID.Equals(kCXPFCButton)) {
|
||||
inst = (nsISupports *)(nsIXPFCButton *)new nsXPFCButton(aOuter);
|
||||
} else if (mClassID.Equals(kCXPButton)) {
|
||||
inst = (nsISupports *)(nsIXPButton *)new nsXPButton(aOuter);
|
||||
} else if (mClassID.Equals(kCXPItem)) {
|
||||
inst = (nsISupports *)(nsIXPItem *)new nsXPItem(aOuter);
|
||||
} else if (mClassID.Equals(kCXPFCTextWidget)) {
|
||||
inst = (nsISupports *)(nsIXPFCTextWidget *)new nsXPFCTextWidget(aOuter);
|
||||
} else if (mClassID.Equals(kCXPFCTabWidget)) {
|
||||
@ -128,6 +135,8 @@ nsresult nsxpfcFactory::CreateInstance(nsISupports *aOuter,
|
||||
inst = (nsISupports *)new nsLayout();
|
||||
} else if (mClassID.Equals(kCBoxLayout)) {
|
||||
inst = (nsISupports *)new nsBoxLayout();
|
||||
} else if (mClassID.Equals(kCListLayout)) {
|
||||
inst = (nsISupports *)new nsListLayout();
|
||||
} else if (mClassID.Equals(kCXPFCObserver)) {
|
||||
inst = (nsISupports *)new nsXPFCObserver();
|
||||
} else if (mClassID.Equals(kCXPFCObserverManager)) {
|
||||
|
@ -12,6 +12,7 @@ GDEPTH = ../../..
|
||||
EXPORTS = \
|
||||
nsLayout.h \
|
||||
nsBoxLayout.h \
|
||||
nsListLayout.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
|
55
xpfc/layout/inc/nsListLayout.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsListLayout_h___
|
||||
#define nsListLayout_h___
|
||||
|
||||
#include "nsLayout.h"
|
||||
#include "nsIXPFCCanvas.h"
|
||||
#include "nsIIterator.h"
|
||||
|
||||
|
||||
class nsListLayout : public nsLayout
|
||||
{
|
||||
public:
|
||||
nsListLayout();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init();
|
||||
NS_IMETHOD Init(nsIXPFCCanvas * aContainer);
|
||||
|
||||
NS_IMETHOD Layout();
|
||||
|
||||
protected:
|
||||
~nsListLayout();
|
||||
|
||||
private:
|
||||
NS_IMETHOD LayoutContainer();
|
||||
NS_IMETHOD CreateIterator(nsIIterator ** aIterator) ;
|
||||
|
||||
private:
|
||||
nsIXPFCCanvas * mContainer;
|
||||
|
||||
public:
|
||||
nscoord mCellHeight ;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* nsListLayout_h___ */
|
@ -19,6 +19,7 @@ MODULE = xpfc
|
||||
|
||||
CPPSRCS = \
|
||||
nsLayout.cpp \
|
||||
nsListLayout.cpp \
|
||||
nsBoxLayout.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
@ -41,8 +41,8 @@ nsBoxLayout :: nsBoxLayout() : nsLayout()
|
||||
NS_INIT_REFCNT();
|
||||
mContainer = nsnull;
|
||||
mLayoutAlignment = eLayoutAlignment_horizontal;
|
||||
mVerticalGap = 1;
|
||||
mHorizontalGap = 1;
|
||||
mVerticalGap = 0;
|
||||
mHorizontalGap = 0;
|
||||
mVerticalFill = 1.0;
|
||||
mHorizontalFill = 1.0;
|
||||
}
|
||||
@ -123,6 +123,15 @@ nsresult nsBoxLayout :: LayoutContainer()
|
||||
|
||||
// Default case is everyone gets equal space
|
||||
mContainer->GetBounds(rect);
|
||||
|
||||
|
||||
// Offset by the gaps
|
||||
rect.x += mVerticalGap;
|
||||
rect.width-=(2*mVerticalGap);
|
||||
rect.y += mHorizontalGap;
|
||||
rect.height-=(2*mHorizontalGap);
|
||||
|
||||
|
||||
wsize = width = rect.width;
|
||||
hsize = height = rect.height;
|
||||
|
||||
@ -132,7 +141,10 @@ nsresult nsBoxLayout :: LayoutContainer()
|
||||
iterator->Init();
|
||||
|
||||
if (iterator->Count() == 0)
|
||||
{
|
||||
NS_RELEASE(iterator);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (GetLayoutAlignment() == eLayoutAlignment_horizontal) {
|
||||
wsize /= iterator->Count();
|
||||
|
162
xpfc/layout/src/nsListLayout.cpp
Normal file
@ -0,0 +1,162 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Note that throughout this code we assume (from a performance perspective)
|
||||
* that the number of widgets being laid out is very small (< 50). If this
|
||||
* assumption does not hold, the massive while loops found in this logic
|
||||
* should be optimized to be one for loop.
|
||||
*
|
||||
* This code is recommended as a clean way to layout small numbers of
|
||||
* containers holding objects, in an extensible way. For large lists,
|
||||
* use widgets geared towards them.
|
||||
*/
|
||||
|
||||
#include "nsxpfcCIID.h"
|
||||
|
||||
#include "nsListLayout.h"
|
||||
#include "nsIXPFCCanvas.h"
|
||||
|
||||
#define DEFAULT_CELL_HEIGHT 50
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kListLayoutCID, NS_LISTLAYOUT_CID);
|
||||
static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
|
||||
|
||||
nsListLayout :: nsListLayout() : nsLayout()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mContainer = nsnull;
|
||||
|
||||
mCellHeight = DEFAULT_CELL_HEIGHT;
|
||||
}
|
||||
|
||||
nsListLayout :: ~nsListLayout()
|
||||
{
|
||||
NS_IF_RELEASE(mContainer);
|
||||
}
|
||||
|
||||
|
||||
nsresult nsListLayout::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kClassIID, kListLayoutCID);
|
||||
if (aIID.Equals(kClassIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return (nsLayout::QueryInterface(aIID,aInstancePtr));
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsListLayout)
|
||||
NS_IMPL_RELEASE(nsListLayout)
|
||||
|
||||
nsresult nsListLayout :: Init()
|
||||
{
|
||||
return NS_OK ;
|
||||
}
|
||||
|
||||
nsresult nsListLayout :: Init(nsIXPFCCanvas * aContainer)
|
||||
{
|
||||
NS_IF_RELEASE(mContainer);
|
||||
mContainer = aContainer;
|
||||
NS_ADDREF(mContainer);
|
||||
return NS_OK ;
|
||||
}
|
||||
|
||||
nsresult nsListLayout :: Layout()
|
||||
{
|
||||
if (!mContainer)
|
||||
return NS_OK;
|
||||
|
||||
LayoutContainer();
|
||||
|
||||
return NS_OK ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
nsresult nsListLayout :: LayoutContainer()
|
||||
{
|
||||
/*
|
||||
* The list container will arrange icons in a specified size
|
||||
* depending on whether we are using small or large images.
|
||||
*
|
||||
* In the future, we should stretch blit the icons to fit the
|
||||
* desired size.
|
||||
*/
|
||||
|
||||
nsIIterator * iterator ;
|
||||
nscoord startx, starty;
|
||||
nsRect rect, canvas_rect;
|
||||
nsIXPFCCanvas * canvas ;
|
||||
PRUint32 count = 0;
|
||||
|
||||
mContainer->GetBounds(rect);
|
||||
|
||||
starty = rect.y;
|
||||
startx = rect.x;
|
||||
|
||||
CreateIterator(&iterator);
|
||||
|
||||
iterator->Init();
|
||||
|
||||
if (iterator->Count() == 0)
|
||||
{
|
||||
NS_RELEASE(iterator);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
iterator->First();
|
||||
|
||||
while(!(iterator->IsDone()))
|
||||
{
|
||||
canvas = (nsIXPFCCanvas *) iterator->CurrentItem();
|
||||
|
||||
canvas_rect.x = startx;
|
||||
canvas_rect.width = rect.width;
|
||||
canvas_rect.height = mCellHeight;
|
||||
canvas_rect.y = starty + mCellHeight * count;
|
||||
|
||||
canvas->SetBounds(canvas_rect);
|
||||
|
||||
count++;
|
||||
|
||||
iterator->Next();
|
||||
}
|
||||
|
||||
NS_RELEASE(iterator);
|
||||
|
||||
return NS_OK ;
|
||||
}
|
||||
|
||||
nsresult nsListLayout :: CreateIterator(nsIIterator ** aIterator)
|
||||
{
|
||||
return (mContainer->CreateIterator(aIterator));
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,8 @@ enum eXPFCXMLTags
|
||||
eXPFCXMLTag_tabwidget,
|
||||
eXPFCXMLTag_toolbar,
|
||||
eXPFCXMLTag_ui,
|
||||
|
||||
eXPFCXMLTag_userdefined
|
||||
eXPFCXMLTag_userdefined,
|
||||
eXPFCXMLTag_xpbutton
|
||||
};
|
||||
|
||||
enum eXPFCXMLAttributes
|
||||
|
@ -51,6 +51,7 @@ static NS_DEFINE_IID(kCButtonCID, NS_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCTextWidgetCID, NS_TEXTFIELD_CID);
|
||||
static NS_DEFINE_IID(kCTabWidgetCID, NS_TABWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCXPFCButtonCID, NS_XPFC_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCXPButtonCID, NS_XP_BUTTON_CID);
|
||||
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);
|
||||
@ -589,6 +590,10 @@ NS_IMETHODIMP nsXPFCXMLContentSink::CIDFromTag(eXPFCXMLTags tag, nsCID &aClass)
|
||||
case eXPFCXMLTag_button:
|
||||
aClass = kCXPFCButtonCID;
|
||||
break;
|
||||
|
||||
case eXPFCXMLTag_xpbutton:
|
||||
aClass = kCXPButtonCID;
|
||||
break;
|
||||
|
||||
case eXPFCXMLTag_tabwidget:
|
||||
aClass = kCXPFCTabWidgetCID;
|
||||
|
@ -64,6 +64,7 @@ nsXPFCXMLTagEntry gXPFCXMLTagTable[] =
|
||||
{"tabwidget", eXPFCXMLTag_tabwidget},
|
||||
{"toolbar", eXPFCXMLTag_toolbar},
|
||||
{"ui", eXPFCXMLTag_ui},
|
||||
{"xpbutton", eXPFCXMLTag_xpbutton},
|
||||
|
||||
};
|
||||
|
||||
@ -274,6 +275,7 @@ nsresult nsXPFCXMLDTD::HandleStartToken(CToken* aToken)
|
||||
|
||||
case eXPFCXMLTag_menuitem:
|
||||
case eXPFCXMLTag_button:
|
||||
case eXPFCXMLTag_xpbutton:
|
||||
case eXPFCXMLTag_editfield:
|
||||
case eXPFCXMLTag_separator:
|
||||
case eXPFCXMLTag_tabwidget:
|
||||
@ -344,6 +346,7 @@ nsresult nsXPFCXMLDTD::HandleEndToken(CToken* aToken)
|
||||
case eXPFCXMLTag_editfield:
|
||||
case eXPFCXMLTag_separator:
|
||||
case eXPFCXMLTag_button:
|
||||
case eXPFCXMLTag_xpbutton:
|
||||
case eXPFCXMLTag_tabwidget:
|
||||
break;
|
||||
|
||||
@ -380,6 +383,8 @@ eXPFCXMLTags nsXPFCXMLDTD::TagTypeFromObject(const nsIParserNode& aNode)
|
||||
return (eXPFCXMLTag_button);
|
||||
else if (value.EqualsIgnoreCase("separator"))
|
||||
return (eXPFCXMLTag_separator);
|
||||
else if (value.EqualsIgnoreCase("xpbutton"))
|
||||
return (eXPFCXMLTag_xpbutton);
|
||||
else if (value.EqualsIgnoreCase("editfield"))
|
||||
return (eXPFCXMLTag_editfield);
|
||||
else if (value.EqualsIgnoreCase("tabwidget"))
|
||||
|
@ -47,6 +47,8 @@ static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
|
||||
static NS_DEFINE_IID(kCXPFCToolbarCID, NS_XPFC_TOOLBAR_CID);
|
||||
static NS_DEFINE_IID(kCXPFCDialogCID, NS_XPFC_DIALOG_CID);
|
||||
static NS_DEFINE_IID(kCXPFCButtonCID, NS_XPFC_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCXPButtonCID, NS_XP_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCXPItemCID, NS_XP_ITEM_CID);
|
||||
static NS_DEFINE_IID(kCXPFCTextWidgetCID, NS_XPFC_TEXTWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCXPFCTabWidgetCID, NS_XPFC_TABWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCToolbarManagerCID, NS_TOOLBAR_MANAGER_CID);
|
||||
@ -55,6 +57,8 @@ static NS_DEFINE_IID(kCVectorIteratorCID, NS_VECTOR_ITERATOR_CID);
|
||||
static NS_DEFINE_IID(kCstackCID, NS_STACK_CID);
|
||||
static NS_DEFINE_IID(kCStreamManagerCID, NS_STREAM_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kCStreamObjectCID, NS_STREAM_OBJECT_CID);
|
||||
static NS_DEFINE_IID(kCBoxLayoutCID, NS_BOXLAYOUT_CID);
|
||||
static NS_DEFINE_IID(kCListLayoutCID, NS_LISTLAYOUT_CID);
|
||||
|
||||
XtAppContext app_context ;
|
||||
Widget topLevel;
|
||||
@ -93,6 +97,10 @@ void main(int argc, char **argv)
|
||||
nsRepository::RegisterFactory(kCVectorCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCVectorIteratorCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCstackCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPButtonCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPItemCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCBoxLayoutCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCListLayoutCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
result = nsRepository::CreateInstance(kCShellInstanceCID,
|
||||
NULL,
|
||||
|
@ -47,6 +47,8 @@ static NS_DEFINE_IID(kCMenuManagerCID, NS_MENU_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCToolbarCID, NS_XPFC_TOOLBAR_CID);
|
||||
static NS_DEFINE_IID(kCXPFCDialogCID, NS_XPFC_DIALOG_CID);
|
||||
static NS_DEFINE_IID(kCXPFCButtonCID, NS_XPFC_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCXPButtonCID, NS_XP_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCXPItemCID, NS_XP_ITEM_CID);
|
||||
static NS_DEFINE_IID(kCXPFCTextWidgetCID, NS_XPFC_TEXTWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCXPFCTabWidgetCID, NS_XPFC_TABWIDGET_CID);
|
||||
|
||||
@ -57,6 +59,9 @@ static NS_DEFINE_IID(kCVectorCID, NS_VECTOR_CID);
|
||||
static NS_DEFINE_IID(kCVectorIteratorCID, NS_VECTOR_ITERATOR_CID);
|
||||
static NS_DEFINE_IID(kCstackCID, NS_STACK_CID);
|
||||
|
||||
static NS_DEFINE_IID(kCBoxLayoutCID, NS_BOXLAYOUT_CID);
|
||||
static NS_DEFINE_IID(kCListLayoutCID, NS_LISTLAYOUT_CID);
|
||||
|
||||
int PASCAL WinMain(HANDLE instance, HANDLE prevInstance, LPSTR cmdParam, int nCmdShow)
|
||||
{
|
||||
nsresult result = NS_OK ;
|
||||
@ -76,6 +81,8 @@ int PASCAL WinMain(HANDLE instance, HANDLE prevInstance, LPSTR cmdParam, int nCm
|
||||
nsRepository::RegisterFactory(kCXPFCToolbarCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPFCDialogCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPFCButtonCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPButtonCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPItemCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPFCTextWidgetCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCXPFCTabWidgetCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCToolbarManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
@ -84,6 +91,8 @@ int PASCAL WinMain(HANDLE instance, HANDLE prevInstance, LPSTR cmdParam, int nCm
|
||||
nsRepository::RegisterFactory(kCVectorCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCVectorIteratorCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCstackCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCBoxLayoutCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCListLayoutCID, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
result = nsRepository::CreateInstance(kCShellInstanceCID,
|
||||
NULL,
|
||||
|
@ -13,9 +13,12 @@ EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
nsXPButton.h \
|
||||
nsXPItem.h \
|
||||
nsXPFCButton.h \
|
||||
nsXPFCTabWidget.h \
|
||||
nsXPFCTextWidget.h \
|
||||
nsxpenums.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
76
xpfc/widget/inc/nsXPButton.h
Normal file
@ -0,0 +1,76 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsXPButton_h___
|
||||
#define nsXPButton_h___
|
||||
|
||||
#include "nsIXPButton.h"
|
||||
#include "nsXPFCCanvas.h"
|
||||
#include "nsxpenums.h"
|
||||
#include "nsXPItem.h"
|
||||
|
||||
#define eButtonState_none 0
|
||||
#define eButtonState_hover 1
|
||||
#define eButtonState_pressed 2
|
||||
|
||||
class nsXPButton : public nsIXPButton,
|
||||
public nsXPItem
|
||||
|
||||
{
|
||||
public:
|
||||
nsXPButton(nsISupports* outer);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init();
|
||||
|
||||
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
|
||||
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
|
||||
|
||||
NS_IMETHOD CreateWidget();
|
||||
|
||||
NS_IMETHOD SetLabel(nsString& aString);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
NS_IMETHOD_(nsEventStatus) PaintBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
NS_IMETHOD_(nsEventStatus) PaintForeground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) OnMouseEnter(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnMouseExit(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnMouseMove(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnLeftButtonDown(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnLeftButtonUp(nsGUIEvent *aEvent);
|
||||
|
||||
protected:
|
||||
~nsXPButton();
|
||||
|
||||
protected:
|
||||
nsIImageRequest* mMiniHoverImageRequest;
|
||||
nsIImageRequest* mFullHoverImageRequest;
|
||||
nsIImageRequest* mMiniPressedImageRequest;
|
||||
nsIImageRequest* mFullPressedImageRequest;
|
||||
|
||||
PRUint32 mState;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsXPButton_h___ */
|
65
xpfc/widget/inc/nsXPItem.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsXPItem_h___
|
||||
#define nsXPItem_h___
|
||||
|
||||
#include "nsIXPItem.h"
|
||||
#include "nsXPFCCanvas.h"
|
||||
#include "nsxpenums.h"
|
||||
|
||||
class nsXPItem : public nsIXPItem,
|
||||
public nsXPFCCanvas
|
||||
|
||||
{
|
||||
public:
|
||||
nsXPItem(nsISupports* outer);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init();
|
||||
|
||||
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
|
||||
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
|
||||
|
||||
NS_IMETHOD CreateWidget();
|
||||
|
||||
NS_IMETHOD SetLabel(nsString& aString);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
NS_IMETHOD_(nsEventStatus) PaintBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
NS_IMETHOD_(nsEventStatus) PaintForeground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
|
||||
protected:
|
||||
~nsXPItem();
|
||||
|
||||
protected:
|
||||
nsTextJustification mVerticalJustification;
|
||||
nsTextJustification mHorizontalJustification;
|
||||
nsIImageRequest* mMiniImageRequest;
|
||||
nsIImageRequest* mFullImageRequest;
|
||||
nsShowImage mShowImage;
|
||||
nsShowText mShowText;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsXPItem_h___ */
|
44
xpfc/widget/inc/nsxpenums.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsxpenums_h___
|
||||
#define nsxpenums_h___
|
||||
|
||||
|
||||
enum nsTextJustification {
|
||||
eTextJustification_left,
|
||||
eTextJustification_right,
|
||||
eTextJustification_top,
|
||||
eTextJustification_bottom,
|
||||
eTextJustification_center
|
||||
};
|
||||
|
||||
enum nsShowImage {
|
||||
eShowImage_none,
|
||||
eShowImage_mini,
|
||||
eShowImage_full,
|
||||
};
|
||||
|
||||
enum nsShowText {
|
||||
eShowText_none,
|
||||
eShowText_mini,
|
||||
eShowText_full,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -11,6 +11,8 @@ GDEPTH = ../../..
|
||||
DEPTH = ../../..
|
||||
|
||||
EXPORTS = \
|
||||
nsIXPButton.h \
|
||||
nsIXPItem.h \
|
||||
nsIXPFCButton.h \
|
||||
nsIXPFCTextWidget.h \
|
||||
nsIXPFCTabWidget.h \
|
||||
|
38
xpfc/widget/public/nsIXPButton.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIXPButton_h___
|
||||
#define nsIXPButton_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
//f58c2550-4a7c-11d2-bee2-00805f8a8dbd
|
||||
#define NS_IXP_BUTTON_IID \
|
||||
{ 0xf58c2550, 0x4a7c, 0x11d2, \
|
||||
{0xbe, 0xe2, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
class nsIXPButton : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
NS_IMETHOD Init() = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIXPButton_h___ */
|
||||
|
38
xpfc/widget/public/nsIXPItem.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIXPItem_h___
|
||||
#define nsIXPItem_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
//b9a92c40-4a95-11d2-bee2-00805f8a8dbd
|
||||
#define NS_IXP_ITEM_IID \
|
||||
{ 0xb9a92c40, 0x4a95, 0x11d2, \
|
||||
{0xbe, 0xe2, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
class nsIXPItem : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
NS_IMETHOD Init() = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIXPItem_h___ */
|
||||
|
@ -18,6 +18,8 @@ PRIVATE_EXPORTS = \
|
||||
MODULE = xpfc
|
||||
|
||||
CPPSRCS = \
|
||||
nsXPButton.cpp \
|
||||
nsXPItem.cpp \
|
||||
nsXPFCButton.cpp \
|
||||
nsXPFCTabWidget.cpp \
|
||||
nsXPFCTextWidget.cpp \
|
||||
|
332
xpfc/widget/src/nsXPButton.cpp
Normal file
@ -0,0 +1,332 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsXPButton.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nspr.h"
|
||||
#include "nsIButton.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsXPFCToolkit.h"
|
||||
#include "nsxpfcstrings.h"
|
||||
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsITextWidget.h"
|
||||
#include "nsIButton.h"
|
||||
#include "nsIImageGroup.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIThrobber.h"
|
||||
#include "nsXPItem.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kCXPButtonCID, NS_XP_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCIXPButtonIID, NS_IXP_BUTTON_IID);
|
||||
static NS_DEFINE_IID(kCButtonCID, NS_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kInsButtonIID, NS_IBUTTON_IID);
|
||||
|
||||
#define DEFAULT_WIDTH 50
|
||||
#define DEFAULT_HEIGHT 50
|
||||
|
||||
nsXPButton :: nsXPButton(nsISupports* outer) : nsXPItem(outer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mMiniHoverImageRequest = nsnull;
|
||||
mFullHoverImageRequest = nsnull;
|
||||
mMiniPressedImageRequest = nsnull;
|
||||
mFullPressedImageRequest = nsnull;
|
||||
|
||||
mState = eButtonState_none;
|
||||
}
|
||||
|
||||
nsXPButton :: ~nsXPButton()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsXPButton::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kClassIID, kCXPButtonCID);
|
||||
if (aIID.Equals(kClassIID)) {
|
||||
*aInstancePtr = (void*) (nsXPButton *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kCIXPButtonIID)) {
|
||||
*aInstancePtr = (void*) (nsIXPButton *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return (nsXPItem::QueryInterface(aIID, aInstancePtr));
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsXPButton)
|
||||
NS_IMPL_RELEASE(nsXPButton)
|
||||
|
||||
nsresult nsXPButton :: Init()
|
||||
{
|
||||
|
||||
nsresult res = nsXPItem::Init();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsXPButton :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
{
|
||||
if (aKey.EqualsIgnoreCase(XPFC_STRING_MINIHOVERIMAGE)) {
|
||||
|
||||
CreateImageGroup();
|
||||
|
||||
mMiniHoverImageRequest = RequestImage(aValue);
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_FULLHOVERIMAGE)) {
|
||||
|
||||
CreateImageGroup();
|
||||
|
||||
mFullHoverImageRequest = RequestImage(aValue);
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_MINIPRESSEDIMAGE)) {
|
||||
|
||||
CreateImageGroup();
|
||||
|
||||
mMiniPressedImageRequest = RequestImage(aValue);
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_FULLPRESSEDIMAGE)) {
|
||||
|
||||
CreateImageGroup();
|
||||
|
||||
mFullPressedImageRequest = RequestImage(aValue);
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_ENABLE)) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
return (nsXPItem::SetParameter(aKey, aValue));
|
||||
}
|
||||
|
||||
nsresult nsXPButton :: GetClassPreferredSize(nsSize& aSize)
|
||||
{
|
||||
aSize.width = DEFAULT_WIDTH;
|
||||
aSize.height = DEFAULT_HEIGHT;
|
||||
return (NS_OK);
|
||||
}
|
||||
|
||||
nsresult nsXPButton :: CreateWidget()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsXPButton :: SetLabel(nsString& aString)
|
||||
{
|
||||
nsXPItem::SetLabel(aString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXPButton :: SetBounds(const nsRect &aBounds)
|
||||
{
|
||||
return (nsXPItem::SetBounds(aBounds));
|
||||
}
|
||||
|
||||
nsEventStatus nsXPButton :: OnPaint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
PushState(aRenderingContext);
|
||||
PaintBackground(aRenderingContext,aDirtyRect);
|
||||
PaintForeground(aRenderingContext,aDirtyRect);
|
||||
PopState(aRenderingContext);
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
|
||||
nsEventStatus nsXPButton :: PaintBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
|
||||
nsRect rect;
|
||||
nsIImage * img = nsnull;
|
||||
|
||||
GetBounds(rect);
|
||||
|
||||
if (mShowImage == eShowImage_none)
|
||||
{
|
||||
aRenderingContext.SetColor(GetBackgroundColor());
|
||||
aRenderingContext.FillRect(rect);
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
|
||||
switch(mShowImage)
|
||||
{
|
||||
case eShowImage_mini:
|
||||
if ((mState & eButtonState_pressed) && (mMiniPressedImageRequest != nsnull))
|
||||
img = mMiniPressedImageRequest->GetImage();
|
||||
else if ((mState & eButtonState_hover) && (mMiniHoverImageRequest != nsnull))
|
||||
img = mMiniHoverImageRequest->GetImage();
|
||||
|
||||
if ((img == nsnull) && (mMiniImageRequest != nsnull))
|
||||
img = mMiniImageRequest->GetImage();
|
||||
break;
|
||||
|
||||
case eShowImage_full:
|
||||
if ((mState & eButtonState_pressed) && (mFullPressedImageRequest != nsnull))
|
||||
img = mFullPressedImageRequest->GetImage();
|
||||
else if ((mState & eButtonState_hover) && (mFullHoverImageRequest != nsnull))
|
||||
img = mFullHoverImageRequest->GetImage();
|
||||
|
||||
if ((img == nsnull) && (mFullImageRequest != nsnull))
|
||||
img = mFullImageRequest->GetImage();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (img == nsnull)
|
||||
{
|
||||
aRenderingContext.SetColor(GetBackgroundColor());
|
||||
aRenderingContext.FillRect(rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
aRenderingContext.DrawImage(img, rect.x, rect.y);
|
||||
}
|
||||
|
||||
|
||||
NS_IF_RELEASE(img);
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
nsEventStatus nsXPButton :: PaintForeground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
if (mShowText == eShowText_none)
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
// XXX: We really need to query system-wide colors via gfx system manager here?
|
||||
// On windows, the calls are:
|
||||
//
|
||||
// GetSysColor(COLOR_BTNFACE), GetSysColor(COLOR_GRAYTEXT), GetSysColor(COLOR_GRAYTEXT)
|
||||
|
||||
if ((mState & eButtonState_hover))
|
||||
aRenderingContext.SetColor(NS_RGB(64, 128, 192));
|
||||
else
|
||||
aRenderingContext.SetColor(GetForegroundColor());
|
||||
|
||||
// Draw text based on justifications
|
||||
|
||||
nsRect bounds;
|
||||
nscoord x, y;
|
||||
nscoord string_height, string_width;
|
||||
nsString string = GetLabel();
|
||||
|
||||
GetBounds(bounds);
|
||||
|
||||
/*
|
||||
* compute the Metrics for the string
|
||||
*/
|
||||
|
||||
aRenderingContext.GetFontMetrics()->GetHeight(string_height);
|
||||
aRenderingContext.GetFontMetrics()->GetWidth(string,string_width);
|
||||
|
||||
switch(mVerticalJustification)
|
||||
{
|
||||
|
||||
case eTextJustification_top:
|
||||
y = bounds.y;
|
||||
break;
|
||||
|
||||
case eTextJustification_bottom:
|
||||
y = bounds.y + bounds.height - string_height;
|
||||
break;
|
||||
|
||||
default:
|
||||
y = ((bounds.height - string_height)>>1)+bounds.y;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
switch(mHorizontalJustification)
|
||||
{
|
||||
|
||||
case eTextJustification_left:
|
||||
x = bounds.x;
|
||||
break;
|
||||
|
||||
case eTextJustification_right:
|
||||
x = bounds.x + bounds.width - string_width;
|
||||
break;
|
||||
|
||||
default:
|
||||
x = ((bounds.width - string_width)>>1)+bounds.x;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
aRenderingContext.DrawString(string,string.Length(),x,y,0);
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
nsEventStatus nsXPButton::OnMouseMove(nsGUIEvent *aEvent)
|
||||
{
|
||||
return (nsXPItem::OnMouseMove(aEvent));
|
||||
}
|
||||
|
||||
nsEventStatus nsXPButton::OnMouseEnter(nsGUIEvent *aEvent)
|
||||
{
|
||||
mState |= eButtonState_hover;
|
||||
|
||||
if (gXPFCToolkit->GetCanvasManager()->GetPressedCanvas() == ((nsIXPFCCanvas *)this))
|
||||
mState |= eButtonState_pressed;
|
||||
|
||||
GetWidget()->Invalidate(PR_FALSE);
|
||||
return (nsXPItem::OnMouseEnter(aEvent));
|
||||
}
|
||||
|
||||
nsEventStatus nsXPButton::OnMouseExit(nsGUIEvent *aEvent)
|
||||
{
|
||||
mState &= ~eButtonState_hover;
|
||||
mState &= ~eButtonState_pressed;
|
||||
GetWidget()->Invalidate(PR_FALSE);
|
||||
return (nsXPItem::OnMouseExit(aEvent));
|
||||
}
|
||||
|
||||
nsEventStatus nsXPButton :: OnLeftButtonDown(nsGUIEvent *aEvent)
|
||||
{
|
||||
mState |= eButtonState_pressed;
|
||||
GetWidget()->Invalidate(PR_FALSE);
|
||||
return (nsXPItem::OnLeftButtonDown(aEvent));
|
||||
}
|
||||
|
||||
nsEventStatus nsXPButton :: OnLeftButtonUp(nsGUIEvent *aEvent)
|
||||
{
|
||||
mState &= ~eButtonState_pressed;
|
||||
GetWidget()->Invalidate(PR_FALSE);
|
||||
return (nsXPItem::OnLeftButtonUp(aEvent));
|
||||
}
|
||||
|
296
xpfc/widget/src/nsXPItem.cpp
Normal file
@ -0,0 +1,296 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsXPItem.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nspr.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsXPFCToolkit.h"
|
||||
#include "nsxpfcstrings.h"
|
||||
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsITextWidget.h"
|
||||
#include "nsXPItem.h"
|
||||
#include "nsIImageGroup.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIThrobber.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kCXPItemCID, NS_XP_ITEM_CID);
|
||||
static NS_DEFINE_IID(kCIXPItemIID, NS_IXP_ITEM_IID);
|
||||
|
||||
#define DEFAULT_WIDTH 50
|
||||
#define DEFAULT_HEIGHT 50
|
||||
|
||||
nsXPItem :: nsXPItem(nsISupports* outer) : nsXPFCCanvas(outer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mVerticalJustification = eTextJustification_center;
|
||||
mHorizontalJustification = eTextJustification_center;
|
||||
|
||||
mShowImage = eShowImage_full;
|
||||
mShowText = eShowText_full;
|
||||
|
||||
mMiniImageRequest = nsnull;
|
||||
mFullImageRequest = nsnull;
|
||||
}
|
||||
|
||||
nsXPItem :: ~nsXPItem()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsXPItem::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kClassIID, kCXPItemCID);
|
||||
if (aIID.Equals(kClassIID)) {
|
||||
*aInstancePtr = (void*) (nsXPItem *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kCIXPItemIID)) {
|
||||
*aInstancePtr = (void*) (nsIXPItem *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr));
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsXPItem)
|
||||
NS_IMPL_RELEASE(nsXPItem)
|
||||
|
||||
nsresult nsXPItem :: Init()
|
||||
{
|
||||
|
||||
nsresult res = nsXPFCCanvas::Init();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsXPItem :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
{
|
||||
nsRect bounds;
|
||||
|
||||
GetBounds(bounds);
|
||||
|
||||
if (aKey.EqualsIgnoreCase(XPFC_STRING_MINIIMAGE)) {
|
||||
|
||||
CreateImageGroup();
|
||||
|
||||
mMiniImageRequest = RequestImage(aValue);
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_FULLIMAGE)) {
|
||||
|
||||
CreateImageGroup();
|
||||
|
||||
mFullImageRequest = RequestImage(aValue);
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_VALIGN)) {
|
||||
|
||||
if (aValue.EqualsIgnoreCase(XPFC_STRING_LEFT))
|
||||
mVerticalJustification = eTextJustification_left;
|
||||
else if (aValue.EqualsIgnoreCase(XPFC_STRING_RIGHT))
|
||||
mVerticalJustification = eTextJustification_right;
|
||||
else if (aValue.EqualsIgnoreCase(XPFC_STRING_TOP))
|
||||
mVerticalJustification = eTextJustification_top;
|
||||
else if (aValue.EqualsIgnoreCase(XPFC_STRING_BOTTOM))
|
||||
mVerticalJustification = eTextJustification_bottom;
|
||||
else if (aValue.EqualsIgnoreCase(XPFC_STRING_CENTER))
|
||||
mVerticalJustification = eTextJustification_center;
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_HALIGN)) {
|
||||
|
||||
if (aValue.EqualsIgnoreCase(XPFC_STRING_LEFT))
|
||||
mHorizontalJustification = eTextJustification_left;
|
||||
else if (aValue.EqualsIgnoreCase(XPFC_STRING_RIGHT))
|
||||
mHorizontalJustification = eTextJustification_right;
|
||||
else if (aValue.EqualsIgnoreCase(XPFC_STRING_TOP))
|
||||
mHorizontalJustification = eTextJustification_top;
|
||||
else if (aValue.EqualsIgnoreCase(XPFC_STRING_BOTTOM))
|
||||
mHorizontalJustification = eTextJustification_bottom;
|
||||
else if (aValue.EqualsIgnoreCase(XPFC_STRING_CENTER))
|
||||
mHorizontalJustification = eTextJustification_center;
|
||||
|
||||
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_ENABLE)) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
return (nsXPFCCanvas::SetParameter(aKey, aValue));
|
||||
}
|
||||
|
||||
nsresult nsXPItem :: GetClassPreferredSize(nsSize& aSize)
|
||||
{
|
||||
aSize.width = DEFAULT_WIDTH;
|
||||
aSize.height = DEFAULT_HEIGHT;
|
||||
return (NS_OK);
|
||||
}
|
||||
|
||||
nsresult nsXPItem :: CreateWidget()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsXPItem :: SetLabel(nsString& aString)
|
||||
{
|
||||
nsXPFCCanvas::SetLabel(aString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXPItem :: SetBounds(const nsRect &aBounds)
|
||||
{
|
||||
return (nsXPFCCanvas::SetBounds(aBounds));
|
||||
}
|
||||
|
||||
nsEventStatus nsXPItem :: OnPaint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
PushState(aRenderingContext);
|
||||
PaintBackground(aRenderingContext,aDirtyRect);
|
||||
PaintForeground(aRenderingContext,aDirtyRect);
|
||||
PopState(aRenderingContext);
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
|
||||
nsEventStatus nsXPItem :: PaintBackground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
|
||||
nsRect rect;
|
||||
nsIImage * img = nsnull;
|
||||
|
||||
GetBounds(rect);
|
||||
|
||||
if (mShowImage == eShowImage_none)
|
||||
{
|
||||
aRenderingContext.SetColor(GetBackgroundColor());
|
||||
aRenderingContext.FillRect(rect);
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
|
||||
switch(mShowImage)
|
||||
{
|
||||
case eShowImage_mini:
|
||||
if (mMiniImageRequest != nsnull)
|
||||
img = mMiniImageRequest->GetImage();
|
||||
break;
|
||||
|
||||
case eShowImage_full:
|
||||
if (mFullImageRequest != nsnull)
|
||||
img = mFullImageRequest->GetImage();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (img == nsnull)
|
||||
{
|
||||
aRenderingContext.SetColor(GetBackgroundColor());
|
||||
aRenderingContext.FillRect(rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
aRenderingContext.DrawImage(img, rect.x, rect.y);
|
||||
}
|
||||
|
||||
|
||||
NS_IF_RELEASE(img);
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
nsEventStatus nsXPItem :: PaintForeground(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
if (mShowText == eShowText_none)
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
// XXX: We really need to query system-wide colors via gfx system manager here?
|
||||
// On windows, the calls are:
|
||||
//
|
||||
// GetSysColor(COLOR_BTNFACE), GetSysColor(COLOR_GRAYTEXT), GetSysColor(COLOR_GRAYTEXT)
|
||||
aRenderingContext.SetColor(GetForegroundColor());
|
||||
|
||||
// Draw text based on justifications
|
||||
|
||||
nsRect bounds;
|
||||
nscoord x, y;
|
||||
nscoord string_height, string_width;
|
||||
nsString string = GetLabel();
|
||||
|
||||
GetBounds(bounds);
|
||||
|
||||
/*
|
||||
* compute the Metrics for the string
|
||||
*/
|
||||
|
||||
aRenderingContext.GetFontMetrics()->GetHeight(string_height);
|
||||
aRenderingContext.GetFontMetrics()->GetWidth(string,string_width);
|
||||
|
||||
switch(mVerticalJustification)
|
||||
{
|
||||
|
||||
case eTextJustification_top:
|
||||
y = bounds.y;
|
||||
break;
|
||||
|
||||
case eTextJustification_bottom:
|
||||
y = bounds.y + bounds.height - string_height;
|
||||
break;
|
||||
|
||||
default:
|
||||
y = ((bounds.height - string_height)>>1)+bounds.y;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
switch(mHorizontalJustification)
|
||||
{
|
||||
|
||||
case eTextJustification_left:
|
||||
x = bounds.x;
|
||||
break;
|
||||
|
||||
case eTextJustification_right:
|
||||
x = bounds.x + bounds.width - string_width;
|
||||
break;
|
||||
|
||||
default:
|
||||
x = ((bounds.width - string_width)>>1)+bounds.x;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
aRenderingContext.DrawString(string,string.Length(),x,y,0);
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|