本文整理汇总了C#中Gtk.Notebook.GetNthPage方法的典型用法代码示例。如果您正苦于以下问题:C# Notebook.GetNthPage方法的具体用法?C# Notebook.GetNthPage怎么用?C# Notebook.GetNthPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Notebook
的用法示例。
在下文中一共展示了Notebook.GetNthPage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: undo
/// <summary>
/// Undo the specified notebook - page
/// </summary>
/// <param name='nb'>
/// Nb.
/// </param>
public static void undo(Notebook nb)
{
try {
((libTerminus.cRegex)nb.GetNthPage (nb.Page)).Undo ();
} catch (Exception ex) {
MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error);
}
}
示例2: GetTabOfWidget
// Is there a better way?
/// <summary>
/// Helper function for dealing with clicks on the tab labels, or whatever
/// widgets the tab label might control. Tests to see which tab the
/// indicated objects is on. This lets us identify the tabs associated
/// with click events, for example.
/// </summary>
/// <param name="o">The widget that we are seaching for</param>
/// <returns>Page number of the tab, or -1 if not found</returns>
private int GetTabOfWidget(object o, ref Notebook notebook, ref string tabName)
{
tabName = null;
Widget widg = o as Widget;
if (widg == null)
return -1;
notebook = IsControlOnLeft(o) ? notebook1 : notebook2;
for (int i = 0; i < notebook.NPages; i++)
{
// First check the tab labels
Widget testParent = notebook.GetTabLabel(notebook.GetNthPage(i));
if (testParent == widg || widg.IsAncestor(testParent))
{
tabName = notebook.GetTabLabelText(notebook.GetNthPage(i));
return i;
}
// If not found, check the tab contents
testParent = notebook.GetNthPage(i);
if (testParent == widg || widg.IsAncestor(testParent))
{
tabName = notebook.GetTabLabelText(notebook.GetNthPage(i));
return i;
}
}
return -1;
}
示例3: SaveCopy
public static void SaveCopy(Notebook _nb, int _Index)
{
string filename = ShowSaveDialog (null);
if (filename != "") {
((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Save (filename, false);
}
}
示例4: setExpressionofTab
/// <summary>
/// Sets the expressionof tab.
/// </summary>
/// <param name='_nb'>
/// Nb.
/// </param>
/// <param name='_index'>
/// Index.
/// </param>
/// <param name='_content'>
/// Content.
/// </param>
public static void setExpressionofTab(Notebook _nb, int _index, string _content, bool _append = false)
{
try {
if (_append == false)
((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).setExpressionBuffer (_content);
else
((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).appendExpressionBuffer (_content);
} catch (Exception ex) {
MessageBox.Show (ex.Message, "", ButtonsType.Ok, MessageType.Error);
}
}
示例5: getTitle
/// <summary>
/// Gets the title.
/// </summary>
/// <returns>
/// The title.
/// </returns>
/// <param name='_nb'>
/// Notebook
/// </param>
/// <param name='_Index'>
/// Index of the current page.
/// </param>
public static string getTitle(Notebook _nb, int _Index)
{
try {
cRegex p_current = ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page));
if (p_current.g_filename == "")
return g_programName;
else {
if (p_current.Saved)
return p_current.g_filename + " - " + g_programName;
else
return p_current.g_filename + "* - " + g_programName;
}
} catch (Exception ex) {
//MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error);
return g_programName + " ";
}
}
示例6: Save
/// <summary>
/// Save the specified nb, Index and Filename.
/// </summary>
/// <param name='_nb'>
/// Nb.
/// </param>
/// <param name='_Index'>
/// Index.
/// </param>
/// <param name='_Filename'>
/// Filename.
/// </param>
public static void Save(Notebook _nb, int _Index, string _Filename)
{
try {
if (_Filename != "" && disable != true) {
((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Save (_Filename);
int current = _nb.Page;
string data = ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).GetDataSourceBuffer ();
((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Saved = true;
((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).setDataBuffer (data);
g_tmp = ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page));
_nb.Remove (_nb.GetNthPage (_nb.Page));
AddTabFromFile (_nb, _Filename, current);
_nb.Page = current;
}
} catch (Exception ex) {
MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error);
}
}
示例7: getFileName
/// <summary>
/// Gets the name of the current file.
/// </summary>
/// <returns>
/// The file name.
/// </returns>
/// <param name='_nb'>
/// The notebook
/// </param>
/// <param name='_index'>
/// The current page index of the notebook.
/// </param>
public static string getFileName(Notebook _nb, int _index)
{
try {
return ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).g_filename;
//return Files [index];
} catch (IndexOutOfRangeException ex) {
MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error);
return "";
}
}
示例8: getExpressionofTab
/// <summary>
/// Gets the expression of tab.
/// </summary>
/// <returns>
/// The buffer content of the expression of the cRegex - Tab. Or if any errors appeared - "".
/// </returns>
/// <param name='_nb'>
/// The notebook.
/// </param>
/// <param name='_Index'>
/// The current page index.
/// </param>
public static string getExpressionofTab(Notebook _nb, int _Index)
{
try {
return ((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).GetExpressionBuffer ();
} catch {
return "";
}
}
示例9: CloseTab
/// <summary>
/// Closes the tab of the notebook and removes it from the <see cref="cTerminus.Files"/> List.
/// </summary>
/// <param name='_nb'>
/// The notebook
/// </param>
/// <param name='_index'>
/// The index of the current page, which should be deleted.
/// </param>
public static void CloseTab(Notebook _nb, int _index)
{
try {
if (((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Saved) {
_nb.RemovePage (_index);
g_files.RemoveAt (_index);
} else if (((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).GetExpressionBuffer () == "") {
_nb.RemovePage (_index);
g_files.RemoveAt (_index);
} else {
if (AskForClosingLastTab () == ResponseType.Yes) {
_nb.RemovePage (_index);
g_files.RemoveAt (_index);
}
}
} catch (Exception ex) {
if (_nb.GetNthPage (_nb.Page) is cConfig) {
cTerminus.isConfigTabOpen = false;
cTerminus.ConfigTabIndex = -1;
} else if (_nb.GetNthPage (_nb.Page) is cPool) {
cTerminus.isLibTabOpen = false;
LibTabIndex = -1;
//Remove the tab
}
_nb.RemovePage (_index);
_nb.ParentWindow.Title = cTerminus.getTitle (_nb, _nb.Page);
}
}
示例10: check
public static void check(Notebook nb)
{
try {
if (nb.GetNthPage (nb.Page) is cRegex) {
cTerminus.disable = false;
} else {
cTerminus.disable = true;
}
} catch {
}
}
示例11: CreateNewWindow
Notebook CreateNewWindow(Notebook source, Widget page, int x, int y)
{
Helpers.ExternalWindow window;
EventBox box;
Notebook notebook;
window = new Helpers.ExternalWindow ();
if (page == timeline) {
window.Title = Catalog.GetString ("Timeline");
} else if (page == dashboardhpaned) {
window.Title = Catalog.GetString ("Analysis dashboard");
} else if (page == playspositionviewer1) {
window.Title = Catalog.GetString ("Zonal tags viewer");
}
notebook = new Notebook ();
notebook.ShowTabs = false;
notebook.CanFocus = false;
//notebook.Group = source.Group;
window.Add (notebook);
window.SetDefaultSize (page.Allocation.Width, page.Allocation.Height);
window.Move (x, y);
window.ShowAll ();
activeWindows.Add (window);
window.DeleteEvent += (o, args) => {
Widget pa = notebook.CurrentPageWidget;
activeWindows.Remove (window);
notebook.Remove (pa);
Visible = true;
source.AppendPage (pa, null);
notebookHelper.UpdateTabs ();
notebook.Destroy ();
};
/* If we are remove the last visible page, hide the widget to
* free the empty space for the rest of widgets */
int visiblePages = 0;
for (int i = 0; i < source.NPages; i++) {
if (source.GetNthPage (i).Visible) {
visiblePages++;
}
}
if (visiblePages == 1) {
Visible = false;
}
return notebook;
}