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
841b975a
Kaydet (Commit)
841b975a
authored
Eki 22, 2012
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
implement secondary button groups in buttonboxes
Change-Id: I0e60b7e197ba4f6ebd3f24cb2e9072ce3e1353fb
üst
349cf01b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
29 deletions
+74
-29
layout.hxx
vcl/inc/vcl/layout.hxx
+12
-0
builder.cxx
vcl/source/window/builder.cxx
+7
-0
layout.cxx
vcl/source/window/layout.cxx
+55
-29
No files found.
vcl/inc/vcl/layout.hxx
Dosyayı görüntüle @
841b975a
...
@@ -201,6 +201,18 @@ protected:
...
@@ -201,6 +201,18 @@ protected:
virtual
void
setAllocation
(
const
Size
&
rAllocation
);
virtual
void
setAllocation
(
const
Size
&
rAllocation
);
private
:
private
:
VclButtonBoxStyle
m_eLayoutStyle
;
VclButtonBoxStyle
m_eLayoutStyle
;
struct
Requisition
{
sal_uInt16
m_nPrimaryChildren
;
sal_uInt16
m_nSecondaryChildren
;
Size
m_aSize
;
Requisition
()
:
m_nPrimaryChildren
(
0
)
,
m_nSecondaryChildren
(
0
)
{
}
};
Requisition
calculatePrimarySecondaryRequisitions
()
const
;
};
};
class
VCL_DLLPUBLIC
VclVButtonBox
:
public
VclButtonBox
class
VCL_DLLPUBLIC
VclVButtonBox
:
public
VclButtonBox
...
...
vcl/source/window/builder.cxx
Dosyayı görüntüle @
841b975a
...
@@ -1076,6 +1076,13 @@ bool VclBuilder::sortIntoBestTabTraversalOrder::operator()(const Window *pA, con
...
@@ -1076,6 +1076,13 @@ bool VclBuilder::sortIntoBestTabTraversalOrder::operator()(const Window *pA, con
return
true
;
return
true
;
if
(
ePackA
>
ePackB
)
if
(
ePackA
>
ePackB
)
return
false
;
return
false
;
//group secondaries before primaries
bool
bPackA
=
pA
->
get_secondary
();
bool
bPackB
=
pB
->
get_secondary
();
if
(
bPackA
>
bPackB
)
return
true
;
if
(
bPackA
<
bPackB
)
return
false
;
//honour relative box positions with pack group
//honour relative box positions with pack group
return
m_pBuilder
->
get_window_packing_position
(
pA
)
<
m_pBuilder
->
get_window_packing_position
(
pB
);
return
m_pBuilder
->
get_window_packing_position
(
pA
)
<
m_pBuilder
->
get_window_packing_position
(
pB
);
}
}
...
...
vcl/source/window/layout.cxx
Dosyayı görüntüle @
841b975a
...
@@ -243,9 +243,9 @@ bool VclBox::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
...
@@ -243,9 +243,9 @@ bool VclBox::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
#define DEFAULT_CHILD_MIN_WIDTH 85
#define DEFAULT_CHILD_MIN_WIDTH 85
#define DEFAULT_CHILD_MIN_HEIGHT 27
#define DEFAULT_CHILD_MIN_HEIGHT 27
Size
VclButtonBox
::
calculateRequisition
()
const
VclButtonBox
::
Requisition
VclButtonBox
::
calculatePrimarySecondaryRequisitions
()
const
{
{
sal_uInt16
nVisibleChildren
=
0
;
Requisition
aReq
;
sal_Int32
nChildMinWidth
=
DEFAULT_CHILD_MIN_WIDTH
;
//to-do, pull from theme
sal_Int32
nChildMinWidth
=
DEFAULT_CHILD_MIN_WIDTH
;
//to-do, pull from theme
sal_Int32
nChildMinHeight
=
DEFAULT_CHILD_MIN_HEIGHT
;
//to-do, pull from theme
sal_Int32
nChildMinHeight
=
DEFAULT_CHILD_MIN_HEIGHT
;
//to-do, pull from theme
...
@@ -255,8 +255,10 @@ Size VclButtonBox::calculateRequisition() const
...
@@ -255,8 +255,10 @@ Size VclButtonBox::calculateRequisition() const
{
{
if
(
!
pChild
->
IsVisible
())
if
(
!
pChild
->
IsVisible
())
continue
;
continue
;
SAL_WARN_IF
(
pChild
->
get_secondary
(),
"vcl.layout"
,
"secondary groups not implemented yet"
);
if
(
pChild
->
get_secondary
())
++
nVisibleChildren
;
++
aReq
.
m_nSecondaryChildren
;
else
++
aReq
.
m_nPrimaryChildren
;
Size
aChildSize
=
getLayoutRequisition
(
*
pChild
);
Size
aChildSize
=
getLayoutRequisition
(
*
pChild
);
if
(
aChildSize
.
Width
()
>
aSize
.
Width
())
if
(
aChildSize
.
Width
()
>
aSize
.
Width
())
aSize
.
Width
()
=
aChildSize
.
Width
();
aSize
.
Width
()
=
aChildSize
.
Width
();
...
@@ -264,18 +266,25 @@ Size VclButtonBox::calculateRequisition() const
...
@@ -264,18 +266,25 @@ Size VclButtonBox::calculateRequisition() const
aSize
.
Height
()
=
aChildSize
.
Height
();
aSize
.
Height
()
=
aChildSize
.
Height
();
}
}
sal_uInt16
nVisibleChildren
=
aReq
.
m_nPrimaryChildren
+
aReq
.
m_nSecondaryChildren
;
if
(
!
nVisibleChildren
)
if
(
!
nVisibleChildren
)
return
Size
()
;
return
aReq
;
long
nPrimaryDimension
=
long
nPrimaryDimension
=
(
getPrimaryDimension
(
aSize
)
*
nVisibleChildren
)
+
(
getPrimaryDimension
(
aSize
)
*
nVisibleChildren
)
+
(
m_nSpacing
*
(
nVisibleChildren
-
1
));
(
m_nSpacing
*
(
nVisibleChildren
-
1
));
setPrimaryDimension
(
aSize
,
nPrimaryDimension
+
m_nSpacing
);
setPrimaryDimension
(
a
Req
.
m_a
Size
,
nPrimaryDimension
+
m_nSpacing
);
long
nSecondaryDimension
=
getSecondaryDimension
(
aSize
);
long
nSecondaryDimension
=
getSecondaryDimension
(
aSize
);
setSecondaryDimension
(
aSize
,
nSecondaryDimension
);
setSecondaryDimension
(
a
Req
.
m_a
Size
,
nSecondaryDimension
);
return
aSize
;
return
aReq
;
}
Size
VclButtonBox
::
calculateRequisition
()
const
{
return
calculatePrimarySecondaryRequisitions
().
m_aSize
;
}
}
bool
VclButtonBox
::
set_property
(
const
rtl
::
OString
&
rKey
,
const
rtl
::
OString
&
rValue
)
bool
VclButtonBox
::
set_property
(
const
rtl
::
OString
&
rKey
,
const
rtl
::
OString
&
rValue
)
...
@@ -308,54 +317,71 @@ bool VclButtonBox::set_property(const rtl::OString &rKey, const rtl::OString &rV
...
@@ -308,54 +317,71 @@ bool VclButtonBox::set_property(const rtl::OString &rKey, const rtl::OString &rV
void
VclButtonBox
::
setAllocation
(
const
Size
&
rAllocation
)
void
VclButtonBox
::
setAllocation
(
const
Size
&
rAllocation
)
{
{
sal_uInt16
nVisibleChildren
=
0
;
Requisition
aReq
(
calculatePrimarySecondaryRequisitions
());
for
(
Window
*
pChild
=
GetWindow
(
WINDOW_FIRSTCHILD
);
pChild
;
pChild
=
pChild
->
GetWindow
(
WINDOW_NEXT
))
{
if
(
!
pChild
->
IsVisible
())
continue
;
++
nVisibleChildren
;
}
sal_uInt16
nVisibleChildren
=
aReq
.
m_nPrimaryChildren
+
aReq
.
m_nSecondaryChildren
;
if
(
!
nVisibleChildren
)
if
(
!
nVisibleChildren
)
return
;
return
;
Size
aSize
=
rAllocation
;
Size
aSize
=
rAllocation
;
long
nAllocPrimaryDimension
=
getPrimaryDimension
(
rAllocation
);
long
nAllocPrimaryDimension
=
getPrimaryDimension
(
rAllocation
);
Size
aRequisition
=
calculateRequisition
();
long
nHomogeneousDimension
=
((
getPrimaryDimension
(
aReq
.
m_aSize
)
-
long
nHomogeneousDimension
=
((
getPrimaryDimension
(
aRequisition
)
-
(
nVisibleChildren
-
1
)
*
m_nSpacing
))
/
nVisibleChildren
;
(
nVisibleChildren
-
1
)
*
m_nSpacing
))
/
nVisibleChildren
;
Point
aPos
(
0
,
0
);
Point
aMainGroupPos
,
aOtherGroupPos
;
long
nPrimaryCoordinate
=
getPrimaryCoordinate
(
aPos
);
//To-Do, other layout styles
//To-Do, other layout styles
switch
(
m_eLayoutStyle
)
switch
(
m_eLayoutStyle
)
{
{
case
VCL_BUTTONBOX_START
:
case
VCL_BUTTONBOX_START
:
if
(
aReq
.
m_nSecondaryChildren
)
{
long
nOtherPrimaryDimension
=
aReq
.
m_nSecondaryChildren
*
nHomogeneousDimension
+
((
aReq
.
m_nSecondaryChildren
-
1
)
*
m_nSpacing
);
setPrimaryCoordinate
(
aOtherGroupPos
,
nAllocPrimaryDimension
-
nOtherPrimaryDimension
);
}
break
;
break
;
default
:
default
:
SAL_WARN
(
"vcl.layout"
,
"todo unimplemented layout style"
);
SAL_WARN
(
"vcl.layout"
,
"todo unimplemented layout style"
);
case
VCL_BUTTONBOX_DEFAULT_STYLE
:
case
VCL_BUTTONBOX_DEFAULT_STYLE
:
case
VCL_BUTTONBOX_END
:
case
VCL_BUTTONBOX_END
:
setPrimaryCoordinate
(
aPos
,
nPrimaryCoordinate
+
nAllocPrimaryDimension
if
(
aReq
.
m_nPrimaryChildren
)
-
getPrimaryDimension
(
aRequisition
));
{
long
nMainPrimaryDimension
=
aReq
.
m_nPrimaryChildren
*
nHomogeneousDimension
+
((
aReq
.
m_nPrimaryChildren
-
1
)
*
m_nSpacing
);
setPrimaryCoordinate
(
aMainGroupPos
,
nAllocPrimaryDimension
-
nMainPrimaryDimension
);
}
break
;
break
;
}
}
Size
aChildSize
;
setSecondaryDimension
(
aChildSize
,
getSecondaryDimension
(
aSize
));
setPrimaryDimension
(
aChildSize
,
nHomogeneousDimension
);
for
(
Window
*
pChild
=
GetWindow
(
WINDOW_FIRSTCHILD
);
pChild
;
pChild
=
pChild
->
GetWindow
(
WINDOW_NEXT
))
for
(
Window
*
pChild
=
GetWindow
(
WINDOW_FIRSTCHILD
);
pChild
;
pChild
=
pChild
->
GetWindow
(
WINDOW_NEXT
))
{
{
if
(
!
pChild
->
IsVisible
())
if
(
!
pChild
->
IsVisible
())
continue
;
continue
;
Size
aChildSize
;
if
(
pChild
->
get_secondary
())
setSecondaryDimension
(
aChildSize
,
getSecondaryDimension
(
aSize
));
{
setPrimaryDimension
(
aChildSize
,
nHomogeneousDimension
);
setLayoutAllocation
(
*
pChild
,
aOtherGroupPos
,
aChildSize
);
long
nPrimaryCoordinate
=
getPrimaryCoordinate
(
aOtherGroupPos
);
setLayoutAllocation
(
*
pChild
,
aPos
,
aChildSize
);
setPrimaryCoordinate
(
aOtherGroupPos
,
nPrimaryCoordinate
+
nHomogeneousDimension
+
m_nSpacing
);
}
nPrimaryCoordinate
=
getPrimaryCoordinate
(
aPos
);
else
setPrimaryCoordinate
(
aPos
,
nPrimaryCoordinate
+
nHomogeneousDimension
+
m_nSpacing
);
{
setLayoutAllocation
(
*
pChild
,
aMainGroupPos
,
aChildSize
);
long
nPrimaryCoordinate
=
getPrimaryCoordinate
(
aMainGroupPos
);
setPrimaryCoordinate
(
aMainGroupPos
,
nPrimaryCoordinate
+
nHomogeneousDimension
+
m_nSpacing
);
}
}
}
}
}
...
...
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