making dialog re-center on doubleclick on title bar

This commit is contained in:
Rolux 2010-02-21 11:53:37 +05:30
parent 5e10355c1a
commit 4bdac7c195
3 changed files with 22 additions and 4 deletions

View File

@ -118,6 +118,9 @@ Dialog
.OxDialog > .OxButtonsBar > .OxButton.OxLeft {
float: left;
}
.OxDialog > .OxButtonsBar > .OxButton.OxLeft:first-child {
margin-left: 16px;
}
.OxDialog > .OxButtonsBar > .OxButton.OxRight {
float: right;
}

View File

@ -1269,6 +1269,7 @@ requires
.addClass("OxTitleBar")
//.html(self.options.title)
.mousedown(drag)
.dblclick(center)
.appendTo(that);
that.$title = new Ox.Element()
.addClass("OxTitle")
@ -1310,6 +1311,16 @@ requires
that.$layer = new Ox.Element()
.addClass("OxLayer");
function center() {
that.css({
left: 0,
top: parseInt(-$document.height() / 10) + "px", // fixme: duplicated
right: 0,
bottom: 0,
margin: "auto"
});
}
function drag(event) {
var documentWidth = $document.width(),
documentHeight = $document.height(),

View File

@ -195,10 +195,14 @@
var loginDialog = new Ox.Dialog({
buttons: [
{ value: "Register", click: function() { loginDialog.close(); } },
{ value: "Reset Password", click: function() { loginDialog.close(); } },
{ value: "Cancel", click: function() { loginDialog.close(); } },
{ value: "Login", click: function() { loginDialog.close(); } }
[
{ value: "Register", click: function() { loginDialog.close(); } },
{ value: "Reset Password", click: function() { loginDialog.close(); } }
],
[
{ value: "Cancel", click: function() { loginDialog.close(); } },
{ value: "Login", click: function() { loginDialog.close(); } }
]
],
title: "Login"
});