Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@641 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
6 changed files with 170 additions and 29 deletions
@ -0,0 +1,103 @@
@@ -0,0 +1,103 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Daniel Grunwald |
||||
* Date: 27.10.2005 |
||||
* Time: 14:18 |
||||
*/ |
||||
|
||||
using System; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.SharpDevelop.Gui.TreeGrid; |
||||
|
||||
namespace ICSharpCode.Core |
||||
{ |
||||
public class DebuggerGridControl : DynamicList |
||||
{ |
||||
// Columns:
|
||||
// 0 = plus sign
|
||||
// 1 = icon
|
||||
// 2 = text
|
||||
// 3 = value
|
||||
|
||||
DynamicTreeRow row = new DynamicTreeRow(); |
||||
|
||||
public DebuggerGridControl(string text, string value) |
||||
{ |
||||
BeginUpdate(); |
||||
Columns.Add(new DynamicListColumn()); |
||||
Columns.Add(new DynamicListColumn()); |
||||
Columns.Add(new DynamicListColumn()); |
||||
Columns.Add(new DynamicListColumn()); |
||||
Columns[0].BackgroundBrush = SystemBrushes.ControlLightLight; |
||||
// default is allowgrow = true and autosize = false
|
||||
Columns[0].AllowGrow = false; |
||||
Columns[1].AllowGrow = false; |
||||
Columns[1].Width = 18; |
||||
Columns[2].AutoSize = true; |
||||
Columns[3].AutoSize = true; |
||||
Rows.Add(row); |
||||
row.ChildWindowCaption = text; |
||||
row[2].Text = text; |
||||
row[3].Text = value; |
||||
|
||||
foreach (DynamicListColumn col in Columns) { |
||||
row.ChildColumns.Add(col.Clone()); |
||||
} |
||||
row.Expanding += RowExpanding; |
||||
row.Expanded += delegate { isExpanded = true; }; |
||||
row.Collapsed += delegate { isExpanded = false; }; |
||||
|
||||
CreateControl(); |
||||
using (Graphics g = CreateGraphics()) { |
||||
this.Width = GetRequiredWidth(g); |
||||
} |
||||
this.Height = row.Height; |
||||
EndUpdate(); |
||||
} |
||||
|
||||
Form frm; |
||||
|
||||
public void ShowForm(ICSharpCode.TextEditor.TextArea textArea, Point logicTextPos) |
||||
{ |
||||
frm = new DynamicTreeRow.ChildForm(); |
||||
frm.FormBorderStyle = FormBorderStyle.None; |
||||
frm.Owner = textArea.FindForm(); |
||||
int ypos = (textArea.Document.GetVisibleLine(logicTextPos.Y) + 1) * textArea.TextView.FontHeight - textArea.VirtualTop.Y; |
||||
Point p = new Point(0, ypos); |
||||
p = textArea.PointToScreen(p); |
||||
p.X = Control.MousePosition.X; |
||||
frm.StartPosition = FormStartPosition.Manual; |
||||
frm.ShowInTaskbar = false; |
||||
frm.Location = p; |
||||
frm.Size = new Size(Width, row.Height); |
||||
Dock = DockStyle.Fill; |
||||
frm.Controls.Add(this); |
||||
ICSharpCode.TextEditor.Gui.CompletionWindow.AbstractCompletionWindow.ShowWindowWithoutFocus(frm); |
||||
textArea.Click += OnTextAreaClick; |
||||
textArea.KeyDown += OnTextAreaClick; |
||||
frm.Height = row.Height; |
||||
} |
||||
|
||||
void OnTextAreaClick(object sender, EventArgs e) |
||||
{ |
||||
((ICSharpCode.TextEditor.TextArea)sender).KeyDown -= OnTextAreaClick; |
||||
((ICSharpCode.TextEditor.TextArea)sender).Click -= OnTextAreaClick; |
||||
frm.Close(); |
||||
} |
||||
|
||||
bool isExpanded; |
||||
|
||||
public bool AllowClose { |
||||
get { |
||||
return !isExpanded; |
||||
} |
||||
} |
||||
|
||||
void RowExpanding(object sender, EventArgs e) |
||||
{ |
||||
row.ChildRows.Clear(); |
||||
row.ChildRows.Add(row); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue