gtkD window centering message up and no app on taskbar

Johnson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 9 12:26:54 PDT 2017


Also, could there be an easier way to import everything that is 
generally required?

I'm using an import script that does the work but I have to 
replace it upgrade time I upgrade gtkD(since I have to delete 
everything). I find that having a ton of imports is a big ugly.

What I use is, which was basically extracted from some gtkD 
example:
[It also lets use generate json for it a bit easier and use with 
easier. Probably could be enhanced but just something I through 
together]

module GtkD_All;

public import gtk.AboutDialog;
public import gtk.AccelGroup;
public import gtk.AccelLabel;
public import gtk.AccelMap;
public import gtk.Accessible;
public import gtk.Action;
public import gtk.ActionableIF;
public import gtk.ActionableT;
public import gtk.ActionBar;
public import gtk.ActionGroup;
public import gtk.ActivatableIF;
public import gtk.ActivatableT;
public import gtk.Adjustment;
public import gtk.Alignment;
public import gtk.AppChooserButton;
public import gtk.AppChooserDialog;
public import gtk.AppChooserIF;
public import gtk.AppChooserT;
public import gtk.AppChooserWidget;
public import gtk.Application;
public import gtk.ApplicationWindow;
public import gtk.Arrow;
public import gtk.ArrowAccessible;
public import gtk.AspectFrame;
public import gtk.Assistant;
public import gtk.Bin;
public import gtk.BindingEntry;
public import gtk.BindingSet;
public import gtk.BooleanCellAccessible;
public import gtk.Border;
public import gtk.Box;
public import gtk.BuildableIF;
public import gtk.BuildableT;
public import gtk.Builder;
public import gtk.Button;
public import gtk.ButtonAccessible;
public import gtk.ButtonBox;
public import gtk.Calendar;
public import gtk.CellAccessible;
public import gtk.CellAccessibleParentIF;
public import gtk.CellAccessibleParentT;
public import gtk.CellArea;
public import gtk.CellAreaBox;
public import gtk.CellAreaClass;
public import gtk.CellAreaContext;
public import gtk.CellEditable;
public import gtk.CellEditableIF;
public import gtk.CellEditableT;
public import gtk.CellLayoutIF;
public import gtk.CellLayoutT;
public import gtk.CellRenderer;
public import gtk.CellRendererAccel;
public import gtk.CellRendererClass;
public import gtk.CellRendererCombo;
public import gtk.CellRendererPixbuf;
public import gtk.CellRendererProgress;
public import gtk.CellRendererSpin;
public import gtk.CellRendererSpinner;
public import gtk.CellRendererText;
public import gtk.CellRendererToggle;
public import gtk.CellView;
public import gtk.CheckButton;
public import gtk.CheckMenuItem;
public import gtk.CheckMenuItemAccessible;
public import gtk.Clipboard;
public import gtk.ColorButton;
public import gtk.ColorChooserDialog;
public import gtk.ColorChooserIF;
public import gtk.ColorChooserT;
public import gtk.ColorChooserWidget;
public import gtk.ColorSelection;
public import gtk.ColorSelectionDialog;
public import gtk.ComboBox;
public import gtk.ComboBoxAccessible;
public import gtk.ComboBoxText;
public import gtk.Container;
public import gtk.ContainerAccessible;
public import gtk.ContainerCellAccessible;
public import gtk.ContainerClass;
public import gtk.CssProvider;
public import gtk.CssSection;
public import gtk.Dialog;
public import gtk.DragAndDrop;
public import gtk.DrawingArea;
public import gtk.EditableIF;
public import gtk.EditableT;
public import gtk.Entry;
public import gtk.EntryAccessible;
public import gtk.EntryBuffer;
public import gtk.EntryCompletion;
public import gtk.EventBox;
public import gtk.EventController;
public import gtk.Expander;
public import gtk.ExpanderAccessible;
public import gtk.FileChooserButton;
public import gtk.FileChooserDialog;
public import gtk.FileChooserIF;
public import gtk.FileChooserNative;
public import gtk.FileChooserT;
public import gtk.FileChooserWidget;
public import gtk.FileFilter;
public import gtk.Fixed;
public import gtk.FlowBox;
public import gtk.FlowBoxAccessible;
public import gtk.FlowBoxChild;
public import gtk.FlowBoxChildAccessible;
public import gtk.FontButton;
public import gtk.FontChooserDialog;
public import gtk.FontChooserIF;
public import gtk.FontChooserT;
public import gtk.FontChooserWidget;
public import gtk.FontSelection;
public import gtk.FontSelectionDialog;
public import gtk.Frame;
public import gtk.FrameAccessible;
public import gtk.Gesture;
public import gtk.GestureDrag;
public import gtk.GestureLongPress;
public import gtk.GestureMultiPress;
public import gtk.GesturePan;
public import gtk.GestureRotate;
public import gtk.GestureSingle;
public import gtk.GestureSwipe;
public import gtk.GestureZoom;
public import gtk.GLArea;
public import gtk.Gradient;
public import gtk.Grid;
public import gtk.HandleBox;
public import gtk.HBox;
public import gtk.HButtonBox;
public import gtk.HeaderBar;
public import gtk.HPaned;
public import gtk.HScale;
public import gtk.HScrollbar;
public import gtk.HSeparator;
public import gtk.HSV;
public import gtk.IconFactory;
public import gtk.IconInfo;
public import gtk.IconSet;
public import gtk.IconSize;
public import gtk.IconSource;
public import gtk.IconTheme;
public import gtk.IconView;
public import gtk.IconViewAccessible;
public import gtk.Image;
public import gtk.ImageAccessible;
public import gtk.ImageCellAccessible;
public import gtk.ImageMenuItem;
public import gtk.IMContext;
public import gtk.IMContextSimple;
public import gtk.IMMulticontext;
public import gtk.InfoBar;
public import gtk.Invisible;
public import gtk.Label;
public import gtk.LabelAccessible;
public import gtk.Layout;
public import gtk.LevelBar;
public import gtk.LevelBarAccessible;
public import gtk.LinkButton;
public import gtk.LinkButtonAccessible;
public import gtk.ListBox;
public import gtk.ListBoxAccessible;
public import gtk.ListBoxRow;
public import gtk.ListBoxRowAccessible;
public import gtk.ListStore;
public import gtk.LockButton;
public import gtk.LockButtonAccessible;
public import gtk.Main;
public import gtk.MainWindow;
public import gtk.Menu;
public import gtk.MenuAccessible;
public import gtk.MenuBar;
public import gtk.MenuButton;
public import gtk.MenuButtonAccessible;
public import gtk.MenuItem;
public import gtk.MenuItemAccessible;
public import gtk.MenuShell;
public import gtk.MenuShellAccessible;
public import gtk.MenuToolButton;
public import gtk.MessageDialog;
public import gtk.Misc;
public import gtk.ModelButton;
public import gtk.MountOperation;
public import gtk.NativeDialog;
public import gtk.Notebook;
public import gtk.NotebookAccessible;
public import gtk.NotebookPageAccessible;
public import gtk.NumerableIcon;
public import gtk.OffscreenWindow;
public import gtk.OrientableIF;
public import gtk.OrientableT;
public import gtk.Overlay;
public import gtk.PadController;
public import gtk.PageSetup;
public import gtk.Paned;
public import gtk.PanedAccessible;
public import gtk.PaperSize;
public import gtk.PlacesSidebar;
public import gtk.Plug;
public import gtk.Popover;
public import gtk.PopoverAccessible;
public import gtk.PopoverMenu;
public import gtk.PopupBox;
public import gtk.PrintContext;
public import gtk.PrintOperation;
public import gtk.PrintOperationPreview;
public import gtk.PrintOperationPreviewIF;
public import gtk.PrintOperationPreviewT;
public import gtk.PrintSettings;
public import gtk.ProgressBar;
public import gtk.ProgressBarAccessible;
public import gtk.RadioAction;
public import gtk.RadioButton;
public import gtk.RadioButtonAccessible;
public import gtk.RadioMenuItem;
public import gtk.RadioMenuItemAccessible;
public import gtk.RadioToolButton;
public import gtk.Range;
public import gtk.RangeAccessible;
public import gtk.RcProperty;
public import gtk.RcStyle;
public import gtk.RecentAction;
public import gtk.RecentChooserDialog;
public import gtk.RecentChooserIF;
public import gtk.RecentChooserMenu;
public import gtk.RecentChooserT;
public import gtk.RecentChooserWidget;
public import gtk.RecentFilter;
public import gtk.RecentInfo;
public import gtk.RecentManager;
public import gtk.RendererCellAccessible;
public import gtk.Requisition;
public import gtk.Revealer;
public import gtk.Scale;
public import gtk.ScaleAccessible;
public import gtk.ScaleButton;
public import gtk.ScaleButtonAccessible;
public import gtk.ScrollableIF;
public import gtk.ScrollableT;
public import gtk.Scrollbar;
public import gtk.ScrolledWindow;
public import gtk.ScrolledWindowAccessible;
public import gtk.SearchBar;
public import gtk.SearchEntry;
public import gtk.SelectionData;
public import gtk.Separator;
public import gtk.SeparatorMenuItem;
public import gtk.SeparatorToolItem;
public import gtk.Settings;
public import gtk.ShortcutLabel;
public import gtk.ShortcutsGroup;
public import gtk.ShortcutsSection;
public import gtk.ShortcutsShortcut;
public import gtk.ShortcutsWindow;
public import gtk.SizeGroup;
public import gtk.Socket;
public import gtk.SpinButton;
public import gtk.SpinButtonAccessible;
public import gtk.Spinner;
public import gtk.SpinnerAccessible;
public import gtk.Stack;
public import gtk.StackAccessible;
public import gtk.StackSidebar;
public import gtk.StackSwitcher;
public import gtk.Statusbar;
public import gtk.StatusbarAccessible;
public import gtk.StatusIcon;
public import gtk.StockItem;
public import gtk.Style;
public import gtk.StyleContext;
public import gtk.StyleProperties;
public import gtk.StyleProviderIF;
public import gtk.StyleProviderT;
public import gtk.Switch;
public import gtk.SwitchAccessible;
public import gtk.SymbolicColor;
public import gtk.Table;
public import gtk.TargetEntry;
public import gtk.TargetList;
public import gtk.TearoffMenuItem;
public import gtk.Testing;
public import gtk.TextAttributes;
public import gtk.TextBuffer;
public import gtk.TextCellAccessible;
public import gtk.TextChildAnchor;
public import gtk.TextIter;
public import gtk.TextMark;
public import gtk.TextTag;
public import gtk.TextTagTable;
public import gtk.TextView;
public import gtk.TextViewAccessible;
public import gtk.ThemingEngine;
public import gtk.ToggleAction;
public import gtk.ToggleButton;
public import gtk.ToggleButtonAccessible;
public import gtk.ToggleToolButton;
public import gtk.Toolbar;
public import gtk.ToolButton;
public import gtk.ToolItem;
public import gtk.ToolItemGroup;
public import gtk.ToolPalette;
public import gtk.ToolShellIF;
public import gtk.ToolShellT;
public import gtk.Tooltip;
public import gtk.ToplevelAccessible;
public import gtk.TreeDragDestIF;
public import gtk.TreeDragDestT;
public import gtk.TreeDragSourceIF;
public import gtk.TreeDragSourceT;
public import gtk.TreeIter;
public import gtk.TreeIterError;
public import gtk.TreeModel;
public import gtk.TreeModelFilter;
public import gtk.TreeModelIF;
public import gtk.TreeModelSort;
public import gtk.TreeModelT;
public import gtk.TreeNode;
public import gtk.TreePath;
public import gtk.TreeRowReference;
public import gtk.TreeSelection;
public import gtk.TreeSortableIF;
public import gtk.TreeSortableT;
public import gtk.TreeStore;
public import gtk.TreeView;
public import gtk.TreeViewAccessible;
public import gtk.TreeViewColumn;
public import gtk.UIManager;
public import gtk.VBox;
public import gtk.VButtonBox;
public import gtk.Version;
public import gtk.Viewport;
public import gtk.VolumeButton;
public import gtk.VPaned;
public import gtk.VScale;
public import gtk.VScrollbar;
public import gtk.VSeparator;
public import gtk.Widget;
public import gtk.WidgetAccessible;
public import gtk.WidgetClass;
public import gtk.WidgetPath;
public import gtk.Window;
public import gtk.WindowAccessible;
public import gtk.WindowGroup;

// Loads the glade interface element id's and types directly from 
the glade interface file so we do not have to declare them 
manually
// Use: @("Glade") { 
mixin(DeclareGladeInterfaceElements!gladeFile); } where ever 
variables will be defined and InstantiateGladeInterfaceElements( 
to initalize them
public string DeclareGladeInterfaceElements(string filename)()
{
	auto token1 = "<object class=\"";
	auto token2 = " id=\"";
	string res = "";
	import std.file;
	auto data = import(filename);
	for(int i = 0; i < data.length; i++)
	{
		// Matched class/object type, get name actual type then get id 
if it has one.
		if (i+token1.length < data.length && data[i..i+token1.length] 
== token1)
		{
			i += token1.length;
			auto pos = i;
			while(i < data.length && data[i] != '"') i++;
			auto type = cast(string)data[pos..i];

			// Match id if it has one.
			while(i+token2.length < data.length && data[i] != '>' && 
data[i] != '<' && data[i] != '"' && data[i..i+token2.length] != 
token2) i++;
			i++;

			if (data[i] == '>') { continue; }
			i += token2.length;
			pos = i;
			if (data[i] == '>') { continue; }
			while(i+1 < data.length && data[i] != '"') i++;
			res ~= "public gtk."~type[3..$] ~ " " ~ data[pos..i] ~ 
";\n";			
		}

		if (i > data.length - 7130)
		{
			continue;
		}
	}
	return res;
}

public void InstantiateGladeInterfaceElements(T)(Builder builder, 
T t)
{
	import std.meta;		
	foreach(m; __traits(allMembers, T))
	{
		mixin("enum w = __traits(getAttributes, T."~m~");");		
		static if (w.length > 0 && w[0] == "Glade")
		{
			mixin("t."~m~" = 
(cast(typeof(T."~m~"))builder.getObject(`"~m~"`));");
			mixin("if (t."~m~" is null) { error(\"Error: `"~m~"` not 
found, User Interface Corrupted, Cannot continue!\"); }");
		}
	}
}


void error(string err)
{
	import core.stdc.stdlib, std.stdio;
	writeln(err);
	getchar();
	
	core.stdc.stdlib.exit(-1);
}


More information about the Digitalmars-d-learn mailing list