libyui  3.0.10
/usr/src/RPM/BUILD/libyui-3.0.10/src/YWidget_OptimizeChanges.h
00001 /*
00002   Copyright (C) 2000-2012 Novell, Inc
00003   This library is free software; you can redistribute it and/or modify
00004   it under the terms of the GNU Lesser General Public License as
00005   published by the Free Software Foundation; either version 2.1 of the
00006   License, or (at your option) version 3.0 of the License. This library
00007   is distributed in the hope that it will be useful, but WITHOUT ANY
00008   WARRANTY; without even the implied warranty of MERCHANTABILITY or 
00009   FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00010   License for more details. You should have received a copy of the GNU
00011   Lesser General Public License along with this library; if not, write
00012   to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
00013   Floor, Boston, MA 02110-1301 USA
00014 */
00015 
00016 
00017 /*-/
00018 
00019   File:         YWidget_OptimizeChanges.h
00020 
00021   Author:       Michael Andres <ma@suse.de>
00022 
00023 /-*/
00024 
00025 #ifndef YWidget_OptimizeChanges_h
00026 #define YWidget_OptimizeChanges_h
00027 
00028 
00029 // Moved out of YWidget.h because it's really utterly out of place there.
00030 
00031 #ifndef YWidget_h
00032 #error Do not include this file from anywhere outside YWidget.h!
00033 #endif
00034 
00035 // class YWidget
00036 // {
00037 
00038 public:
00039     /**
00040      * Helper class that calls startMultipleChanges() in its constructor
00041      * and cares about the necessary call to doneMultipleChanges() when it goes
00042      * out of scope.
00043      **/
00044     class OptimizeChanges
00045     {
00046     public:
00047         OptimizeChanges( YWidget & w ) : yw(w)  { yw.startMultipleChanges(); }
00048         ~OptimizeChanges()                      { yw.doneMultipleChanges();  }
00049     private:
00050         OptimizeChanges( const OptimizeChanges & ); // no copy
00051         void operator=( const OptimizeChanges & );  // no assign
00052         YWidget & yw;
00053     };
00054 
00055 // }; // class YWidget
00056 
00057 
00058 #endif // YWidget_OptimizeChanges_h
 All Classes Functions Variables Enumerations Friends