Hi Laurent, and others,

Here is a patch to enhance menus, by exposing more Windows options to Perl.

The new code is in the first part of the patch, I think you have already applied the second part of the patch.

After the patch I give a usage sample.


diff -c D:\Win32-GUI-rel-0.0.665\gui_options.cpp gui_options.cpp
*** D:\Win32-GUI-rel-0.0.665\gui_options.cpp    Wed Feb 27 03:09:22 2002
--- gui_options.cpp     Sat Jan  3 20:55:41 2004
***************
*** 896,901 ****
--- 896,913 ----
                  SwitchBit(mii->fMask, MIIM_TYPE, 1);
                  next_i = i + 1;
                  SwitchBit(mii->fType, MFT_SEPARATOR, SvIV(ST(next_i)));
+             } else if(strcmp(option, "-menubarbreak") == 0) {
+                 SwitchBit(mii->fMask, MIIM_TYPE, 1);
+                 next_i = i + 1;
+                 SwitchBit(mii->fType, MFT_MENUBARBREAK, SvIV(ST(next_i)));
+             } else if(strcmp(option, "-menubreak") == 0) {
+                 SwitchBit(mii->fMask, MIIM_TYPE, 1);
+                 next_i = i + 1;
+                 SwitchBit(mii->fType, MFT_MENUBREAK, SvIV(ST(next_i)));
+             } else if(strcmp(option, "-radiocheck") == 0) {
+                 SwitchBit(mii->fMask, MIIM_TYPE, 1);
+                 next_i = i + 1;
+                 SwitchBit(mii->fType, MFT_RADIOCHECK, SvIV(ST(next_i)));
              } else if(strcmp(option, "-default") == 0) {
                  SwitchBit(mii->fMask, MIIM_STATE, 1);
                  next_i = i + 1;
***************
*** 907,913 ****
              } else if(strcmp(option, "-enabled") == 0) {
                  SwitchBit(mii->fMask, MIIM_STATE, 1);
                  next_i = i + 1;
!                 SwitchBit(mii->fState, MFS_ENABLED, SvIV(ST(next_i)));
              } else if(strcmp(option, "-name") == 0) {
                  next_i = i + 1;
  #ifdef PERLWIN32GUI_STRONGDEBUG
--- 919,925 ----
              } else if(strcmp(option, "-enabled") == 0) {
                  SwitchBit(mii->fMask, MIIM_STATE, 1);
                  next_i = i + 1;
!                 SwitchBit(mii->fState, MFS_DISABLED, ! SvIV(ST(next_i)));
              } else if(strcmp(option, "-name") == 0) {
                  next_i = i + 1;
  #ifdef PERLWIN32GUI_STRONGDEBUG
=====================================================================

$m_config = new Win32::GUI::Menu (
  'Config' => 'sConfig',
  ">&newest" => 'sNewest',
  ">&this year" => 'sThisYear',
  ">&last year" => 'sLastYear',
  ">&prior year" => 'sPriorYear',
  ">&all years" => 'sAllYear',
  ">&open file" => 'sFile',
  ">&show debug window" => 'sShowDos',
  ">&reset data directory" => 'sGetDataDir',
  );
if ( ! $m_config )
{ & mydie ( $msgpfx . "m_config creation error: $^E\n" );
}

$m_config->{'sFile'}->Change( -menubarbreak => 1 );

This causes the last three entries to be displayed in a separate menu column, with a vertical separator bar.

I suppose one could instead parse special characters after the > in the menu entry, and set these automatically, but it would risk backwards compatibility with user's existing menu entry texts.

--
Glenn -- http://nevcal.com/
===========================
The best part about procrastination is that you are never bored,
because you have all kinds of things that you should be doing.


Reply via email to