Exemplo n.º 1
0
        public IpaKeyboardView() : base(false, (int)AppSettings.Margin)
        {
            textManager = new IpaTextManager();

            createHotKeyTable();
            addTextField();
        }
Exemplo n.º 2
0
        private void createHotKeyTable()
        {
            var hotKeyView = new Frame("Hotkeys (Alt + key multiple times)");

            var hotKeyScroll = new ScrolledWindow();

            hotKeyScroll.VscrollbarPolicy = PolicyType.Never;
            hotKeyScroll.HscrollbarPolicy = PolicyType.Automatic;

            var  hotKeyBoxContainer = new VBox(false, (int)AppSettings.Margin);
            HBox row = null;

            for (int i = 0; i < HotKey.HotKeys.Length; i++)
            {
                // Add new row if needed
                if (i % AppSettings.MaxHotKeysPerRow == 0)
                {
                    if (row != null)
                    {
                        hotKeyBoxContainer.PackStart(
                            row, false, false, AppSettings.Margin
                            );
                    }
                    row = new HBox(false, (int)AppSettings.Margin);
                }

                // Generate box
                var hotKey           = HotKey.HotKeys[i];
                var hotKeyContainer  = new HBox(false, (int)AppSettings.Margin);
                var hotKeyLabelFrame = new Frame();
                hotKeyLabelFrame.Add(
                    new Label(IpaTextManager.hotKeyStr(hotKey))
                    );
                hotKeyContainer.PackStart(
                    hotKeyLabelFrame, false, false, AppSettings.Margin
                    );

                // Get ipa stuff
                var symbolList = new StringBuilder(": { ");
                foreach (var symbol in hotKey.symbols)
                {
                    symbolList.Append(symbol).Append(", ");
                }
                symbolList.Remove(symbolList.Length - 2, 2);
                symbolList.Append(" }");

                hotKeyContainer.PackStart(
                    new Label(symbolList.ToString()), false, false,
                    AppSettings.Margin
                    );

                row.PackStart(
                    hotKeyContainer, false, false, AppSettings.Margin
                    );
            }
            hotKeyBoxContainer.PackStart(
                row, false, false, AppSettings.Margin
                );

            hotKeyScroll.Add(hotKeyBoxContainer);
            hotKeyView.Add(hotKeyScroll);
            PackStart(hotKeyView, false, false, AppSettings.Margin);
        }