Exemple #1
0
 /// <summary>
 /// Initialize a new instance of this class with the provided values
 /// </summary>
 /// <param name="toolStrip"></param>
 /// <param name="button"></param>
 public SmileyMenuItem(MessageStrip toolStrip, ToolStripDropDownButton button)
     : base(new SmileyPanel())
 {
     _Button    = button;
     _ToolStrip = toolStrip;
     Data       = _SmileyDatas[":)"];
     _Panel     = (SmileyPanel)Control;
 }
Exemple #2
0
        private void InsertSmiley(SmileyInfo data)
        {
            if (data == null)
            {
                return;
            }

            rtfMessage.Focus();
            rtfMessage.InsertImage(_SmileyImages.Images[data.ImageIndex]);
        }
Exemple #3
0
            /// <summary>
            /// Performs click operation on a menu item
            /// </summary>
            private void DoPerformClick()
            {
                if (_Panel.OverItem == null)
                {
                    Data = null;
                }
                else
                {
                    Data = _Panel.OverItem.Data;
                }

                _ToolStrip.Message.InsertImage(_SmileyImages.Images[ImageIndex]);
            }
Exemple #4
0
            /// <summary>
            /// Initialize a new instance of this class
            /// </summary>
            public SmileyPanel()
            {
                base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
                base.SetStyle(ControlStyles.StandardClick, true);
                base.BackColor = Color.Transparent;
                _Items         = new List <SmileyItem>();
                _Tooltip       = new ToolTip();

                var x = 3;
                var y = 3;

                var width  = 6 + (ItemsPerLine * OneItemSize.Width);
                var height = 6 + Convert.ToInt32(Math.Ceiling((double)_SmileyDatas.Count / (double)ItemsPerLine)) * OneItemSize.Height;

                Size = new Size(width, height);
                var pos = 0;

                foreach (string key in _SmileyDatas.Keys)
                {
                    SmileyInfo data = _SmileyDatas[key];
                    SmileyItem item = new SmileyItem
                    {
                        Data   = data,
                        Image  = _SmileyImages.Images[data.ImageIndex],
                        Bounds = new Rectangle(x, y, OneItemSize.Width, OneItemSize.Height)
                    };
                    pos++;

                    if (pos == ItemsPerLine)
                    {
                        y  += OneItemSize.Height;
                        x   = 3;
                        pos = 0;
                    }
                    else
                    {
                        x += OneItemSize.Width;
                    }
                    _Items.Add(item);
                }
            }
Exemple #5
0
        private bool ProcessSmileCommand(SmileyInfo data, int pos, string text, int cursor)
        {
            int begin = cursor - pos;

            if (begin < 0)
            {
                return(false);
            }
            if (begin + data.Command.Length > text.Length)
            {
                return(false);
            }
            string subStr = text.Substring(begin, data.Command.Length);

            if (subStr == data.Command)
            {
                rtfMessage.Select(cursor - pos, data.Command.Length - 1);
                rtfMessage.Cut();
                return(true);
            }
            return(false);
        }
Exemple #6
0
        /// <summary>
        /// Static initializer
        /// </summary>
        static FormMsgScreen()
        {
            _SmileyImages                  = new ImageList();
            _SmileyImages.ColorDepth       = ColorDepth.Depth32Bit;
            _SmileyImages.TransparentColor = Color.Transparent;
            _SmileyImages.ImageSize        = new Size(19, 19);
            _SmileyImages.Images.AddStrip(Properties.Resources.Smiley);

            _SmileyDatas = new Dictionary <string, SmileyInfo>();
            SmileyInfo[] datas = new SmileyInfo[45];
            datas[0]  = new SmileyInfo(13, "Smile", ":)");
            datas[1]  = new SmileyInfo(14, "Sad", ":(");
            datas[2]  = new SmileyInfo(1, "Angry", ":@");
            datas[3]  = new SmileyInfo(19, ":P", ":P");            // 4
            datas[4]  = new SmileyInfo(4, "Confused", ":S");
            datas[5]  = new SmileyInfo(5, "Cry", ":'(");
            datas[6]  = new SmileyInfo(7, "Shame", ":$");
            datas[7]  = new SmileyInfo(8, "E-Mail", "(E)");           //8
            datas[8]  = new SmileyInfo(15, "Attractive", "(H)");      //9
            datas[9]  = new SmileyInfo(16, "Big Smile", ":D");        //10
            datas[10] = new SmileyInfo(12, ":-O", ":-O");             //11
            datas[11] = new SmileyInfo(21, "Wink", ";)");
            datas[12] = new SmileyInfo(20, "Disappointment", ":|");
            datas[13] = new SmileyInfo(18, "(Y)", "(Y)");
            datas[14] = new SmileyInfo(17, "(N)", "(N)");
            datas[15] = new SmileyInfo(0, "Angel", "(A)");            //16
            datas[16] = new SmileyInfo(9, "Heart", "(L)");            //17
            datas[17] = new SmileyInfo(2, "(U)", "(U)");
            datas[18] = new SmileyInfo(3, "Paste", "(^)");
            datas[19] = new SmileyInfo(10, "Kiss", "(K)");
            datas[20] = new SmileyInfo(11, "Good Idea", "(I)");
            datas[21] = new SmileyInfo(6, "Satan", "(6)");
            datas[22] = new SmileyInfo(22, "Sleepy", "|-)");
            datas[23] = new SmileyInfo(23, "Dont Tell", ":-#");
            datas[24] = new SmileyInfo(24, "Toothy", "8o|");
            datas[25] = new SmileyInfo(25, "Whisper", ":-*");
            datas[26] = new SmileyInfo(26, "Sick", "+o(");
            datas[27] = new SmileyInfo(27, "Ironic", "^o)");
            datas[28] = new SmileyInfo(28, "Tray", "(pl)");
            datas[29] = new SmileyInfo(29, "Bowl", "(||)");
            datas[30] = new SmileyInfo(30, "Be right back", "(brb)");
            datas[31] = new SmileyInfo(31, "Cell Phone", "(mp)");
            datas[32] = new SmileyInfo(32, "Rain", "(st)");
            datas[33] = new SmileyInfo(33, "Tortoise", "(tu)");
            datas[34] = new SmileyInfo(34, "Plane", "(ap)");
            datas[35] = new SmileyInfo(35, "Car", "(au)");
            datas[36] = new SmileyInfo(36, "Party", "<:o)");
            datas[37] = new SmileyInfo(37, "Storm", "(li)");
            datas[38] = new SmileyInfo(38, "(ip)", "(ip)");
            datas[39] = new SmileyInfo(39, "(G)", "(G)");
            datas[40] = new SmileyInfo(40, "Camera", "(P)");
            datas[41] = new SmileyInfo(41, "Phone", "(T)");
            datas[42] = new SmileyInfo(42, "Coffee Cup", "(C)");
            datas[43] = new SmileyInfo(43, "Footbal Ball", "(so)");
            datas[44] = new SmileyInfo(44, "Pizza", "(pi)");

            foreach (SmileyInfo data in datas)
            {
                _SmileyDatas.Add(data.Command, data);
            }

            _KeywordChars = new Dictionary <char, List <SmileyInfo> >();
            foreach (SmileyInfo data in datas)
            {
                foreach (char c in data.Command)
                {
                    List <SmileyInfo> list = null;
                    if (_KeywordChars.ContainsKey(c))
                    {
                        list = _KeywordChars[c];
                    }
                    if (list == null)
                    {
                        list = new List <SmileyInfo>
                        {
                            data
                        };
                        _KeywordChars.Add(c, list);
                    }
                    else
                    {
                        list.Add(data);
                    }
                }
            }
        }