本文整理汇总了C#中Gtk.ScrolledWindow.CheckResize方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.ScrolledWindow.CheckResize方法的具体用法?C# Gtk.ScrolledWindow.CheckResize怎么用?C# Gtk.ScrolledWindow.CheckResize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ScrolledWindow
的用法示例。
在下文中一共展示了Gtk.ScrolledWindow.CheckResize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
//.........这里部分代码省略.........
#endif
#if IPC_DBUS
NetworkManager = new NetworkManager(ChatViewManager);
#endif
UI = new GnomeUI(ChatViewManager);
// HACK: Frontend.FrontendConfig out of scope
EngineManager = new EngineManager(Frontend.FrontendConfig, UI);
Entry = new Entry(ChatViewManager);
var entryScrolledWindow = new Gtk.ScrolledWindow();
entryScrolledWindow.ShadowType = Gtk.ShadowType.EtchedIn;
entryScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Never;
entryScrolledWindow.SizeRequested += delegate(object o, Gtk.SizeRequestedArgs args) {
// predict and set useful heigth
int lineWidth, lineHeigth;
using (var layout = Entry.CreatePangoLayout("Qp")) {
layout.GetPixelSize(out lineHeigth, out lineHeigth);
}
var it = Entry.Buffer.StartIter;
int newLines = 1;
// move to end of next visual line
while (Entry.ForwardDisplayLineEnd(ref it)) {
newLines++;
// calling ForwardDisplayLineEnd repeatedly stays on the same position
// therefor we move one cursor position further
it.ForwardCursorPosition();
}
newLines = Math.Min(newLines, 3);
// use text heigth + a bit extra
var bestSize = new Gtk.Requisition() {
Height = (lineHeigth * newLines) + 5
};
args.Requisition = bestSize;
};
entryScrolledWindow.Add(Entry);
ProgressBar = new Gtk.ProgressBar();
StatusHBox = new Gtk.HBox();
MenuWidget = new MenuWidget(this, ChatViewManager);
var treeviewScrolledWindow = new Gtk.ScrolledWindow() {
ShadowType = Gtk.ShadowType.EtchedIn,
HscrollbarPolicy = Gtk.PolicyType.Never,
VscrollbarPolicy = Gtk.PolicyType.Automatic
};
treeviewScrolledWindow.Add(ChatTreeView);
ChatViewManager.ChatAdded += (sender, e) => {
treeviewScrolledWindow.CheckResize();
};
var notebookPaned = new Gtk.VPaned();
notebookPaned.Pack1(Notebook, true, false);
notebookPaned.Pack2(entryScrolledWindow, false, false);
var treeviewPaned = new Gtk.HPaned();
treeviewPaned.Pack1(treeviewScrolledWindow, false, false);
treeviewPaned.Pack2(notebookPaned, true, false);
TreeViewHPaned = treeviewPaned;
var entryPaned = new Gtk.VPaned();
entryPaned.ButtonPressEvent += (sender, e) => {
// reset entry size on double click
if (e.Event.Type == Gdk.EventType.TwoButtonPress &&
e.Event.Button == 1) {
GLib.Timeout.Add(100, delegate {
entryPaned.Position = -1;
return false;
});
}
};
entryPaned.Pack1(treeviewPaned, true, false);
Gtk.VBox vbox = new Gtk.VBox();
vbox.PackStart(MenuWidget, false, false, 0);
vbox.PackStart(entryPaned, true, true, 0);
NetworkStatusbar = new Gtk.Statusbar();
NetworkStatusbar.WidthRequest = 300;
NetworkStatusbar.HasResizeGrip = false;
Statusbar = new Gtk.Statusbar();
Statusbar.HasResizeGrip = false;
Gtk.HBox status_bar_hbox = new Gtk.HBox();
status_bar_hbox.Homogeneous = true;
status_bar_hbox.PackStart(NetworkStatusbar, false, true, 0);
status_bar_hbox.PackStart(Statusbar, true, true, 0);
StatusHBox.PackStart(status_bar_hbox);
StatusHBox.PackStart(ProgressBar, false, false, 0);
StatusHBox.ShowAll();
StatusHBox.NoShowAll = true;
StatusHBox.Visible = (bool) Frontend.FrontendConfig["ShowStatusBar"];
vbox.PackStart(StatusHBox, false, false, 0);
Add(vbox);
}