making dialog re-center on doubleclick on title bar

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

View file

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

View file

@ -1269,6 +1269,7 @@ requires
.addClass("OxTitleBar") .addClass("OxTitleBar")
//.html(self.options.title) //.html(self.options.title)
.mousedown(drag) .mousedown(drag)
.dblclick(center)
.appendTo(that); .appendTo(that);
that.$title = new Ox.Element() that.$title = new Ox.Element()
.addClass("OxTitle") .addClass("OxTitle")
@ -1310,6 +1311,16 @@ requires
that.$layer = new Ox.Element() that.$layer = new Ox.Element()
.addClass("OxLayer"); .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) { function drag(event) {
var documentWidth = $document.width(), var documentWidth = $document.width(),
documentHeight = $document.height(), documentHeight = $document.height(),

View file

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