Maximum = 0;
Value = 0;
}
+Scroller {
+ CacheEnabled = false;
+}
Icon {
Margin=1;
Width=12;
<GraphicObject Width="5"/>
</HorizontalStack>
<Container Name="Content" MinimumSize="50,50" Background="Onyx">
- <VerticalStack Margin="5">
+ <VerticalStack Margin="1">
<TextBox Text="{²./CurrentDirectory}"/>
- <HorizontalStack>
+ <HorizontalStack Spacing="1">
<DirectoryView ShowFiles="false" Name="dv" CurrentDirectory="{²./CurrentDirectory}" SelectedItemChanged="./Tv_SelectedItemChanged"
- Width="50%" Margin="1">
+ Width="50%" Margin="0">
<Template>
<TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}"
SelectedItemChanged="./onSelectedItemChanged">
</DirectoryView>
<Splitter/>
<DirectoryView ShowFiles="true" Name="dv" CurrentDirectory="{../dv.SelectedItem}"
- Width="50%" Margin="1">
+ Width="100%" Margin="0">
<Template>
<ListBox Name="fileView" Data="{./FileSystemEntries}">
<Template>
- <Border BorderWidth="1" Margin="1" MinimumSize="10,10">
- <Scroller Name="scroller1" Margin="1" VerticalScrolling="true">
- <Wrapper Orientation="Horizontal" Height="Fit"
- Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
- </Scroller>
+ <Border BorderWidth="1" Margin="0" MinimumSize="10,10">
+ <VerticalStack>
+ <Scroller ScrollX="{../scrollbar1.Value}" Name="scroller1"
+ VerticalScrolling="False" HorizontalScrolling="true">
+ <Wrapper Orientation="Horizontal" Width="Fit" HorizontalAlignment="Left"
+ Name="ItemsContainer" Margin="0" Spacing="1"/>
+ </Scroller>
+ <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollX}"
+ Maximum="{../scroller1.MaximumScroll}" Orientation="Horizontal"
+ Height="14" />
+ </VerticalStack>
</Border>
</Template>
<ItemTemplate DataType="System.IO.FileInfo">
--- /dev/null
+<?xml version="1.0"?>
+<Window Caption="Vertical Wrapper" Width="50%" Height="50%">
+ <Wrapper Orientation="Vertical" Height="Fit" Width="90%" Margin="5" Background="Teal" Spacing="1" >
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50%" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50%" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ </Wrapper>
+</Window>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>
+<Window Caption="Horizontal Wrapper" Width="50%" Height="50%">
+ <Wrapper Orientation="Horizontal" Height="90%" Width="Fit" Margin="5" Background="Teal" Spacing="1" >
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50%" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50%" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ </Wrapper>
+</Window>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>
+<Window Caption="Horizontal Wrapper" Width="50%" Height="50%">
+ <VerticalStack Margin="1">
+ <Scroller Name="scroller1" ScrollX="{../scrollbar1.Value}" VerticalScrolling="False" HorizontalScrolling="true" Margin="1" Background="BlueCrayola">
+ <Wrapper HorizontalAlignment="Left" Orientation="Horizontal" Height="100%" Width="Fit" Margin="0" Background="Teal" Spacing="1" >
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50%" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50%" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50%" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50%" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50%" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50%" Background="Mantis"/>
+ <GraphicObject Width="50" Height="50" Background="Mantis"/>
+ </Wrapper>
+ </Scroller>
+ <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollX}"
+ Maximum="{../scroller1.MaximumScroll}" Orientation="Horizontal"
+ Height="14" />
+ </VerticalStack>
+</Window>
\ No newline at end of file
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
<Reference Include="cairo-sharp"/>
- <Reference Include="gdk-sharp"/>
- <Reference Include="gio-sharp"/>
- <Reference Include="glib-sharp"/>
<Reference Include="OpenTK">
<HintPath>$(SolutionDir)packages\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
<Package>opentk</Package>
<None Include="Interfaces\Divers\perfMeasures.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="Interfaces\Wrapper\2.1.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="Interfaces\Wrapper\1.1.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="Interfaces\Wrapper\2.2.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
}
LayoutChanged.Raise (this, new LayoutingEventArgs (layoutType));
}
-
+ internal protected void raiseLayoutChanged(LayoutingEventArgs e){
+ LayoutChanged.Raise (this, e);
+ }
/// <summary> Update layout component only one at a time, this is where the computation of alignement
/// and size take place.
/// The redrawing will only be triggered if final slot size has changed </summary>
get { return _verticalScrolling; }
set { _verticalScrolling = value; }
}
-
+
[XmlAttributeAttribute][DefaultValue(false)]
public bool HorizontalScrolling {
get { return _horizontalScrolling; }
public bool ScrollbarVisible {
get { return _scrollbarVisible; }
set { _scrollbarVisible = value; }
- }
+ }
[XmlAttributeAttribute][DefaultValue(0.0)]
public double ScrollX {
get {
RegisterForRedraw ();
Scrolled.Raise (this, new ScrollingEventArgs (Orientation.Horizontal));
}
- }
+ }
[XmlAttributeAttribute][DefaultValue(0.0)]
public double ScrollY {
get {
public int MaximumScroll {
get {
try {
- return VerticalScrolling ?
+ return VerticalScrolling ?
Math.Max(Child.Slot.Height - ClientRectangle.Height,0) :
- Math.Max(Child.Slot.Width - ClientRectangle.Width,0);
+ Math.Max(Child.Slot.Width - ClientRectangle.Width,0);
} catch {
return 0;
}
: base(){}
#region GraphicObject Overrides
- //TODO:put this override in style
- [XmlAttributeAttribute()][DefaultValue(false)]
- public override bool CacheEnabled {
- get { return base.CacheEnabled; }
- set { base.CacheEnabled = value; }
+ public override void OnLayoutChanges (LayoutingType layoutType)
+ {
+ base.OnLayoutChanges (layoutType);
+
+ NotifyValueChanged("MaximumScroll", MaximumScroll);
}
void OnChildLayoutChanges (object sender, LayoutingEventArgs arg)
{
+ //Debug.WriteLine ("scroller childLayoutChanges");
int maxScroll = MaximumScroll;
+ //Debug.WriteLine ("maxscroll={0}", maxScroll);
if (_verticalScrolling) {
if (arg.LayoutType == LayoutingType.Height) {
if (maxScroll < ScrollY) {
- Debug.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll);
+ //Debug.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll);
ScrollY = 0;
}
NotifyValueChanged("MaximumScroll", maxScroll);
}
} else if (arg.LayoutType == LayoutingType.Width) {
- if (maxScroll < ScrollX)
+ if (maxScroll < ScrollX) {
+ //Debug.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll);
ScrollX = 0;
+ }
NotifyValueChanged("MaximumScroll", maxScroll);
}
}
ScrollX = 0;
}
public override void SetChild (GraphicObject _child)
- {
+ {
GraphicObject c = child as GraphicObject;
Group g = child as Group;
if (c != null) {
if (c != null) {
c.LayoutChanged += OnChildLayoutChanges;
if (g != null)
- g.ChildrenCleared += onChildListCleared;
+ g.ChildrenCleared += onChildListCleared;
}
base.SetChild (_child);
}
- #endregion
+ public override Rectangle ScreenCoordinates (Rectangle r)
+ {
+ return base.ScreenCoordinates (r) - new Point((int)ScrollX,(int)ScrollY);
+ }
+ protected override void onDraw (Context gr)
+ {
+ Rectangle rBack = new Rectangle (Slot.Size);
+
+ Background.SetAsSource (gr, rBack);
+ CairoHelpers.CairoRectangle(gr,rBack, CornerRadius);
+ gr.Fill ();
+
+ gr.Save ();
+ if (ClipToClientRect) {
+ //clip to scrolled client zone
+ CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+ gr.Clip ();
+ }
+
+ gr.Translate (-ScrollX, -ScrollY);
+ if (child != null)
+ child.Paint (ref gr);
+ gr.Restore ();
+ }
#region Mouse handling
internal Point savedMousePos;
public override bool MouseIsIn (Point m)
- {
- return Visible ? base.ScreenCoordinates(Slot).ContainsOrIsEqual (m) : false;
+ {
+ return Visible ? base.ScreenCoordinates(Slot).ContainsOrIsEqual (m) : false;
}
public override void checkHoverWidget (MouseMoveEventArgs e)
{
{
if (Child == null)
return;
-
+
if (VerticalScrolling )
ScrollY -= e.Delta * ScrollSpeed;
- if (HorizontalScrolling )
+ if (HorizontalScrolling )
ScrollX -= e.Delta * ScrollSpeed;
- }
+ }
public override void onMouseMove (object sender, MouseMoveEventArgs e)
{
savedMousePos.X += e.XDelta;
}
#endregion
- public override Rectangle ScreenCoordinates (Rectangle r)
- {
- return base.ScreenCoordinates (r) - new Point((int)ScrollX,(int)ScrollY);
- }
- protected override void onDraw (Context gr)
- {
- Rectangle rBack = new Rectangle (Slot.Size);
-
- Background.SetAsSource (gr, rBack);
- CairoHelpers.CairoRectangle(gr,rBack, CornerRadius);
- gr.Fill ();
-
- gr.Save ();
- if (ClipToClientRect) {
- //clip to scrolled client zone
- CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
- gr.Clip ();
- }
-
- gr.Translate (-ScrollX, -ScrollY);
- if (child != null)
- child.Paint (ref gr);
- gr.Restore ();
- }
+ #endregion
}
}
#endif
Group page;
- if (typeof(Wrapper).IsAssignableFrom (items.GetType ())){
+ if (typeof(Wrapper).IsAssignableFrom (items.GetType ())) {
page = items;
itemPerPage = int.MaxValue;
- }else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) {
+ } else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) {
GenericStack gs = new GenericStack ();
gs.CurrentInterface = items.CurrentInterface;
gs.Initialize ();
gs.VerticalAlignment = items.VerticalAlignment;
gs.HorizontalAlignment = items.HorizontalAlignment;
page = gs;
-
- }else
+ page.Name = "page" + pageNum;
+ } else {
page = Activator.CreateInstance (items.GetType ()) as Group;
-
- page.Name = "page" + pageNum;
+ page.Name = "page" + pageNum;
+ }
for (int i = (pageNum - 1) * itemPerPage; i < pageNum * itemPerPage; i++) {
if (i >= data.Count)
{
//children can't stretch in a wrapper
GraphicObject go = sender as GraphicObject;
- //Debug.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString());
+ //System.Diagnostics.Debug.WriteLine ("wrapper child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString());
switch (arg.LayoutType) {
case LayoutingType.Width:
- if (Orientation == Orientation.Horizontal && go.Width.Units == Unit.Percent) {
+ if (Orientation == Orientation.Horizontal && go.Width.Units == Unit.Percent){
go.Width = Measure.Fit;
return;
}
+ this.RegisterForLayouting (LayoutingType.Width);
break;
case LayoutingType.Height:
if (Orientation == Orientation.Vertical && go.Height.Units == Unit.Percent) {
go.Height = Measure.Fit;
return;
}
+ this.RegisterForLayouting (LayoutingType.Height);
break;
default:
return;
protected override int measureRawSize (LayoutingType lt)
{
int tmp = 0;
- //Wrapper can't fit in the direction of the wrapper
+ //Wrapper can't fit in the opposite direction of the wrapper, this func is called only if Fit
if (lt == LayoutingType.Width) {
if (Orientation == Orientation.Vertical) {
Width = Measure.Stretched;
CurrentInterface.currentLQI.Slot = LastSlots;
CurrentInterface.currentLQI.Slot = Slot;
#endif
-
switch (layoutType) {
case LayoutingType.Width:
foreach (GraphicObject c in Children) {
return;
}
RegisterForLayouting (LayoutingType.ArrangeChildren);
- //LayoutChanged.Raise (this, new LayoutingEventArgs (layoutType));
+ raiseLayoutChanged (new LayoutingEventArgs (layoutType));
}
#endregion
}