@@ -56,32 +56,44 @@ class NCMenuLine : public NCTableLine
5656 , fchild( 0 )
5757 , prefix( 0 )
5858 {
59- YMGAMenuItem *mi = dynamic_cast <YMGAMenuItem*> (yitem);
60- if ( mi->hidden ())
61- {
62- yuiDebug () << mi->label () << " hidden" << std::endl;
63- SetState (S_HIDDEN);
64- }
65- else if ( !mi->enabled () )
66- {
67- yuiDebug () << mi->label () << " disabled" << std::endl;
68- SetState ( S_DISABELED );
6959
70- }
71-
72- // leaving next even if managed into MGAPopupMenu
73- if ( yitem->hasChildren () )
74- {
60+ YMenuSeparator *separator = dynamic_cast <YMenuSeparator *>(yitem);
61+ if (separator)
62+ {
63+ // Append( new NCTableCol( "", NCTableCol::SEPARATOR ) );
64+ SetState ( S_DISABELED );
65+ }
66+ else
67+ {
68+ YMGAMenuItem *mi = dynamic_cast <YMGAMenuItem*> (yitem);
69+ YUI_CHECK_PTR (mi);
70+
71+ if ( mi->hidden ())
72+ {
73+ yuiDebug () << mi->label () << " hidden" << std::endl;
74+ SetState (S_HIDDEN);
75+ }
76+ else if ( !mi->enabled () )
77+ {
78+ yuiDebug () << mi->label () << " disabled" << std::endl;
79+ SetState ( S_DISABELED );
80+ }
81+ else
82+ {
7583 SetState (S_HEADLINE);
76- yuiDebug () << mi->label () << " has submenu" << std::endl;
77- Append ( new NCTableCol ( NCstring ( yitem->label () + " ..." ) ) );
78- }
79- else
80- {
81- SetState (S_HEADLINE);
82- Append ( new NCTableCol ( NCstring ( yitem->label () ) ) );
83- }
84- stripHotkeys ();
84+ }
85+
86+ // leaving next even if managed into MGAPopupMenu
87+ if ( yitem->hasChildren () )
88+ { yuiDebug () << mi->label () << " has submenu" << std::endl;
89+ Append ( new NCTableCol ( NCstring ( yitem->label () + " ..." ) ) );
90+ }
91+ else
92+ {
93+ Append ( new NCTableCol ( NCstring ( yitem->label () ) ) );
94+ }
95+ stripHotkeys ();
96+ }
8597 }
8698
8799 virtual ~NCMenuLine () {
@@ -100,28 +112,33 @@ class NCMenuLine : public NCTableLine
100112 NCTableStyle & tableStyle,
101113 bool active ) const
102114 {
103- NClabel l (NCstring (yitem->label ()));
104- l.stripHotkey ();
105- yuiDebug () << yitem->label () << " hotcol: " << l.hotpos () << " hotkey: " << l.hotkey () << std::endl;
106-
107- if ( !isSpecial () )
108- w.bkgdset ( tableStyle.hotBG ( vstate, NCTableCol::PLAIN ) );
115+ YMenuSeparator *separator = dynamic_cast <YMenuSeparator *>(yitem);
116+ if (separator)
117+ {
118+ w.move ( at.Pos .L , at.Pos .C );
119+ w.hline (ACS_HLINE, 0 );
120+ }
121+ else
122+ {
123+ NClabel l (NCstring (yitem->label ()));
124+ l.stripHotkey ();
125+ yuiDebug () << yitem->label () << " hotcol: " << l.hotpos () << " hotkey: " << l.hotkey () << std::endl;
109126
110- // tableStyle.highlightBG( vstate, NCTableCol::HINT);
127+ if ( !isSpecial () )
128+ w.bkgdset ( tableStyle.hotBG ( vstate, NCTableCol::PLAIN ) );
111129
112- yuiDebug () << " tableStyle hotcol: " << tableStyle.listStyle ().title << " bg: " << tableStyle.hotBG (vstate, tableStyle.HotCol ()) << std::endl;
130+ yuiDebug () << " tableStyle hotcol: " << tableStyle.listStyle ().title << " bg: " << tableStyle.hotBG (vstate, tableStyle.HotCol ()) << std::endl;
113131
114132
115- NCTableLine::DrawAt ( w, at, tableStyle, active );
116- // NOTE I couldn't be able to fix hot char representation, so i had to force it
117- if (l.hasHotkey ())
118- {
119- w.move (at.Pos .L , l.hotpos ());
120- w.addch (l.hotkey () | A_UNDERLINE);
133+ NCTableLine::DrawAt ( w, at, tableStyle, active );
134+ // NOTE I couldn't be able to fix hot char representation, so i had to force it
135+ if (l.hasHotkey ())
136+ {
137+ w.move (at.Pos .L , l.hotpos ());
138+ w.addch (l.hotkey () | A_UNDERLINE);
139+ }
140+ // w.move( at.Pos.L, at.Pos.C );
121141 }
122-
123- w.move ( at.Pos .L , at.Pos .C );
124-
125142 }
126143};
127144
@@ -210,7 +227,7 @@ YMenuItem * NCMenu::getCurrentItem() const
210227 {
211228 const NCMenuLine * cline = dynamic_cast <const NCMenuLine *>( myPad ()->GetCurrentLine () );
212229
213- if ( cline )
230+ if ( cline && cline-> isEnabeled () )
214231 yitem = cline->YItem ();
215232 }
216233
0 commit comments