Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ba69c085
Kaydet (Commit)
ba69c085
authored
May 03, 2013
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
implement native button order for messageboxes
Change-Id: I85d0991da3d2a1efa9d5c15569164d8bd2194356
üst
2e2e1fec
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
128 additions
and
10 deletions
+128
-10
builder.hxx
include/vcl/builder.hxx
+6
-4
layout.hxx
include/vcl/layout.hxx
+6
-0
querysavedialog.ui
sfx2/uiconfig/ui/querysavedialog.ui
+6
-6
layout.cxx
vcl/source/window/layout.cxx
+110
-0
No files found.
include/vcl/builder.hxx
Dosyayı görüntüle @
ba69c085
...
@@ -290,9 +290,14 @@ public:
...
@@ -290,9 +290,14 @@ public:
static
OString
extractCustomProperty
(
stringmap
&
rMap
);
static
OString
extractCustomProperty
(
stringmap
&
rMap
);
//see m_aDeferredProperties
//see m_aDeferredProperties, you need this for toplevel dialogs
//which build themselves from their ctor. The properties on
//the top level are stored in m_aDeferredProperties and need
//to be applied post ctor
void
setDeferredProperties
();
void
setDeferredProperties
();
//Helpers to retrofit all the existing code to the builder
static
void
reorderWithinParent
(
Window
&
rWindow
,
sal_uInt16
nNewPosition
);
private
:
private
:
Window
*
insertObject
(
Window
*
pParent
,
const
OString
&
rClass
,
const
OString
&
rID
,
Window
*
insertObject
(
Window
*
pParent
,
const
OString
&
rClass
,
const
OString
&
rID
,
stringmap
&
rProps
,
stringmap
&
rPangoAttributes
,
stringmap
&
rProps
,
stringmap
&
rPangoAttributes
,
...
@@ -350,9 +355,6 @@ private:
...
@@ -350,9 +355,6 @@ private:
void
cleanupWidgetOwnScrolling
(
Window
*
pScrollParent
,
Window
*
pWindow
,
stringmap
&
rMap
);
void
cleanupWidgetOwnScrolling
(
Window
*
pScrollParent
,
Window
*
pWindow
,
stringmap
&
rMap
);
void
set_response
(
OString
sID
,
short
nResponse
);
void
set_response
(
OString
sID
,
short
nResponse
);
//Helpers to retrofit all the existing code to the builder
static
void
reorderWithinParent
(
Window
&
rWindow
,
sal_uInt16
nNewPosition
);
};
};
...
...
include/vcl/layout.hxx
Dosyayı görüntüle @
ba69c085
...
@@ -61,6 +61,7 @@ class VCL_DLLPUBLIC VclBox : public VclContainer
...
@@ -61,6 +61,7 @@ class VCL_DLLPUBLIC VclBox : public VclContainer
{
{
protected
:
protected
:
bool
m_bHomogeneous
;
bool
m_bHomogeneous
;
bool
m_bVerticalContainer
;
int
m_nSpacing
;
int
m_nSpacing
;
public
:
public
:
VclBox
(
Window
*
pParent
,
bool
bHomogeneous
,
int
nSpacing
)
VclBox
(
Window
*
pParent
,
bool
bHomogeneous
,
int
nSpacing
)
...
@@ -112,6 +113,7 @@ public:
...
@@ -112,6 +113,7 @@ public:
VclVBox
(
Window
*
pParent
,
bool
bHomogeneous
=
false
,
int
nSpacing
=
0
)
VclVBox
(
Window
*
pParent
,
bool
bHomogeneous
=
false
,
int
nSpacing
=
0
)
:
VclBox
(
pParent
,
bHomogeneous
,
nSpacing
)
:
VclBox
(
pParent
,
bHomogeneous
,
nSpacing
)
{
{
m_bVerticalContainer
=
true
;
}
}
protected
:
protected
:
virtual
long
getPrimaryDimension
(
const
Size
&
rSize
)
const
virtual
long
getPrimaryDimension
(
const
Size
&
rSize
)
const
...
@@ -158,6 +160,7 @@ public:
...
@@ -158,6 +160,7 @@ public:
VclHBox
(
Window
*
pParent
,
bool
bHomogeneous
=
false
,
int
nSpacing
=
0
)
VclHBox
(
Window
*
pParent
,
bool
bHomogeneous
=
false
,
int
nSpacing
=
0
)
:
VclBox
(
pParent
,
bHomogeneous
,
nSpacing
)
:
VclBox
(
pParent
,
bHomogeneous
,
nSpacing
)
{
{
m_bVerticalContainer
=
false
;
}
}
protected
:
protected
:
virtual
long
getPrimaryDimension
(
const
Size
&
rSize
)
const
virtual
long
getPrimaryDimension
(
const
Size
&
rSize
)
const
...
@@ -225,6 +228,7 @@ public:
...
@@ -225,6 +228,7 @@ public:
return
m_eLayoutStyle
;
return
m_eLayoutStyle
;
}
}
virtual
bool
set_property
(
const
OString
&
rKey
,
const
OString
&
rValue
);
virtual
bool
set_property
(
const
OString
&
rKey
,
const
OString
&
rValue
);
void
sort_native_button_order
();
protected
:
protected
:
virtual
Size
calculateRequisition
()
const
;
virtual
Size
calculateRequisition
()
const
;
virtual
void
setAllocation
(
const
Size
&
rAllocation
);
virtual
void
setAllocation
(
const
Size
&
rAllocation
);
...
@@ -248,6 +252,7 @@ public:
...
@@ -248,6 +252,7 @@ public:
VclVButtonBox
(
Window
*
pParent
,
int
nSpacing
=
0
)
VclVButtonBox
(
Window
*
pParent
,
int
nSpacing
=
0
)
:
VclButtonBox
(
pParent
,
nSpacing
)
:
VclButtonBox
(
pParent
,
nSpacing
)
{
{
m_bVerticalContainer
=
true
;
}
}
protected
:
protected
:
virtual
long
getPrimaryDimension
(
const
Size
&
rSize
)
const
virtual
long
getPrimaryDimension
(
const
Size
&
rSize
)
const
...
@@ -294,6 +299,7 @@ public:
...
@@ -294,6 +299,7 @@ public:
VclHButtonBox
(
Window
*
pParent
,
int
nSpacing
=
0
)
VclHButtonBox
(
Window
*
pParent
,
int
nSpacing
=
0
)
:
VclButtonBox
(
pParent
,
nSpacing
)
:
VclButtonBox
(
pParent
,
nSpacing
)
{
{
m_bVerticalContainer
=
false
;
}
}
protected
:
protected
:
virtual
long
getPrimaryDimension
(
const
Size
&
rSize
)
const
virtual
long
getPrimaryDimension
(
const
Size
&
rSize
)
const
...
...
sfx2/uiconfig/ui/querysavedialog.ui
Dosyayı görüntüle @
ba69c085
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<property
name=
"can_focus"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"layout_style"
>
end
</property>
<property
name=
"layout_style"
>
end
</property>
<child>
<child>
<object
class=
"GtkButton"
id=
"
button3
"
>
<object
class=
"GtkButton"
id=
"
discard
"
>
<property
name=
"label"
translatable=
"yes"
>
Close _without saving
</property>
<property
name=
"label"
translatable=
"yes"
>
Close _without saving
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
</packing>
</packing>
</child>
</child>
<child>
<child>
<object
class=
"GtkButton"
id=
"
button1
"
>
<object
class=
"GtkButton"
id=
"
cancel
"
>
<property
name=
"label"
>
gtk-cancel
</property>
<property
name=
"label"
>
gtk-cancel
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
</packing>
</packing>
</child>
</child>
<child>
<child>
<object
class=
"GtkButton"
id=
"
button2
"
>
<object
class=
"GtkButton"
id=
"
save
"
>
<property
name=
"label"
>
gtk-save
</property>
<property
name=
"label"
>
gtk-save
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
...
@@ -75,9 +75,9 @@
...
@@ -75,9 +75,9 @@
</object>
</object>
</child>
</child>
<action-widgets>
<action-widgets>
<action-widget
response=
"3"
>
button3
</action-widget>
<action-widget
response=
"3"
>
discard
</action-widget>
<action-widget
response=
"0"
>
button1
</action-widget>
<action-widget
response=
"0"
>
cancel
</action-widget>
<action-widget
response=
"2"
>
button2
</action-widget>
<action-widget
response=
"2"
>
save
</action-widget>
</action-widgets>
</action-widgets>
</object>
</object>
</interface>
</interface>
vcl/source/window/layout.cxx
Dosyayı görüntüle @
ba69c085
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include <vcl/dialog.hxx>
#include <vcl/dialog.hxx>
#include <vcl/layout.hxx>
#include <vcl/layout.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
#include "window.h"
#include "window.h"
VclContainer
::
VclContainer
(
Window
*
pParent
,
WinBits
nStyle
)
VclContainer
::
VclContainer
(
Window
*
pParent
,
WinBits
nStyle
)
...
@@ -596,6 +597,110 @@ void VclButtonBox::setAllocation(const Size &rAllocation)
...
@@ -596,6 +597,110 @@ void VclButtonBox::setAllocation(const Size &rAllocation)
}
}
}
}
struct
ButtonOrder
{
OString
m_aType
;
int
m_nPriority
;
};
int
getButtonPriority
(
const
OString
&
rType
)
{
const
size_t
N_TYPES
=
3
;
static
const
ButtonOrder
aDiscardCancelSave
[
N_TYPES
]
=
{
{
"/discard"
,
0
},
{
"/cancel"
,
1
},
{
"/save"
,
2
}
};
static
const
ButtonOrder
aSaveDiscardCancel
[
N_TYPES
]
=
{
{
"/save"
,
0
},
{
"/discard"
,
1
},
{
"/cancel"
,
2
}
};
const
ButtonOrder
*
pOrder
=
&
aDiscardCancelSave
[
0
];
const
OUString
&
rEnv
=
Application
::
GetDesktopEnvironment
();
if
(
rEnv
.
equalsIgnoreAsciiCase
(
"windows"
)
||
rEnv
.
equalsIgnoreAsciiCase
(
"kde4"
)
||
rEnv
.
equalsIgnoreAsciiCase
(
"tde"
)
||
rEnv
.
equalsIgnoreAsciiCase
(
"kde"
))
{
pOrder
=
&
aSaveDiscardCancel
[
0
];
}
for
(
size_t
i
=
0
;
i
<
N_TYPES
;
++
i
,
++
pOrder
)
{
if
(
rType
.
endsWith
(
pOrder
->
m_aType
))
return
pOrder
->
m_nPriority
;
}
return
-
1
;
}
class
sortButtons
:
public
std
::
binary_function
<
const
Window
*
,
const
Window
*
,
bool
>
{
bool
m_bVerticalContainer
;
public
:
sortButtons
(
bool
bVerticalContainer
)
:
m_bVerticalContainer
(
bVerticalContainer
)
{
}
bool
operator
()(
const
Window
*
pA
,
const
Window
*
pB
)
const
;
};
bool
sortButtons
::
operator
()(
const
Window
*
pA
,
const
Window
*
pB
)
const
{
//sort into two groups of pack start and pack end
VclPackType
ePackA
=
pA
->
get_pack_type
();
VclPackType
ePackB
=
pB
->
get_pack_type
();
if
(
ePackA
<
ePackB
)
return
true
;
if
(
ePackA
>
ePackB
)
return
false
;
bool
bPackA
=
pA
->
get_secondary
();
bool
bPackB
=
pB
->
get_secondary
();
if
(
!
m_bVerticalContainer
)
{
//for horizontal boxes group secondaries before primaries
if
(
bPackA
>
bPackB
)
return
true
;
if
(
bPackA
<
bPackB
)
return
false
;
}
else
{
//for vertical boxes group secondaries after primaries
if
(
bPackA
<
bPackB
)
return
true
;
if
(
bPackA
>
bPackB
)
return
false
;
}
//now order within groups according to platform rules
return
getButtonPriority
(
pA
->
GetHelpId
())
<
getButtonPriority
(
pB
->
GetHelpId
());
}
void
VclButtonBox
::
sort_native_button_order
()
{
std
::
vector
<
Window
*>
aChilds
;
for
(
Window
*
pChild
=
GetWindow
(
WINDOW_FIRSTCHILD
);
pChild
;
pChild
=
pChild
->
GetWindow
(
WINDOW_NEXT
))
{
aChilds
.
push_back
(
pChild
);
}
//sort child order within parent so that we match the platform
//button order
std
::
stable_sort
(
aChilds
.
begin
(),
aChilds
.
end
(),
sortButtons
(
m_bVerticalContainer
));
for
(
size_t
i
=
0
;
i
<
aChilds
.
size
();
++
i
)
VclBuilder
::
reorderWithinParent
(
*
aChilds
[
i
],
i
);
}
VclGrid
::
array_type
VclGrid
::
assembleGrid
()
const
VclGrid
::
array_type
VclGrid
::
assembleGrid
()
const
{
{
ext_array_type
A
;
ext_array_type
A
;
...
@@ -1692,6 +1797,11 @@ short MessageDialog::Execute()
...
@@ -1692,6 +1797,11 @@ short MessageDialog::Execute()
m_pGrid
->
Show
();
m_pGrid
->
Show
();
setButtonHandlers
();
setButtonHandlers
();
VclButtonBox
*
pButtonBox
=
get_action_area
();
assert
(
pButtonBox
);
pButtonBox
->
sort_native_button_order
();
}
}
return
Dialog
::
Execute
();
return
Dialog
::
Execute
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment