Update of /cvsroot/perl-win32-gui/Win32-GUI
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8132

Modified Files:
        CHANGELOG GUI.pm GUI.xs Textfield.xs 
Log Message:
Add -wantreturn option for Textfields and RichEdit;  Add Animate() window method

Index: Textfield.xs
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Textfield.xs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Textfield.xs        3 Aug 2005 21:45:57 -0000       1.7
--- Textfield.xs        23 Jun 2006 23:08:07 -0000      1.8
***************
*** 55,58 ****
--- 55,59 ----
      } else if BitmaskOptionValue("-autovscroll",   perlcs->cs.style, 
ES_AUTOVSCROLL)
      } else if BitmaskOptionValue("-number",        perlcs->cs.style, 
ES_NUMBER)
+     } else if BitmaskOptionValue("-wantreturn",    perlcs->cs.style, 
ES_WANTRETURN)
      } else retval = FALSE;
  

Index: GUI.xs
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI.xs,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** GUI.xs      23 Jun 2006 18:35:33 -0000      1.60
--- GUI.xs      23 Jun 2006 23:08:07 -0000      1.61
***************
*** 1949,1952 ****
--- 1949,1967 ----
  
      
###########################################################################
+     # (@)INTERNAL:_Animate(HANDLE, TIME, FLAGS)
+     # Wrapper for Win32 AnimateWindow call.  See Win32::GUI::Animate in GUI.pm
+     # for more details.
+ BOOL
+ _Animate(handle, time, flags)
+     HWND handle
+     DWORD time
+     DWORD flags
+ CODE:
+     RETVAL = AnimateWindow(handle, time, flags);
+ OUTPUT:
+     RETVAL
+     
+ 
+     
###########################################################################
      # (@)METHOD:Hide()
      # Hides a window or control.

Index: GUI.pm
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI.pm,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** GUI.pm      23 Jun 2006 18:35:33 -0000      1.50
--- GUI.pm      23 Jun 2006 23:08:07 -0000      1.51
***************
*** 379,382 ****
--- 379,477 ----
  }
  
+     
###########################################################################
+     # (@)METHOD:Animate(%OPTIONS)
+     # Apply special effects when showing or hiding a window.  Used instead of
+     # L<Show()|Show> or L<Hide()|Hide>.
+     #
+     # OPTIONS can take the following values:
+     #   -show      => (0|1)                             default: 1
+     #     Hide(0) or Show(1) the window
+     #
+     #   -activate  => (0|1)                             default: 0
+     #     Activate the window.  Ignored if hiding the
+     #     window
+     #
+     #   -animation => (roll|slide|blend|center)         default: 'roll'
+     #     Animation type:
+     #         roll:   use roll animation
+     #         slide:  use slide animation
+     #         blend:  use a fade effect.  Top-level
+     #                 windows only
+     #         center: expand out if showing, collapse
+     #                 in when hiding
+     #
+     #   -time      => time                              default: 200
+     #     Animation time in milli-seconds
+     #
+     #   -direction => (lr|tlbr|tb|trbl|rl|brtl|bt|blrt) default: 'lr'
+     #     Animation direction (l=left, r=right, t=top, b=bottom).
+     #     Ignored for animation types blend and center
+     #
+     # Returns a true value on success or a false value on failure
+     #
+     # NOTE: blend animation does not work on Win98.  It is recomended
+     # that you always check the return value from this function and
+     # issue a suitable Show() or Hide() on failure.
+ sub Animate {
+     my $win = shift;
+ 
+    my %options = @_;
+    my $show      = delete $options{-show};
+    my $activate  = delete $options{-activate};
+    my $animation = delete $options{-animation};
+    my $time      = delete $options{-time};
+    my $direction = delete $options{-direction};
+ 
+    if(keys(%options) != 0) {
+        require Carp;
+        Carp::carp "Animate: Unrecognised options ".join(", ", keys(%options));
+        return undef
+    }
+ 
+    $show      = 1      unless defined $show;
+    $activate  = 0      unless defined $activate;
+    $animation = 'roll' unless defined $animation;
+    $time      = 200    unless defined $time;
+    $direction = 'lr'   unless defined $direction;
+ 
+    if($animation !~ /roll|slide|blend|center/) {
+        require Carp;
+        Carp::carp "Animate: Unrecognised animation type: $animation";
+        return undef;
+    }
+ 
+    if($direction !~ /lr|tlbr|tb|trbl|rl|brtl|bt|blrt/) {
+        require Carp;
+        Carp::carp "Animate: Unrecognised direction: $direction";
+        return undef;
+    }
+ 
+    # create the flags:
+    my $flags = 0;
+    $flags |= 65536  unless $show;              # AW_HIDE = 65536
+    $flags |= 131072 if ($activate && $show);   # AW_ACTIVATE = 131072
+ 
+    $flags |= 262144 if $animation eq 'slide';  # AW_SLIDE = 262144
+    $flags |= 16     if $animation eq 'center'; # AW_CENTER = 16
+    $flags |= 524288 if $animation eq 'blend';  # AW_BLEND = 524288
+ 
+    # horizontal direction
+    $direction =~ /([lr])/;
+    $flags |= 1 if defined $1 and $1 eq 'l';    # AW_HOR_POSITIVE = 1
+    $flags |= 2 if defined $1 and $1 eq 'r';    # AW_HOR_NEGATIVE = 2
+    
+    # vertical direction
+    $direction =~ /([tb])/;
+    $flags |= 4 if defined $1 and $1 eq 't';    # AW_VER_POSITIVE = 4
+    $flags |= 8 if defined $1 and $1 eq 'b';    # AW_VER_NEGATIVE = 8
+ 
+    # Do the animation
+    # TODO: AW_BLEND doesn't work under Win98.  There are other failure
+    # modes too (e.g. AW_BLEND on non-top-level window.  Should we detect
+    # failure and use Show() in that case? Or is that just confusing?
+    return $win->_Animate($time, $flags);
+ }
+    
+     
  
###############################################################################
  # SUB-PACKAGES
***************
*** 1277,1280 ****
--- 1372,1379 ----
      #   -readonly      => 0/1 (default 0)
      #       text can't be changed.
+     #   -wantreturn    => 0/1 (default 0)
+     #       when C<< dialogui => 1 >> is in effect, stops the <ENTER> key
+     #       behaving as a click on the default button, and allows the
+     #       key to be entered in a multi-line Textfield
      #
      # The C<-prompt> option is very special; if a string is passed, a

Index: CHANGELOG
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/CHANGELOG,v
retrieving revision 1.88
retrieving revision 1.89
diff -C2 -d -r1.88 -r1.89
*** CHANGELOG   23 Jun 2006 18:36:10 -0000      1.88
--- CHANGELOG   23 Jun 2006 23:08:07 -0000      1.89
***************
*** 6,9 ****
--- 6,17 ----
  Win32-GUI ChangeLog
  ===================
+ + [Robert May] : 23 June 2006 - -wantreturn and AnimateWindow
+     - GUI.pm, Textfield.xs - add -wantreturn option to constructor
+       for Textfield (and RichEdit), along with documentation
+     - GUI.pm, GUI.xs, samples/AnimateWindow.pl - add Animate() window
+       method.
+     --- Win32::GUI::Constants ---
+     - add AnimateWindow AW_* constants
+ 
  + [Robert May] : 23 June 2006 - ClassData method and memory leak fixes
      - GUI.pm, GUI.xs, GUI_Helpers.cpp - change implementation of


Reply via email to