зеркало из https://github.com/mozilla/gecko-dev.git
basic view event selection
This commit is contained in:
Родитель
599dfa411c
Коммит
c8dff7c48f
|
@ -82,6 +82,10 @@ textbox.editable-label {
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
calendar-event-box.selected .calendar-event-box-container {
|
||||||
|
background: #ffdb67 !important;
|
||||||
|
}
|
||||||
|
|
||||||
/*== calendar-event-gripbar ==*/
|
/*== calendar-event-gripbar ==*/
|
||||||
|
|
||||||
calendar-event-gripbar {
|
calendar-event-gripbar {
|
||||||
|
|
|
@ -373,6 +373,51 @@
|
||||||
|
|
||||||
<!-- methods -->
|
<!-- methods -->
|
||||||
|
|
||||||
|
<method name="selectOccurrence">
|
||||||
|
<parameter name="aOccurrence"/>
|
||||||
|
<body><![CDATA[
|
||||||
|
// if we're being asked to unselect, and we
|
||||||
|
// don't have a selection, return.
|
||||||
|
if (aOccurrence == null && !this.mCurrentSelection)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (this.mCurrentSelection) {
|
||||||
|
// XXX FIXME don't unconditionally removeAttribute("class"), instead
|
||||||
|
// just remove the "selected" class.
|
||||||
|
this.mCurrentSelection.eventbox.removeAttribute("class");
|
||||||
|
this.mCurrentSelection = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aOccurrence) {
|
||||||
|
var chunk = this.findChunkForOccurrence(aOccurrence);
|
||||||
|
if (!chunk) {
|
||||||
|
dump ("++ Couldn't find chunk to select!!!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk.eventbox.setAttribute("class", "selected");
|
||||||
|
this.mCurrentSelection = chunk;
|
||||||
|
}
|
||||||
|
]]></body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
|
||||||
|
<method name="findChunkForOccurrence">
|
||||||
|
<parameter name="aOccurrence"/>
|
||||||
|
<body><![CDATA[
|
||||||
|
for each (chunk in this.mEvents) {
|
||||||
|
if (chunk.event.item == aOccurrence.item &&
|
||||||
|
chunk.event.occurrenceStartDate.compare(aOccurrence.occurrenceStartDate) == 0 &&
|
||||||
|
chunk.event.occurrenceEndDate.compare(aOccurrence.occurrenceEndDate) == 0)
|
||||||
|
{
|
||||||
|
return chunk;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
]]></body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<method name="setAttribute">
|
<method name="setAttribute">
|
||||||
<parameter name="aAttr"/>
|
<parameter name="aAttr"/>
|
||||||
<parameter name="aVal"/>
|
<parameter name="aVal"/>
|
||||||
|
@ -572,6 +617,8 @@
|
||||||
|
|
||||||
chunkBox.calendarView = this.calendarView;
|
chunkBox.calendarView = this.calendarView;
|
||||||
chunkBox.occurrence = chunk.event.event;
|
chunkBox.occurrence = chunk.event.event;
|
||||||
|
|
||||||
|
chunk.event.eventbox = chunkBox;
|
||||||
} else {
|
} else {
|
||||||
var chunkBox = createXULElement("spacer");
|
var chunkBox = createXULElement("spacer");
|
||||||
chunkBox.setAttribute("orient", orient);
|
chunkBox.setAttribute("orient", orient);
|
||||||
|
@ -1041,6 +1088,7 @@
|
||||||
<handlers>
|
<handlers>
|
||||||
<handler event="mousedown">
|
<handler event="mousedown">
|
||||||
dump ("event select\n");
|
dump ("event select\n");
|
||||||
|
this.calendarView.selectedOccurrence = this.mOccurrence;
|
||||||
event.preventBubble();
|
event.preventBubble();
|
||||||
</handler>
|
</handler>
|
||||||
|
|
||||||
|
@ -1094,6 +1142,7 @@
|
||||||
<field name="mDateColumns">null</field>
|
<field name="mDateColumns">null</field>
|
||||||
<field name="mBatchCount">0</field>
|
<field name="mBatchCount">0</field>
|
||||||
<field name="mPixPerMin">0.6</field>
|
<field name="mPixPerMin">0.6</field>
|
||||||
|
<field name="mSelectedOccurrence">null</field>
|
||||||
|
|
||||||
<field name="mObserver"><![CDATA[
|
<field name="mObserver"><![CDATA[
|
||||||
// the calIObserver, and calICompositeObserver
|
// the calIObserver, and calICompositeObserver
|
||||||
|
@ -1316,6 +1365,30 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<property name="selectedOccurrence">
|
||||||
|
<getter><![CDATA[
|
||||||
|
return this.mSelectedOccurrence;
|
||||||
|
]]></getter>
|
||||||
|
<setter><![CDATA[
|
||||||
|
if (this.mSelectedOccurrence != val) {
|
||||||
|
if (this.mSelectedOccurrence) {
|
||||||
|
var col = this.findColumnForEvent(this.mSelectedOccurrence);
|
||||||
|
col.column.selectOccurrence(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val) {
|
||||||
|
var col = this.findColumnForEvent(val);
|
||||||
|
if (col)
|
||||||
|
col.column.selectOccurrence(val);
|
||||||
|
else
|
||||||
|
val = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (this.mSelectedOccurrence = val);
|
||||||
|
}
|
||||||
|
]]></setter>
|
||||||
|
</property>
|
||||||
|
|
||||||
<property name="pixelsPerMinute">
|
<property name="pixelsPerMinute">
|
||||||
<getter>return this.mPixPerMin</getter>
|
<getter>return this.mPixPerMin</getter>
|
||||||
<setter>this.setPixelsPerMin(val); return val;</setter>
|
<setter>this.setPixelsPerMin(val); return val;</setter>
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
interface calICalendar;
|
interface calICalendar;
|
||||||
interface calIDateTime;
|
interface calIDateTime;
|
||||||
interface calICalendarViewController;
|
interface calICalendarViewController;
|
||||||
|
interface calIItemOccurrence;
|
||||||
|
|
||||||
[scriptable, uuid(be9b4f26-2475-4aeb-9b46-e165fc0809fb)]
|
[scriptable, uuid(be9b4f26-2475-4aeb-9b46-e165fc0809fb)]
|
||||||
interface calICalendarView : nsISupports
|
interface calICalendarView : nsISupports
|
||||||
|
@ -100,4 +101,9 @@ interface calICalendarView : nsISupports
|
||||||
* day and return the full set.
|
* day and return the full set.
|
||||||
*/
|
*/
|
||||||
void getDateList(out unsigned long aCount, [array,size_is(aCount),retval] out calIDateTime aDates);
|
void getDateList(out unsigned long aCount, [array,size_is(aCount),retval] out calIDateTime aDates);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get or set the selected occurrence. Only one occurrence may be selected.
|
||||||
|
*/
|
||||||
|
attribute calIItemOccurrence selectedOccurrence;
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче