<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
- <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS;DEBUG_DISPOSE;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+ <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_DISPOSE0;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
<Optimize>false</Optimize>
<OutputPath>$(SolutionDir)build\Debug</OutputPath>
</PropertyGroup>
<Border Style="ControlBorder" Foreground="{./Foreground}" Background="{./Background}">
<VerticalStack>
<HorizontalStack Spacing="1" Height="Fit" MouseDoubleClick="./onClickForExpand">
- <Container Margin="1" Width="9" Height="9" Focusable="true" MouseClick="./onClickForExpand"
+ <Container Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand"
MouseEnter="{Background=LightGray}"
MouseLeave="{Background=Transparent}">
<Image
<?xml version="1.0"?>
<Border BorderWidth="1" Foreground="Jet">
<GenericStack Orientation="{./Orientation}" Spacing="0">
- <Shape Style="ArrowBut" MouseClick="./onScrollBack" Path="M 5.5,0.5 L 10.5,10.5 L 0.5,10.5 Z"/>
- <Slider Name="Slider"
+ <Shape Style="ArrowBut" MouseDown="./onScrollBack" Path="M 5.5,0.5 L 10.5,10.5 L 0.5,10.5 Z"/>
+ <Slider Name="Slider"
Orientation="{./Orientation}"
Value="{²./Value}"
Maximum="{./Maximum}"
CursorColor="hgradient|0:Gray|1:Jet"
Foreground="Jet"
Background="hgradient|0:DimGray|0.1:Gray|0.95:Gray|1:White"/>
- <Shape Style="ArrowBut" MouseClick="./onScrollForth" Path="M 0.5,0.5 L 10.5,0.5 L 5.5,10.5 Z"/>
+ <Shape Style="ArrowBut" MouseDown="./onScrollForth" Path="M 0.5,0.5 L 10.5,0.5 L 5.5,10.5 Z"/>
</GenericStack>
</Border>
\ No newline at end of file
Text="{²./Value}" TextAlignment="Right" Margin="0"/>
</Border>
<VerticalStack MinimumSize="13,13" Width="25%" Height="Stretched" Spacing="0" Margin="0">
- <Shape Style="ArrowBut" Height="50%" MouseClick="./onUp" Path="M 5.5,0.5 L 10.5,6.5 L 0.5,6.5 Z"/>
- <Shape Style="ArrowBut" Height="50%" MouseClick="./onDown" Path="M 0.5,0.5 L 10.5,0.5 L 5.5,6.5 Z"/>
+ <Shape Style="ArrowBut" Height="50%" MouseDown="./onUp" Path="M 5.5,0.5 L 10.5,6.5 L 0.5,6.5 Z"/>
+ <Shape Style="ArrowBut" Height="50%" MouseDown="./onDown" Path="M 0.5,0.5 L 10.5,0.5 L 5.5,6.5 Z"/>
</VerticalStack>
</HorizontalStack>
}
get { return List2; }
}
- IList<Color> testList = Color.ColorDic.Values.OrderBy(c=>c.Hue)
- .ThenBy(c=>c.Value).ThenBy(c=>c.Saturation)
+ List<Color> testList = Color.ColorDic.Values//.OrderBy(c=>c.Hue)
+ //.ThenBy(c=>c.Value).ThenBy(c=>c.Saturation)
.ToList();
- public IList<Color> TestList {
+ public List<Color> TestList {
set{
testList = value;
NotifyValueChanged ("TestList", testList);
MouseEnter="{Foreground=White}"
MouseLeave="{Foreground=DimGray}"
MouseDown="{Background=DarkRed}"
+ MouseClick="{Foreground=Green}"
+ MouseDoubleClick="{Foreground=Yellow}"
MouseUp="{Background=Onyx}"/>
<Label Text="MouseEvents" Width="50%" Margin="3"
Background="Onyx"
Foreground="DimGray"
TextAlignment="Center"
+ MouseClick="{Foreground=Green}"
+ MouseDoubleClick="{Foreground=Yellow}"
MouseEnter="{Foreground=White}"
MouseLeave="{Foreground=DimGray}"
MouseDown="{Background=Mantis}"
{
public GraphicObject Focused;
public BubblingMouseButtonEventArg(MouseButtonEventArgs mbe) : base(mbe){}
+ public BubblingMouseButtonEventArg(int x, int y, MouseButton button, bool pressed)
+ : base (x,y,button,pressed){}
+
}
}
}
}
- public override void onMouseClick (object sender, MouseButtonEventArgs e)
+ public override void onMouseDown (object sender, MouseButtonEventArgs e)
{
IsChecked = !IsChecked;
- base.onMouseClick (sender, e);
+ base.onMouseDown (sender, e);
}
}
}
#if DEBUG_FOCUS
Debug.WriteLine("MOUSE DOWN => " + this.ToString());
#endif
- if (CurrentInterface.eligibleForDoubleClick == this && CurrentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick)
- onMouseDoubleClick (this, e);
- else
- CurrentInterface.clickTimer.Restart();
- CurrentInterface.eligibleForDoubleClick = null;
if (CurrentInterface.ActiveWidget == null)
CurrentInterface.ActiveWidget = this;
p.onMouseUp(sender,e);
MouseUp.Raise (this, e);
-
- if (MouseIsIn (e.Position) && IsActive) {
- if (CurrentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick)
- CurrentInterface.eligibleForDoubleClick = this;
- onMouseClick (this, e);
- }
}
public virtual void onMouseClick(object sender, MouseButtonEventArgs e){
#if DEBUG_FOCUS
public event EventHandler Unchecked;
#region GraphicObject overrides
- public override void onMouseClick (object sender, MouseButtonEventArgs e)
+ public override void onMouseDown (object sender, MouseButtonEventArgs e)
{
Group pg = Parent as Group;
if (pg != null) {
} else
IsChecked = !IsChecked;
- base.onMouseClick (sender, e);
+ base.onMouseDown (sender, e);
}
#endregion
/// <summary> delay before tooltip appear </summary>
public static int ToolTipDelay = 500;
/// <summary>Double click threshold in milisecond</summary>
- public static int DoubleClick = 200;//max duration between two mouse_down evt for a dbl clk in milisec.
+ public static int DoubleClick = 250;//max duration between two mouse_down evt for a dbl clk in milisec.
/// <summary> Time to wait in millisecond before starting repeat loop</summary>
public static int DeviceRepeatDelay = 700;
/// <summary> Time interval in millisecond between device event repeat</summary>
/// </summary>
protected static Interface CurrentInterface;
internal Stopwatch clickTimer = new Stopwatch();
- internal GraphicObject eligibleForDoubleClick = null;
+ GraphicObject armedClickSender = null;
+ MouseButtonEventArgs armedClickEvtArgs = null;
+// internal GraphicObject EligibleForDoubleClick {
+// get { return eligibleForDoubleClick; }
+// set {
+// eligibleForDoubleClick = value;
+// clickTimer.Restart ();
+// }
+// }
+ internal void armeClick (GraphicObject sender, MouseButtonEventArgs e){
+ armedClickSender = sender;
+ armedClickEvtArgs = e;
+ clickTimer.Restart ();
+ }
#endregion
#region Events
/// Result: the Interface bitmap is drawn in memory (byte[] bmp) and a dirtyRect and bitmap are available
/// </summary>
public void Update(){
+ if (armedClickSender != null && clickTimer.ElapsedMilliseconds >= Interface.DoubleClick) {
+ armedClickSender.onMouseClick (armedClickSender, armedClickEvtArgs);
+ armedClickSender = null;
+ }
+
if (mouseRepeatCount > 0) {
int mc = mouseRepeatCount;
mouseRepeatCount -= mc;
if (_focusedWidget != null) {
+ mouseRepeatTriggeredAtLeastOnce = true;
for (int i = 0; i < mc; i++) {
- _focusedWidget.onMouseClick (this, new MouseButtonEventArgs (Mouse.X, Mouse.Y, MouseButton.Left, true));
+ _focusedWidget.onMouseDown (this, new BubblingMouseButtonEventArg(Mouse.X, Mouse.Y, MouseButton.Left, true));
}
}
}
/// <returns>true if mouse is in the interface</returns>
public virtual bool ProcessMouseMove(int x, int y)
{
+ if (armedClickSender != null) {
+ armedClickSender.onMouseClick (armedClickSender, armedClickEvtArgs);
+ armedClickSender = null;
+ }
int deltaX = x - Mouse.X;
int deltaY = y - Mouse.Y;
Mouse.X = x;
mouseRepeatThread.Abort();
mouseRepeatThread.Join ();
}
-
+ if (!mouseRepeatTriggeredAtLeastOnce) {
+ if (_activeWidget.MouseIsIn (e.Position))
+ armeClick (_activeWidget, e);
+ }
+ mouseRepeatTriggeredAtLeastOnce = false;
_activeWidget.onMouseUp (_activeWidget, e);
- GraphicObject lastActive = _activeWidget;
+
+// GraphicObject lastActive = _activeWidget;
ActiveWidget = null;
- if (!lastActive.MouseIsIn (Mouse.Position)) {
- ProcessMouseMove (Mouse.X, Mouse.Y);
- }
+// if (!lastActive.MouseIsIn (Mouse.Position)) {
+// ProcessMouseMove (Mouse.X, Mouse.Y);
+// }
return true;
}
/// <summary>
if (HoverWidget == null)
return false;
+ if (HoverWidget == armedClickSender) {
+ if (clickTimer.ElapsedMilliseconds < Interface.DoubleClick) {
+ armedClickSender.onMouseDoubleClick (armedClickSender, e);
+ armedClickSender = null;
+ return true;
+ }
+
+ }
+ if (armedClickSender!=null)
+ armedClickSender.onMouseClick (armedClickSender, armedClickEvtArgs);
+ armedClickSender = null;
+
HoverWidget.onMouseDown(HoverWidget,new BubblingMouseButtonEventArg(e));
if (FocusedWidget == null)
#endregion
#region Device Repeat Events
- volatile bool mouseRepeatOn, keyboardRepeatOn;
+ volatile bool mouseRepeatOn, keyboardRepeatOn, mouseRepeatTriggeredAtLeastOnce = false;
volatile int mouseRepeatCount, keyboardRepeatCount;
Thread mouseRepeatThread, keyboardRepeatThread;
KeyboardKeyEventArgs lastKeyDownEvt;
void mouseRepeatThreadFunc()
{
mouseRepeatOn = true;
+ mouseRepeatTriggeredAtLeastOnce = false;
Thread.Sleep (Interface.DeviceRepeatDelay);
while (mouseRepeatOn) {
mouseRepeatCount++;
/// <summary>
/// Fit on content, this special measure is defined as a fixed integer set to -1 pixel
/// </summary>
- public static Measure Fit = new Measure(-1);
+ public static Measure Fit = new Measure(-1,Unit.Percent);
/// <summary>
/// Stretched into parent client area. This special measure is defined as a proportional cote
/// set to 100 Percents
/// <summary>
/// True is size is fixed in pixels, this means not proportional, stretched nor fit.
/// </summary>
- public bool IsFixed { get { return Value > 0 && Units == Unit.Pixel; }}
- public bool IsFit { get { return Value == -1 && Units == Unit.Pixel; }}
+ public bool IsFixed { get { return Units == Unit.Pixel; }}
+ public bool IsFit { get { return Value == -1 && Units == Unit.Percent; }}
#region Operators
public static implicit operator int(Measure m){
return m.Value;