updating dialog

This commit is contained in:
Rolux 2010-02-20 09:12:03 +05:30
commit 6c2304022d
4 changed files with 71 additions and 29 deletions

View file

@ -1230,49 +1230,49 @@ requires
*/
Ox.Dialog = function(options, self) {
// fixme: this was just pasted from previous version ... update
// fixme: dialog should be derived from a generic draggable
var self = self || {},
options = $.extend({
title: "",
buttons: [],
width: 384,
height: 128
}, options),
that = new Ox.Element()
that = new Ox.Element("div", self)
.defaults({
title: "",
buttons: [],
width: 384,
height: 128
})
.options(options || {})
.addClass("OxDialog")
.css({
left: (($(document).width() - options.width) / 2) + "px",
top: (($(document).height() - options.height - 92) / 2) + "px",
width: options.width + "px",
height: (options.height + 92) + "px"
left: (($document.width() - self.options.width) / 2) + "px",
top: (($document.height() - self.options.height - 68) / 2) + "px",
width: self.options.width + "px",
height: (self.options.height + 68) + "px"
});
that.$titlebar = new Ox.Bar({
size: "medium"
})
.addClass("OxTitleBar")
//.html(options.title)
//.html(self.options.title)
.mousedown(function(e) {
var offset = that.offset(),
//maxLeft = $(document).width() - that.width(),
//maxTop = $(document).height() - that.height(),
x = e.clientX,
y = e.clientY,
documentWidth = $(document).width();
documentHeight = $(document).height();
documentWidth = $document.width();
documentHeight = $document.height();
$(window).mousemove(function(e) {
$("*").css({
WebkitUserSelect: "none"
});
var left = Ox.limit(offset.left - x + e.clientX, 24 - options.width, documentWidth - 24),
var left = Ox.limit(offset.left - x + e.clientX, 24 - self.options.width, documentWidth - 24),
top = Ox.limit(offset.top - y + e.clientY, 24, documentHeight - 24);
that.css({
left: left + "px",
top: top + "px"
});
});
$(window).one("mouseup", function() {
$(window).unbind("mousemove");
$window.one("mouseup", function() {
$window.unbind("mousemove");
$("*").css({
WebkitUserSelect: "auto"
});
@ -1281,19 +1281,19 @@ requires
.appendTo(that);
that.$title = new Ox.Element()
.addClass("OxTitle")
.html(options.title)
.html(self.options.title)
.appendTo(that.$titlebar);
that.$content = new Ox.Container()
.addClass("OxContent")
.css({
height: options.height + "px"
height: self.options.height + "px"
})
.appendTo(that);
that.$buttonsbar = new Ox.Element()
.addClass("OxButtonsBar")
.appendTo(that);
that.$buttons = [];
$.each(options.buttons, function(i, button) {
$.each(self.options.buttons, function(i, button) {
that.$buttons[i] = new Ox.Button({
size: "medium",
value: button.value
@ -2745,7 +2745,9 @@ requires
}
}
that.addItem = function(item, position)
that.addItem = function(item, position) {
};
that.addItemAfter = function(item, id) {