public VirtualListView() { this.Build(); LineLayout = GetLayout(); int width, height; LineLayout.SetMarkup("XYZ"); LineLayout.GetPixelSize(out width, out height); ConstantHeight = height; CurrentRow = 0; SelectedRow = 0; SelectionMode = false; DocumentEnd = true; mColumnControl = new ColumnControl(); vbox1.Add(mColumnControl); Gtk.Box.BoxChild boxChild = ((Gtk.Box.BoxChild)(this.vbox1[mColumnControl])); boxChild.Position = 0; boxChild.Expand = false; boxChild.Fill = false; mColumnControl.Show(); mColumnControl.ColumnChanged += (o, e) => { drawingarea.QueueDraw(); }; }
//�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡι��캯�� public SkinCompiler(string name) : base(name, 600, 300) { m_obOptionsBar.Parent = this; LineLayout layout = new LineLayout(this); layout.initTool(m_obTemplateTool, m_obTemplateText, m_obTemplateButton, m_stTemplatePath); layout.initTool(m_obResourceTool, m_obResourceText, m_obResourceButton, m_stResourcePath); layout.initTool(m_obTargetTool, m_obTargetText, m_obTargetButton, m_stTargetPath); m_obMainBar.Parent = this; m_obMainBar.Dock = DockStyle.Top; m_obOptionsBar.Dock = DockStyle.Top; m_obMainBar.AddItem(m_obCompilerSingleButton, false); m_obMainBar.Items.Add(m_obFreshButton); m_obOptionsBar.Items.Add(m_obCompilerInfoMode); m_obOpenBar.Parent = this; m_obOpenBar.Dock = DockStyle.Top; m_obOpenBar.AddItem(m_obMakeButton, false); m_obOpenBar.AddItem(m_obInfoOpenButton, false); m_obOpenBar.AddItem(new ToolStripSeparator(), false); m_obOpenBar.AddItem(m_obSkinLinkButton, false); m_obOpenBar.Items.Add(m_obBaseCompilerButton); m_obOpenBar.Items.Add(m_obResourceOpenButton); m_obOpenBar.Items.Add(m_obFlashViewerButton); m_obOpenBar.Items.Add(m_obBaseOpenButton); //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ� layout.initTool(m_obClassInfoTool, m_obClassInfoText, m_obClassInfoButton, m_stClassInfoPath); layout.initTool(m_obCompilerTool, m_obCompilerText, m_obCompilerButton, m_stCompilerPath); layout.initTool(m_obAbcTool, m_obAbcText, m_obAbcButton, m_stAbcPath); m_obMaker = new ClassTemplateMaker(m_stTemplatePath); m_obCompiler = new BatchClassCompiler(m_stCompilerPath, m_stAbcPath); m_obMaker.targetPath = m_stTargetPath; m_obCompiler.WorkPath = m_stTargetPath; string[] arrPath = new string[] { m_stClassBasePath, m_stClassSkinsPath, m_stResourcePath }; string[] arrName = new string[] { m_stClassPath }; m_obFinder.freshList(arrPath, arrName); m_obInfoFinder.freshList(new string[] { m_stClassInfoPath }, null); m_obSkinLinkButton.DoubleClickEnabled = true; m_obSkinLinkButton.DoubleClick += new EventHandler(m_obSkinLinkButton_DoubleClick); m_obInfoOpenButton.Click += new EventHandler(m_obInfoOpenButton_Click); m_obFlashViewerButton.Click += new EventHandler(m_obFlashViewerButton_Click); m_obResourceOpenButton.Click += new EventHandler(m_obResourceOpenButton_Click); m_obMakeButton.Click += new EventHandler(m_obMakeButton_Click); m_obCompilerSingleButton.Click += new EventHandler(m_obCompilerSingleButton_Click); m_obBaseOpenButton.Click += new EventHandler(m_obBaseOpenButton_Click); m_obBaseCompilerButton.Click += new EventHandler(m_obBaseCompilerButton_Click); m_obFreshButton.Click += new EventHandler(m_obFreshButton_Click); m_obCompiler.OnComplete += new OnCompleteHandler(m_obCompiler_OnComplete); }
public VirtualListView() { this.Build(); LineLayout = GetLayout(); int width, height; LineLayout.SetMarkup("XYZ"); LineLayout.GetPixelSize(out width, out height); ConstantHeight = height; CurrentRow = 0; SelectedRow = 0; SelectionMode = false; DocumentEnd = true; mColumnControl = new ColumnControl(this); vbox1.Add(mColumnControl); Gtk.Box.BoxChild boxChild = ((Gtk.Box.BoxChild)(this.vbox1[mColumnControl])); boxChild.Position = 0; boxChild.Expand = false; boxChild.Fill = false; mColumnControl.Show(); mColumnControl.ColumnChanged += (o, e) => { drawingarea.QueueDraw(); }; var bc = (Box.BoxChild)vbox1[findwidget]; bc.Position = 0; Find.Visible = false; Find.Escaped += (o, e) => { FindBoxInvisible(); }; Find.CurrentChanged += (o, e) => { SelectionMode = false; // as a workaround to avoid selection with CTRL+F3 }; drawingarea.ButtonPressEvent += drawingarea_ButtonPressEvent; }
void AddString(string s, Font font, float x, float y, float width, float height, StringFormat format) { TextLineIterator iter = new TextLineIterator(s, font, new java.awt.font.FontRenderContext(null, false, false), format, width, height); int coordsCount = NativeObject.CoordsCount; for (LineLayout layout = iter.NextLine(); layout != null; layout = iter.NextLine()) { NativeObject.append(layout.GetOutline(x, y), false); } AffineTransform lineAlignT = iter.CalcLineAlignmentTransform(); if (lineAlignT != null) { NativeObject.transform(lineAlignT, coordsCount, NativeObject.CoordsCount - coordsCount); } }
protected void OnDrawingareaExposeEvent(object o, Gtk.ExposeEventArgs args) { Gdk.EventExpose expose = args.Args[0] as Gdk.EventExpose; Gdk.Window win = expose.Window; int width, height; win.GetSize(out width, out height); Gdk.Rectangle exposeRect = expose.Area; bool fulldraw = width == exposeRect.Width && height == exposeRect.Height; win.DrawRectangle(Style.LightGC(StateType.Normal), true, exposeRect); if (GetContentDelegate == null) { return; // todo: an error message could be displayed } int offset = (int)vscrollbar1.Value; if (fulldraw) { TopVisibleRow = offset; BottomVisibleRow = offset; } int hscrollRange = 0; int dy = exposeRect.Top; offset += dy / ConstantHeight; dy -= dy % ConstantHeight; Gdk.GC backgound = new Gdk.GC((Gdk.Drawable)base.GdkWindow); Gdk.GC text = new Gdk.GC((Gdk.Drawable)base.GdkWindow); ColumnControl.Column[] columns = mColumnControl.GetVisibleColumnsInDrawOrder(); for (int row = offset; row < RowCount; row++) { int dx = -(int)hscrollbar1.Value; Gdk.Rectangle rect = new Gdk.Rectangle(dx, dy, 0, ConstantHeight); System.Drawing.Color backColor = System.Drawing.Color.WhiteSmoke; System.Drawing.Color textColor = System.Drawing.Color.Black; if (isRowSelected(row)) { if (HasFocus) { backColor = System.Drawing.Color.DarkGray; } else { backColor = System.Drawing.Color.LightGray; } } else { if (GetColorDelegate != null) { GetColorDelegate(row, ref backColor, ref textColor); } } backgound.RgbFgColor = new Gdk.Color(backColor.R, backColor.G, backColor.B); text.RgbFgColor = new Gdk.Color(textColor.R, textColor.G, textColor.B); for (int c = 0; c < columns.Length; c++) { ColumnControl.Column column = columns[c]; int columnIndex = column.SortOrder; int xwidth = column.Width; if (dx > exposeRect.Right) { break; } rect = new Gdk.Rectangle(rect.Left, rect.Top, xwidth + mColumnControl.GripperWidth, ConstantHeight); if (c == columns.Length - 1) { rect.Width = Math.Max(rect.Width, exposeRect.Right - rect.Left + 1); } object content = GetContentDelegate(row, columnIndex); if (content is Gdk.Pixbuf) { Gdk.Pixbuf image = (Gdk.Pixbuf)content; win.DrawRectangle(backgound, true, rect); dx += 2; image.RenderToDrawable(win, text, 0, 0, dx, dy, image.Width, image.Height, Gdk.RgbDither.Normal, 0, 0); dx += xwidth + mColumnControl.GripperWidth - 2; rect.Offset(xwidth + mColumnControl.GripperWidth, 0); } else { LineLayout.SetText(content.ToString()); win.DrawRectangle(backgound, true, rect); dx += 2; win.DrawLayout(text, dx, dy, LineLayout); dx += xwidth + mColumnControl.GripperWidth - 2; rect.Offset(xwidth + mColumnControl.GripperWidth, 0); } } hscrollRange = Math.Max(hscrollRange, dx + rect.Width); dy += ConstantHeight; if (dy > exposeRect.Bottom) { break; } if (fulldraw && exposeRect.Height - dy >= ConstantHeight) { BottomVisibleRow++; } } if (fulldraw) { int pageSize = BottomVisibleRow - TopVisibleRow; if (vscrollbar1.Adjustment.PageSize != pageSize) { vscrollbar1.Adjustment.PageSize = pageSize; vscrollbar1.Adjustment.PageIncrement = pageSize; } hscrollRange += (int)hscrollbar1.Value; if (hscrollRange > 0) { hscrollbar1.SetRange(0, hscrollRange); } // position current row inside visible area // TODO: please think about, because of double redraw a more sophisticated solution could be possible if (CurrentRow >= 0 && CurrentRow < RowCount) { if (CurrentRow < TopVisibleRow) { OffsetCursor(TopVisibleRow - CurrentRow); } else if (CurrentRow > BottomVisibleRow) { OffsetCursor(BottomVisibleRow - CurrentRow); } } } #if DEBUG2 if (ComponentManager != null) { String t1 = String.Format("Expose.Area={0}, size={1}.{2}", expose.Area.ToString(), width, height); String t2 = String.Format("{0} T={1} B={2}", fulldraw ? "FULL" : "PART", TopVisibleRow, BottomVisibleRow); ComponentManager.MessageWriteLineInvoke(String.Format("{0} {1}", t1, t2)); } #endif }