Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsWidgetSupport.cpp File Reference
#include "nsWidgetSupport.h"
#include "nsRect.h"
#include "nsIButton.h"
#include "nsILabel.h"
#include "nsIWidget.h"
#include "nsICheckButton.h"
#include "nsITextWidget.h"

Go to the source code of this file.

Defines

#define WIDGET_SUPPORT_EXPORT(returnType)   returnType

Functions

static NS_DEFINE_IID (kIWidgetIID, NS_IWIDGET_IID)
 NS_CreateButton (nsISupports *aParent, nsIButton *aButton, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, const nsFont *aFont)
 NS_CreateCheckButton (nsISupports *aParent, nsICheckButton *aCheckButton, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, const nsFont *aFont)
 NS_CreateLabel (nsISupports *aParent, nsILabel *aLabel, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, const nsFont *aFont)
 NS_CreateTextWidget (nsISupports *aParent, nsITextWidget *aWidget, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, const nsFont *aFont)
 NS_ShowWidget (nsISupports *aWidget, PRBool aShow)
 NS_MoveWidget (nsISupports *aWidget, PRUint32 aX, PRUint32 aY)
 NS_EnableWidget (nsISupports *aWidget, PRBool aEnable)
 NS_SetFocusToWidget (nsISupports *aWidget)
 NS_GetWidgetNativeData (nsISupports *aWidget, void **aNativeData)

Define Documentation

#define WIDGET_SUPPORT_EXPORT (   returnType)    returnType

Definition at line 53 of file nsWidgetSupport.cpp.


Function Documentation

NS_CreateButton ( nsISupports *  aParent,
nsIButton aButton,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
const nsFont aFont 
)

Definition at line 57 of file nsWidgetSupport.cpp.

{
       nsIWidget* parent = nsnull;
       if (aParent != nsnull)
    aParent->QueryInterface(kIWidgetIID,(void**)&parent);

  nsIWidget*  widget;
       if (NS_OK == aButton->QueryInterface(kIWidgetIID,(void**)&widget)) {
         widget->Create(parent, aRect, aHandleEventFunction, NULL);
         widget->Show(PR_TRUE);
    if (aFont != nsnull)
              widget->SetFont(*aFont);
              NS_IF_RELEASE(widget);
       }
  
  if (aParent != nsnull)
    NS_IF_RELEASE(parent);
  return NS_OK;
}

Here is the caller graph for this function:

NS_CreateCheckButton ( nsISupports *  aParent,
nsICheckButton aCheckButton,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
const nsFont aFont 
)

Definition at line 82 of file nsWidgetSupport.cpp.

{
       nsIWidget* parent = nsnull;
       if (aParent != nsnull)
    aParent->QueryInterface(kIWidgetIID,(void**)&parent);

       nsIWidget*    widget;
       if (NS_OK == aCheckButton->QueryInterface(kIWidgetIID,(void**)&widget)) {
         widget->Create(parent, aRect, aHandleEventFunction, NULL);
         widget->Show(PR_TRUE);
    if (aFont != nsnull)
              widget->SetFont(*aFont);
              NS_IF_RELEASE(widget);
       }
  if (aParent != nsnull)
    NS_IF_RELEASE(parent);
 return NS_OK;
}

Here is the caller graph for this function:

NS_CreateLabel ( nsISupports *  aParent,
nsILabel aLabel,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
const nsFont aFont 
)

Definition at line 109 of file nsWidgetSupport.cpp.

{
       nsIWidget* parent = nsnull;
       if (NS_OK == aParent->QueryInterface(kIWidgetIID,(void**)&parent))
       {
              nsIWidget*    widget;
              if (NS_OK == aLabel->QueryInterface(kIWidgetIID,(void**)&widget)) {
              widget->Create(parent, aRect, aHandleEventFunction, NULL);
              widget->Show(PR_TRUE);
      if (aFont != nsnull)
                widget->SetFont(*aFont);
                     NS_IF_RELEASE(widget);
              }
              NS_IF_RELEASE(parent);
       }
  return NS_OK;
}

Here is the caller graph for this function:

NS_CreateTextWidget ( nsISupports *  aParent,
nsITextWidget aWidget,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
const nsFont aFont 
)

Definition at line 133 of file nsWidgetSupport.cpp.

{
       nsIWidget* parent = nsnull;
       if (aParent != nsnull)
    aParent->QueryInterface(kIWidgetIID,(void**)&parent);

  nsIWidget*  widget = nsnull;
       if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget)) {
         widget->Create(parent, aRect, aHandleEventFunction, NULL);
         widget->Show(PR_TRUE);
    if (aFont != nsnull)
              widget->SetFont(*aFont);
    NS_IF_RELEASE(widget);
       }
  else
  {
    NS_ERROR("Called QueryInterface on a non kIWidgetIID supported object");
  }

       if (aParent)
         NS_IF_RELEASE(parent);

  return NS_OK;
}

Here is the caller graph for this function:

static NS_DEFINE_IID ( kIWidgetIID  ,
NS_IWIDGET_IID   
) [static]
NS_EnableWidget ( nsISupports *  aWidget,
PRBool  aEnable 
)

Definition at line 190 of file nsWidgetSupport.cpp.

{
       nsIWidget*    widget;
       if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget))
       {
              widget->Enable(aEnable);
              NS_RELEASE(widget);
       }
  return NS_OK;
}

Here is the caller graph for this function:

NS_GetWidgetNativeData ( nsISupports *  aWidget,
void **  aNativeData 
)

Definition at line 215 of file nsWidgetSupport.cpp.

{
       void*                result = nsnull;
       nsIWidget*    widget;
       if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget))
       {
              result = widget->GetNativeData(NS_NATIVE_WIDGET);
              NS_RELEASE(widget);
       }
       *aNativeData = result;
  return NS_OK;

}
NS_MoveWidget ( nsISupports *  aWidget,
PRUint32  aX,
PRUint32  aY 
)

Definition at line 178 of file nsWidgetSupport.cpp.

{

  nsIWidget*  widget = nsnull;
       if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget)) {
         widget->Move(aX,aY);
         NS_IF_RELEASE(widget);
       }
  return NS_OK;
}
NS_SetFocusToWidget ( nsISupports *  aWidget)

Definition at line 203 of file nsWidgetSupport.cpp.

{

  nsIWidget*  widget = nsnull;
       if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget)) {
         widget->SetFocus();
         NS_IF_RELEASE(widget);
       }
  return NS_OK;
}

Here is the caller graph for this function:

NS_ShowWidget ( nsISupports *  aWidget,
PRBool  aShow 
)

Definition at line 165 of file nsWidgetSupport.cpp.

{

  nsIWidget*  widget = nsnull;
       if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget)) {
         widget->Show(aShow);
         NS_IF_RELEASE(widget);
       }

  return NS_OK;
}

Here is the caller graph for this function: