LCOV - code coverage report
Current view: directory - accessible/src/atk - nsMaiInterfaceValue.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 62 0 0.0 %
Date: 2012-06-02 Functions: 6 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* vim: set ts=2 et sw=2 tw=80: */
       3                 : /* ***** BEGIN LICENSE BLOCK *****
       4                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       5                 :  *
       6                 :  * The contents of this file are subject to the Mozilla Public License Version
       7                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       8                 :  * the License. You may obtain a copy of the License at
       9                 :  * http://www.mozilla.org/MPL/
      10                 :  *
      11                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      12                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      13                 :  * for the specific language governing rights and limitations under the
      14                 :  * License.
      15                 :  *
      16                 :  * The Original Code is mozilla.org code.
      17                 :  *
      18                 :  * The Initial Developer of the Original Code is
      19                 :  * Sun Microsystems, Inc.
      20                 :  * Portions created by the Initial Developer are Copyright (C) 2002
      21                 :  * the Initial Developer. All Rights Reserved.
      22                 :  *
      23                 :  * Contributor(s):
      24                 :  *   Silvia Zhao (silvia.zhao@sun.com)
      25                 :  *
      26                 :  * Alternatively, the contents of this file may be used under the terms of
      27                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      28                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      30                 :  * of those above. If you wish to allow use of your version of this file only
      31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      32                 :  * use your version of this file under the terms of the MPL, indicate your
      33                 :  * decision by deleting the provisions above and replace them with the notice
      34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      35                 :  * the provisions above, a recipient may use your version of this file under
      36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      37                 :  *
      38                 :  * ***** END LICENSE BLOCK ***** */
      39                 : 
      40                 : #include "nsMaiInterfaceValue.h"
      41                 : 
      42                 : void
      43               0 : valueInterfaceInitCB(AtkValueIface *aIface)
      44                 : {
      45               0 :     NS_ASSERTION(aIface, "Invalid aIface");
      46               0 :     if (!aIface)
      47               0 :         return;
      48                 : 
      49               0 :     aIface->get_current_value = getCurrentValueCB;
      50               0 :     aIface->get_maximum_value = getMaximumValueCB;
      51               0 :     aIface->get_minimum_value = getMinimumValueCB;
      52               0 :     aIface->get_minimum_increment = getMinimumIncrementCB;
      53               0 :     aIface->set_current_value = setCurrentValueCB;
      54                 : }
      55                 : 
      56                 : void
      57               0 : getCurrentValueCB(AtkValue *obj, GValue *value)
      58                 : {
      59               0 :     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
      60               0 :     if (!accWrap)
      61               0 :         return;
      62                 : 
      63               0 :     nsCOMPtr<nsIAccessibleValue> accValue;
      64                 :     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
      65               0 :                             getter_AddRefs(accValue));
      66               0 :     if (!accValue)
      67                 :         return;
      68                 : 
      69               0 :     memset (value,  0, sizeof (GValue));
      70                 :     double accDouble;
      71               0 :     if (NS_FAILED(accValue->GetCurrentValue(&accDouble)))
      72                 :         return;
      73               0 :     g_value_init (value, G_TYPE_DOUBLE);
      74               0 :     g_value_set_double (value, accDouble);
      75                 : }
      76                 : 
      77                 : void
      78               0 : getMaximumValueCB(AtkValue *obj, GValue *value)
      79                 : {
      80               0 :     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
      81               0 :     if (!accWrap)
      82               0 :         return;
      83                 : 
      84               0 :     nsCOMPtr<nsIAccessibleValue> accValue;
      85                 :     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
      86               0 :                             getter_AddRefs(accValue));
      87               0 :     if (!accValue)
      88                 :         return;
      89                 : 
      90               0 :     memset (value,  0, sizeof (GValue));
      91                 :     double accDouble;
      92               0 :     if (NS_FAILED(accValue->GetMaximumValue(&accDouble)))
      93                 :         return;
      94               0 :     g_value_init (value, G_TYPE_DOUBLE);
      95               0 :     g_value_set_double (value, accDouble);
      96                 : }
      97                 : 
      98                 : void
      99               0 : getMinimumValueCB(AtkValue *obj, GValue *value)
     100                 : {
     101               0 :     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
     102               0 :     if (!accWrap)
     103               0 :         return;
     104                 : 
     105               0 :     nsCOMPtr<nsIAccessibleValue> accValue;
     106                 :     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
     107               0 :                             getter_AddRefs(accValue));
     108               0 :     if (!accValue)
     109                 :         return;
     110                 : 
     111               0 :     memset (value,  0, sizeof (GValue));
     112                 :     double accDouble;
     113               0 :     if (NS_FAILED(accValue->GetMinimumValue(&accDouble)))
     114                 :         return;
     115               0 :     g_value_init (value, G_TYPE_DOUBLE);
     116               0 :     g_value_set_double (value, accDouble);
     117                 : }
     118                 : 
     119                 : void
     120               0 : getMinimumIncrementCB(AtkValue *obj, GValue *minimumIncrement)
     121                 : {
     122               0 :     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
     123               0 :     if (!accWrap)
     124               0 :         return;
     125                 : 
     126               0 :     nsCOMPtr<nsIAccessibleValue> accValue;
     127                 :     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
     128               0 :                             getter_AddRefs(accValue));
     129               0 :     if (!accValue)
     130                 :         return;
     131                 : 
     132               0 :     memset (minimumIncrement,  0, sizeof (GValue));
     133                 :     double accDouble;
     134               0 :     if (NS_FAILED(accValue->GetMinimumIncrement(&accDouble)))
     135                 :         return;
     136               0 :     g_value_init (minimumIncrement, G_TYPE_DOUBLE);
     137               0 :     g_value_set_double (minimumIncrement, accDouble);
     138                 : }
     139                 : 
     140                 : gboolean
     141               0 : setCurrentValueCB(AtkValue *obj, const GValue *value)
     142                 : {
     143               0 :     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
     144               0 :     if (!accWrap)
     145               0 :         return FALSE;
     146                 : 
     147               0 :     nsCOMPtr<nsIAccessibleValue> accValue;
     148                 :     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
     149               0 :                             getter_AddRefs(accValue));
     150               0 :     NS_ENSURE_TRUE(accValue, FALSE);
     151                 : 
     152               0 :     double accDouble =g_value_get_double (value);
     153               0 :     return !NS_FAILED(accValue->SetCurrentValue(accDouble));
     154                 : }

Generated by: LCOV version 1.7