LCOV - app.info - content/html/content/src/nsRadioVisitor.h

LCOV - code coverage report
| Current view: | directory - content/html/content/src - nsRadioVisitor.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 14 | 0 | 0.0 %
| Date: | 2012-07-07 | Functions: | 12 | 0 | 0.0 %

           1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
           2                 : /* ***** BEGIN LICENSE BLOCK *****
           3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           4                 :  *
           5                 :  * The contents of this file are subject to the Mozilla Public License Version
           6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           7                 :  * the License. You may obtain a copy of the License at
           8                 :  * http://www.mozilla.org/MPL/
           9                 :  *
          10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          12                 :  * for the specific language governing rights and limitations under the
          13                 :  * License.
          14                 :  *
          15                 :  * The Original Code is Mozilla code.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is Mozilla Foundation
          18                 :  * Portions created by the Initial Developer are Copyright (C) 2010
          19                 :  * the Initial Developer. All Rights Reserved.
          20                 :  *
          21                 :  * Contributor(s):
          22                 :  *   Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
          23                 :  *
          24                 :  * Alternatively, the contents of this file may be used under the terms of
          25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          28                 :  * of those above. If you wish to allow use of your version of this file only
          29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          30                 :  * use your version of this file under the terms of the MPL, indicate your
          31                 :  * decision by deleting the provisions above and replace them with the notice
          32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          33                 :  * the provisions above, a recipient may use your version of this file under
          34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          35                 :  *
          36                 :  * ***** END LICENSE BLOCK ***** */
          37                 :
          38                 : #ifndef _nsRadioVisitor_h__
          39                 : #define _nsRadioVisitor_h__
          40                 :
          41                 : #include "nsIRadioVisitor.h"
          42                 :
          43                 : class nsIFormControl;
          44                 : class nsIDocument;
          45                 :
          46                 :
          47                 : /**
          48                 :  * nsRadioVisitor is the base class implementing nsIRadioVisitor and inherited
          49                 :  * by all radio visitors.
          50                 :  */
          51                 : class nsRadioVisitor : public nsIRadioVisitor
          52                 : {
          53                 : public:
          54               0 :   nsRadioVisitor() { }
          55               0 :   virtual ~nsRadioVisitor() { }
          56                 :
          57                 :   NS_DECL_ISUPPORTS
          58                 :
          59                 :   virtual bool Visit(nsIFormControl* aRadio) = 0;
          60                 : };
          61                 :
          62                 : /**
          63                 :  * The following declarations are radio visitors inheriting from nsRadioVisitor.
          64                 :  */
          65                 :
          66                 : /**
          67                 :  * nsRadioSetCheckedChangedVisitor is calling SetCheckedChanged with the given
          68                 :  * parameter to all radio elements in the group.
          69                 :  */
          70                 : class nsRadioSetCheckedChangedVisitor : public nsRadioVisitor
          71               0 : {
          72                 : public:
          73               0 :   nsRadioSetCheckedChangedVisitor(bool aCheckedChanged)
          74               0 :     : mCheckedChanged(aCheckedChanged)
          75               0 :     { }
          76                 :
          77                 :   virtual bool Visit(nsIFormControl* aRadio);
          78                 :
          79                 : protected:
          80                 :   bool mCheckedChanged;
          81                 : };
          82                 :
          83                 : /**
          84                 :  * nsRadioGetCheckedChangedVisitor is getting the current checked changed value.
          85                 :  * Getting it from one radio element is the group is enough given that all
          86                 :  * elements should have the same value.
          87                 :  */
          88                 : class nsRadioGetCheckedChangedVisitor : public nsRadioVisitor
          89               0 : {
          90                 : public:
          91               0 :   nsRadioGetCheckedChangedVisitor(bool* aCheckedChanged,
          92                 :                                   nsIFormControl* aExcludeElement)
          93                 :     : mCheckedChanged(aCheckedChanged)
          94               0 :     , mExcludeElement(aExcludeElement)
          95               0 :     { }
          96                 :
          97                 :   virtual bool Visit(nsIFormControl* aRadio);
          98                 :
          99                 : protected:
         100                 :   bool* mCheckedChanged;
         101                 :   nsIFormControl* mExcludeElement;
         102                 : };
         103                 :
         104                 : /**
         105                 :  * nsRadioSetValueMissingState is calling SetValueMissingState with the given
         106                 :  * parameter to all radio elements in the group.
         107                 :  * It is also calling ContentStatesChanged if needed.
         108                 :  */
         109                 : class nsRadioSetValueMissingState : public nsRadioVisitor
         110               0 : {
         111                 : public:
         112               0 :   nsRadioSetValueMissingState(nsIFormControl* aExcludeElement,
         113                 :                               bool aValidity, bool aNotify)
         114                 :     : mExcludeElement(aExcludeElement)
         115                 :     , mValidity(aValidity)
         116               0 :     , mNotify(aNotify)
         117               0 :     { }
         118                 :
         119                 :   virtual bool Visit(nsIFormControl* aRadio);
         120                 :
         121                 : protected:
         122                 :   nsIFormControl* mExcludeElement;
         123                 :   bool mValidity;
         124                 :   bool mNotify;
         125                 : };
         126                 :
         127                 : #endif // _nsRadioVisitor_h__
         128                 :

Generated by: LCOV version 1.7