зеркало из https://github.com/mozilla/gecko-dev.git
skel code for xlib based widgets
This commit is contained in:
Родитель
249efebd9d
Коммит
2a07ac3487
|
@ -0,0 +1,70 @@
|
|||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
LIBRARY_NAME = raptorwidgetxlib_s
|
||||
|
||||
MODULE=widget
|
||||
|
||||
REQUIRES=util img xpcom raptor netlib
|
||||
|
||||
DEFINES += -D_IMPL_NS_WIDGET
|
||||
|
||||
INCLUDES+= -I$(srcdir)/../xpwidgets -I$(srcdir)/../xlib -I$(srcdir)/.
|
||||
|
||||
INCLUDES += $(TK_CFLAGS)
|
||||
|
||||
CPPSRCS= nsWidgetFactory.cpp \
|
||||
nsWidget.cpp \
|
||||
nsWindow.cpp \
|
||||
nsButton.cpp \
|
||||
nsCheckButton.cpp \
|
||||
nsComboBox.cpp \
|
||||
nsRadioButton.cpp \
|
||||
nsFileWidget.cpp \
|
||||
nsListBox.cpp \
|
||||
nsScrollBar.cpp \
|
||||
nsTextHelper.cpp \
|
||||
nsTextAreaWidget.cpp \
|
||||
nsTextWidget.cpp \
|
||||
nsTabWidget.cpp \
|
||||
nsTooltipWidget.cpp \
|
||||
nsAppShell.cpp \
|
||||
nsToolkit.cpp \
|
||||
nsLookAndFeel.cpp \
|
||||
nsDialog.cpp \
|
||||
nsLabel.cpp \
|
||||
nsMenuBar.cpp \
|
||||
nsMenu.cpp \
|
||||
nsMenuItem.cpp \
|
||||
nsPopUpMenu.cpp
|
||||
|
||||
TARGETS = $(LIBRARY)
|
||||
|
||||
MKSHLIB :=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include "nsWidget.h"
|
||||
#include "nsAppShell.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsXPComCIID.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsITimer.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
|
||||
|
||||
// this is so that we can get the timers in the base. most widget
|
||||
// toolkits do this through some set of globals. not here though. we
|
||||
// don't have that luxury
|
||||
extern "C" int NS_TimeToNextTimeout(struct timeval *);
|
||||
extern "C" void NS_ProcessTimeouts(void);
|
||||
|
||||
NS_IMPL_ADDREF(nsAppShell)
|
||||
NS_IMPL_RELEASE(nsAppShell)
|
||||
|
||||
nsAppShell::nsAppShell()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mDispatchListener = 0;
|
||||
}
|
||||
|
||||
nsresult nsAppShell::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = NS_NOINTERFACE;
|
||||
|
||||
static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kIAppShellIID)) {
|
||||
*aInstancePtr = (void*) ((nsIAppShell*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD nsAppShell::Create(int* argc, char ** argv)
|
||||
{
|
||||
int num_visuals = 0;
|
||||
XVisualInfo vis_template;
|
||||
// open the display
|
||||
if ((gDisplay = XOpenDisplay(NULL)) == NULL) {
|
||||
fprintf(stderr, "%s: Cannot connect to X server %s\n",
|
||||
argv[0], XDisplayName(NULL));
|
||||
exit(1);
|
||||
}
|
||||
// set the static vars for this class so we can find our
|
||||
// way around...
|
||||
gScreenNum = DefaultScreen(gDisplay);
|
||||
gScreen = DefaultScreenOfDisplay(gDisplay);
|
||||
gVisual = DefaultVisual(gDisplay, gScreenNum);
|
||||
vis_template.visualid = XVisualIDFromVisual(gVisual);
|
||||
gVisualInfo = XGetVisualInfo(gDisplay, VisualIDMask,
|
||||
&vis_template, &num_visuals);
|
||||
if (gVisualInfo == NULL) {
|
||||
printf("nsAppShell::Create(): Warning: Failed to get XVisualInfo\n");
|
||||
}
|
||||
if (num_visuals != 0) {
|
||||
printf("nsAppShell:Create(): Warning: %d XVisualInfo structs were returned.\n", num_visuals);
|
||||
}
|
||||
// get the depth for this display
|
||||
gDepth = DefaultDepth(gDisplay, gScreenNum);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsAppShell::Run()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PLEventQueue *EQueue = nsnull;
|
||||
int xlib_fd = -1;
|
||||
int queue_fd = -1;
|
||||
int max_fd;
|
||||
fd_set select_set;
|
||||
int select_retval;
|
||||
|
||||
// get the event queue service
|
||||
rv = nsServiceManager::GetService(kEventQueueServiceCID,
|
||||
kIEventQueueServiceIID,
|
||||
(nsISupports **) &mEventQueueService);
|
||||
if (NS_OK != rv) {
|
||||
NS_ASSERTION("Could not obtain event queue service", PR_FALSE);
|
||||
return rv;
|
||||
}
|
||||
rv = mEventQueueService->GetThreadEventQueue(PR_GetCurrentThread(), &EQueue);
|
||||
// If a queue already present use it.
|
||||
if (nsnull != EQueue)
|
||||
goto done;
|
||||
|
||||
// Create the event queue for the thread
|
||||
rv = mEventQueueService->CreateThreadEventQueue();
|
||||
if (NS_OK != rv) {
|
||||
NS_ASSERTION("Could not create the thread event queue", PR_FALSE);
|
||||
return rv;
|
||||
}
|
||||
//Get the event queue for the thread
|
||||
rv = mEventQueueService->GetThreadEventQueue(PR_GetCurrentThread(), &EQueue);
|
||||
if (NS_OK != rv) {
|
||||
NS_ASSERTION("Could not obtain the thread event queue", PR_FALSE);
|
||||
return rv;
|
||||
}
|
||||
done:
|
||||
printf("Getting the xlib connection number.\n");
|
||||
xlib_fd = ConnectionNumber(gDisplay);
|
||||
queue_fd = PR_GetEventQueueSelectFD(EQueue);
|
||||
if (xlib_fd >= queue_fd) {
|
||||
max_fd = xlib_fd + 1;
|
||||
} else {
|
||||
max_fd = queue_fd + 1;
|
||||
}
|
||||
// process events.
|
||||
while (1) {
|
||||
XEvent event;
|
||||
struct timeval cur_time;
|
||||
struct timeval *cur_time_ptr;
|
||||
int please_run_timer_queue = 0;
|
||||
gettimeofday(&cur_time, NULL);
|
||||
FD_ZERO(&select_set);
|
||||
// add the queue and the xlib connection to the select set
|
||||
FD_SET(queue_fd, &select_set);
|
||||
FD_SET(xlib_fd, &select_set);
|
||||
if (NS_TimeToNextTimeout(&cur_time) == 0) {
|
||||
cur_time_ptr = NULL;
|
||||
}
|
||||
else {
|
||||
cur_time_ptr = &cur_time;
|
||||
// check to see if something is waiting right now
|
||||
if ((cur_time.tv_sec == 0) && (cur_time.tv_usec == 0)) {
|
||||
please_run_timer_queue = 1;
|
||||
}
|
||||
}
|
||||
// note that we are passing in the timeout_ptr from above.
|
||||
// if there are no timers, this will be null and this will
|
||||
// block until hell freezes over
|
||||
select_retval = select(max_fd, &select_set, NULL, NULL, cur_time_ptr);
|
||||
if (select_retval == -1) {
|
||||
printf("Select returned error.\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (select_retval == 0) {
|
||||
// the select timed out, process the timeout queue.
|
||||
printf("Timer ran out...\n");
|
||||
please_run_timer_queue = 1;
|
||||
}
|
||||
// check to see if there's data avilable for the queue
|
||||
if (FD_ISSET(queue_fd, &select_set)) {
|
||||
printf("queue data available.\n");
|
||||
PR_ProcessPendingEvents(EQueue);
|
||||
}
|
||||
// check to see if there's data avilable for
|
||||
// xlib
|
||||
if (FD_ISSET(xlib_fd, &select_set)) {
|
||||
printf("xlib data available.\n");
|
||||
XNextEvent(gDisplay, &event);
|
||||
}
|
||||
if (please_run_timer_queue) {
|
||||
printf("Running timer queue...\n");
|
||||
NS_ProcessTimeouts();
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsAppShell::EventIsForModalWindow(PRBool aRealEvent, void *aEvent,
|
||||
nsIWidget *aWidget, PRBool *aForWindow)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsAppShell::DispatchNativeEvent(PRBool aRealEvent, void *aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsAppShell::Exit()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAppShell::~nsAppShell()
|
||||
{
|
||||
}
|
||||
|
||||
void* nsAppShell::GetNativeData(PRUint32 aDataType)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsAppShell::GetSelectionMgr(nsISelectionMgr** aSelectionMgr)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsAppShell_h__
|
||||
#define nsAppShell_h__
|
||||
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
|
||||
class nsAppShell : public nsIAppShell
|
||||
{
|
||||
public:
|
||||
nsAppShell();
|
||||
virtual ~nsAppShell();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
PRBool OnPaint();
|
||||
|
||||
// nsIAppShellInterface
|
||||
|
||||
NS_IMETHOD Create(int* argc, char ** argv);
|
||||
virtual nsresult Run();
|
||||
NS_IMETHOD Spinup() { return NS_OK; }
|
||||
NS_IMETHOD Spindown() { return NS_OK; }
|
||||
NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent);
|
||||
NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent);
|
||||
NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent,
|
||||
nsIWidget *aWidget, PRBool *aForWindow);
|
||||
|
||||
NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener);
|
||||
NS_IMETHOD Exit();
|
||||
virtual void * GetNativeData(PRUint32 aDataType);
|
||||
NS_IMETHOD GetSelectionMgr(nsISelectionMgr** aSelectionMgr);
|
||||
|
||||
private:
|
||||
nsDispatchListener* mDispatchListener;
|
||||
nsISelectionMgr *mSelectionMgr;
|
||||
protected:
|
||||
nsIEventQueueService * mEventQueueService;
|
||||
};
|
||||
|
||||
#endif // nsAppShell_h__
|
|
@ -0,0 +1,78 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsButton.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsButton)
|
||||
NS_IMPL_RELEASE(nsButton)
|
||||
|
||||
nsButton::nsButton() : nsWidget() , nsIButton()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsButton::~nsButton()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIButton, NS_IBUTTON_IID);
|
||||
if (aIID.Equals(kIButton)) {
|
||||
*aInstancePtr = (void*) ((nsIButton*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsWidget::QueryInterface(aIID,aInstancePtr);
|
||||
}
|
||||
|
||||
NS_METHOD nsButton::SetLabel (const nsString &aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsButton::GetLabel (nsString &aBuffer)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsButton::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsButton::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsButton::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsButton_h__
|
||||
#define nsButton_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsIButton.h"
|
||||
|
||||
class nsButton : public nsWidget,
|
||||
public nsIButton
|
||||
{
|
||||
public:
|
||||
nsButton();
|
||||
virtual ~nsButton();
|
||||
|
||||
// from nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// from nsIButton
|
||||
NS_IMETHOD SetLabel(const nsString& aText);
|
||||
NS_IMETHOD GetLabel(nsString& aBuffer);
|
||||
|
||||
// nsBaseWidget
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
protected:
|
||||
nsString mLabel;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,88 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsCheckButton.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsCheckButton)
|
||||
NS_IMPL_RELEASE(nsCheckButton)
|
||||
|
||||
nsCheckButton::nsCheckButton() : nsWidget() , nsICheckButton(),
|
||||
mState(PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsCheckButton::~nsCheckButton()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsCheckButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kICheckButtonIID, NS_ICHECKBUTTON_IID);
|
||||
if (aIID.Equals(kICheckButtonIID)) {
|
||||
*aInstancePtr = (void*) ((nsICheckButton*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return nsWidget::QueryInterface(aIID,aInstancePtr);
|
||||
}
|
||||
|
||||
NS_METHOD nsCheckButton::SetState(const PRBool aState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsCheckButton::GetState(PRBool& aState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsCheckButton::SetLabel(const nsString& aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsCheckButton::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsCheckButton::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsCheckButton::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsCheckButton::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsCheckButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsCheckButton_h__
|
||||
#define nsCheckButton_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
|
||||
#include "nsICheckButton.h"
|
||||
|
||||
class nsCheckButton : public nsWidget,
|
||||
public nsICheckButton
|
||||
{
|
||||
|
||||
public:
|
||||
nsCheckButton();
|
||||
virtual ~nsCheckButton();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsICheckButton part
|
||||
NS_IMETHOD SetLabel(const nsString &aText);
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer);
|
||||
NS_IMETHOD SetState(const PRBool aState);
|
||||
NS_IMETHOD GetState(PRBool& aState);
|
||||
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
|
||||
protected:
|
||||
PRBool mState;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsCheckButton_h__
|
|
@ -0,0 +1,131 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsComboBox.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsComboBox)
|
||||
NS_IMPL_RELEASE(nsComboBox)
|
||||
|
||||
nsComboBox::nsComboBox() : nsWidget(), nsIListWidget(), nsIComboBox()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_METHOD nsComboBox::AddItemAt(nsString &aItem, PRInt32 aPosition)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 nsComboBox::FindItem(nsString &aItem, PRInt32 aStartPos)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRInt32 nsComboBox::GetItemCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRBool nsComboBox::RemoveItemAt(PRInt32 aPosition)
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool nsComboBox::GetItemAt(nsString& anItem, PRInt32 aPosition)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsComboBox::GetSelectedItem(nsString& aItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 nsComboBox::GetSelectedIndex()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_METHOD nsComboBox::SelectItem(PRInt32 aPosition)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsComboBox::Deselect()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsComboBox::~nsComboBox()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsComboBox::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
static NS_DEFINE_IID(kInsComboBoxIID, NS_ICOMBOBOX_IID);
|
||||
static NS_DEFINE_IID(kInsListWidgetIID, NS_ILISTWIDGET_IID);
|
||||
|
||||
if (aIID.Equals(kInsComboBoxIID)) {
|
||||
*aInstancePtr = (void*) ((nsIComboBox*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(kInsListWidgetIID)) {
|
||||
*aInstancePtr = (void*) ((nsIListWidget*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsWidget::QueryInterface(aIID,aInstancePtr);
|
||||
}
|
||||
|
||||
PRBool nsComboBox::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsComboBox::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsComboBox::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsComboBox::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 nsComboBox::GetHeight(PRInt32 aProposedHeight)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_METHOD nsComboBox::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsComboBox::Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsComboBox_h__
|
||||
#define nsComboBox_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsIComboBox.h"
|
||||
|
||||
class nsComboBox : public nsWidget,
|
||||
public nsIListWidget,
|
||||
public nsIComboBox
|
||||
{
|
||||
|
||||
public:
|
||||
nsComboBox();
|
||||
~nsComboBox();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsIWidget overrides
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
// nsIWidget
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
|
||||
// nsIComboBox interface
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition);
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos);
|
||||
virtual PRInt32 GetItemCount();
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition);
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition);
|
||||
NS_IMETHOD GetSelectedItem(nsString& aItem);
|
||||
virtual PRInt32 GetSelectedIndex();
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition);
|
||||
NS_IMETHOD Deselect() ;
|
||||
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
|
||||
protected:
|
||||
|
||||
PRInt32 GetHeight(PRInt32 aProposedHeight);
|
||||
PRInt32 mDropDownHeight;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsComboBox_h__
|
|
@ -0,0 +1,86 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsDialog.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsDialog)
|
||||
NS_IMPL_RELEASE(nsDialog)
|
||||
|
||||
nsDialog::nsDialog() : nsWidget(), nsIDialog()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_METHOD nsDialog::Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsDialog::~nsDialog()
|
||||
{
|
||||
}
|
||||
|
||||
NS_METHOD nsDialog::SetLabel(const nsString& aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDialog::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsDialog::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kInsDialogIID, NS_IDIALOG_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kInsDialogIID)) {
|
||||
*aInstancePtr = (void*) ((nsIDialog*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool nsDialog::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsDialog::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsDialog::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsDialog::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsDialog_h__
|
||||
#define nsDialog_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsIDialog.h"
|
||||
|
||||
class nsDialog : public nsWidget,
|
||||
public nsIDialog
|
||||
{
|
||||
|
||||
public:
|
||||
nsDialog();
|
||||
virtual ~nsDialog();
|
||||
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsIDialog part
|
||||
NS_IMETHOD SetLabel(const nsString& aText);
|
||||
NS_IMETHOD GetLabel(nsString& aBuffer);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // nsDialog_h__
|
|
@ -0,0 +1,114 @@
|
|||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsFileWidget.h"
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsFileWidget)
|
||||
NS_IMPL_RELEASE(nsFileWidget)
|
||||
|
||||
nsFileWidget::nsFileWidget() : nsIFileWidget()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
PRBool nsFileWidget::Show()
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult nsFileWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr) {
|
||||
nsresult result = NS_NOINTERFACE;
|
||||
|
||||
static NS_DEFINE_IID(kIFileWidgetIID, NS_IFILEWIDGET_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kIFileWidgetIID)) {
|
||||
*aInstancePtr = (void*) ((nsIFileWidget*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
NS_METHOD nsFileWidget::SetFilterList(PRUint32 aNumberOfFilters,const nsString aTitles[],const nsString aFilters[])
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::GetFile(nsString& aFile)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::GetFile(nsFileSpec& aFile)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::GetFile(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
nsFileSpec & theFileSpec)
|
||||
{
|
||||
return nsFileDlgResults_OK;
|
||||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::GetFolder(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
nsFileSpec & theFileSpec)
|
||||
{
|
||||
return nsFileDlgResults_OK;
|
||||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::PutFile(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
nsFileSpec & theFileSpec)
|
||||
{
|
||||
return nsFileDlgResults_OK;
|
||||
|
||||
}
|
||||
NS_METHOD nsFileWidget::SetDefaultString(nsString& aString)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::SetDisplayDirectory(nsString& aDirectory)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::GetDisplayDirectory(nsString& aDirectory)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::Create(nsIWidget *aParent,
|
||||
nsString& aTitle,
|
||||
nsMode aMode,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
void *aInitData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsFileWidget::~nsFileWidget()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsFileWidget_h__
|
||||
#define nsFileWidget_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsIFileWidget.h"
|
||||
|
||||
/**
|
||||
* Native Win32 FileSelector wrapper
|
||||
*/
|
||||
|
||||
class nsFileWidget : public nsIFileWidget
|
||||
{
|
||||
public:
|
||||
nsFileWidget();
|
||||
virtual ~nsFileWidget();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
PRBool OnPaint();
|
||||
|
||||
// nsIWidget interface
|
||||
|
||||
NS_IMETHOD Create( nsIWidget *aParent,
|
||||
nsString& aTitle,
|
||||
nsMode aMode,
|
||||
nsIDeviceContext *aContext = nsnull,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
void *aInitData = nsnull);
|
||||
|
||||
// nsIFileWidget part
|
||||
virtual PRBool Show();
|
||||
NS_IMETHOD GetFile(nsString& aFile);
|
||||
NS_IMETHOD GetFile(nsFileSpec& aFile);
|
||||
nsFileDlgResults GetFile(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
nsFileSpec & theFileSpec);
|
||||
nsFileDlgResults GetFolder(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
nsFileSpec & theFileSpec);
|
||||
nsFileDlgResults PutFile(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
nsFileSpec & theFileSpec);
|
||||
NS_IMETHOD SetDefaultString(nsString& aFile);
|
||||
NS_IMETHOD SetFilterList(PRUint32 aNumberOfFilters,const nsString aTitles[],const nsString aFilters[]);
|
||||
NS_IMETHOD GetDisplayDirectory(nsString& aDirectory);
|
||||
NS_IMETHOD SetDisplayDirectory(nsString& aDirectory);
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif // nsFileWidget_h__
|
|
@ -0,0 +1,95 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsLabel.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsLabel)
|
||||
NS_IMPL_RELEASE(nsLabel)
|
||||
|
||||
nsLabel::nsLabel() : nsWidget(), nsILabel()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_METHOD nsLabel::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsLabel::~nsLabel()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsLabel::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kILabelIID, NS_ILABEL_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kILabelIID)) {
|
||||
*aInstancePtr = (void*) ((nsILabel*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_METHOD nsLabel::SetAlignment(nsLabelAlignment aAlignment)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsLabel::SetLabel(const nsString& aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsLabel::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsLabel::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsLabel::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsLabel::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsLabel::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsLabel::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsLabel::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsLabel_h__
|
||||
#define nsLabel_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsILabel.h"
|
||||
|
||||
/**
|
||||
* Native Win32 Label wrapper
|
||||
*/
|
||||
|
||||
class nsLabel : public nsWidget,
|
||||
public nsILabel
|
||||
{
|
||||
|
||||
public:
|
||||
nsLabel();
|
||||
virtual ~nsLabel();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsILabel part
|
||||
NS_IMETHOD SetLabel(const nsString &aText);
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer);
|
||||
NS_IMETHOD SetAlignment(nsLabelAlignment aAlignment);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
|
||||
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // nsLabel_h__
|
|
@ -0,0 +1,148 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsListBox.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsListBox)
|
||||
NS_IMPL_RELEASE(nsListBox)
|
||||
|
||||
NS_METHOD nsListBox::SetMultipleSelection(PRBool aMultipleSelections)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsListBox::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsListBox::AddItemAt(nsString &aItem, PRInt32 aPosition)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 nsListBox::FindItem(nsString &aItem, PRInt32 aStartPos)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRInt32 nsListBox::GetItemCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRBool nsListBox::RemoveItemAt(PRInt32 aPosition)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsListBox::GetItemAt(nsString& anItem, PRInt32 aPosition)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsListBox::GetSelectedItem(nsString& aItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 nsListBox::GetSelectedIndex()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_METHOD nsListBox::SelectItem(PRInt32 aPosition)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 nsListBox::GetSelectedCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_METHOD nsListBox::GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsListBox::SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsListBox::Deselect()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsListBox::nsListBox() : nsWidget(), nsIListWidget(), nsIListBox()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsListBox::~nsListBox()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
nsresult nsListBox::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kInsListBoxIID, NS_ILISTBOX_IID);
|
||||
static NS_DEFINE_IID(kInsListWidgetIID, NS_ILISTWIDGET_IID);
|
||||
if (result == NS_NOINTERFACE) {
|
||||
if (aIID.Equals(kInsListBoxIID)) {
|
||||
*aInstancePtr = (void*) ((nsIListBox*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(kInsListWidgetIID)) {
|
||||
*aInstancePtr = (void*) ((nsIListWidget*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool nsListBox::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsListBox::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsListBox::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsListBox::AutoErase()
|
||||
{
|
||||
return(PR_TRUE);
|
||||
}
|
||||
|
||||
NS_METHOD nsListBox::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsListBox_h__
|
||||
#define nsListBox_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsIListBox.h"
|
||||
|
||||
/**
|
||||
* Native Win32 Listbox wrapper
|
||||
*/
|
||||
|
||||
class nsListBox : public nsWidget,
|
||||
public nsIListWidget,
|
||||
public nsIListBox
|
||||
{
|
||||
|
||||
public:
|
||||
nsListBox();
|
||||
virtual ~nsListBox();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
|
||||
|
||||
// nsIListBox interface
|
||||
NS_IMETHOD SetMultipleSelection(PRBool aMultipleSelections);
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition);
|
||||
PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos);
|
||||
PRInt32 GetItemCount();
|
||||
PRBool RemoveItemAt(PRInt32 aPosition);
|
||||
PRBool GetItemAt(nsString& anItem, PRInt32 aPosition);
|
||||
NS_IMETHOD GetSelectedItem(nsString& aItem);
|
||||
PRInt32 GetSelectedIndex();
|
||||
PRInt32 GetSelectedCount();
|
||||
NS_IMETHOD GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize);
|
||||
NS_IMETHOD SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize);
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition);
|
||||
NS_IMETHOD Deselect() ;
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
|
||||
// nsWindow interface
|
||||
virtual PRBool AutoErase();
|
||||
protected:
|
||||
PRBool mMultiSelect;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsListBox_h__
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsLookAndFeel.h"
|
||||
|
||||
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsLookAndFeel, kILookAndFeelIID)
|
||||
|
||||
nsLookAndFeel::nsLookAndFeel() : nsILookAndFeel()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsLookAndFeel::~nsLookAndFeel()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricFloatID aID, float & aMetric)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __nsLookAndFeel
|
||||
#define __nsLookAndFeel
|
||||
|
||||
#include "nsILookAndFeel.h"
|
||||
|
||||
class nsLookAndFeel: public nsILookAndFeel {
|
||||
public:
|
||||
nsLookAndFeel();
|
||||
virtual ~nsLookAndFeel();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor);
|
||||
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric);
|
||||
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,180 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsMenu.h"
|
||||
#include "nsIMenu.h"
|
||||
#include "nsIMenuItem.h"
|
||||
#include "nsIMenuListener.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIMenuIID, NS_IMENU_IID);
|
||||
static NS_DEFINE_IID(kIMenuItemIID, NS_IMENUITEM_IID);
|
||||
|
||||
nsresult nsMenu::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if (aIID.Equals(kIMenuIID)) {
|
||||
*aInstancePtr = (void*)(nsIMenu*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIMenuListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIMenuListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIMenu*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsMenu)
|
||||
NS_IMPL_RELEASE(nsMenu)
|
||||
|
||||
nsMenu::nsMenu() : nsIMenu()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mMenuBarParent = nsnull;
|
||||
mMenuParent = nsnull;
|
||||
mListener = nsnull;
|
||||
// nsresult result = NS_NewISupportsArray(&mItems);
|
||||
}
|
||||
|
||||
nsMenu::~nsMenu()
|
||||
{
|
||||
// NS_IF_RELEASE(mMenuBarParent);
|
||||
NS_IF_RELEASE(mMenuParent);
|
||||
NS_IF_RELEASE(mListener);
|
||||
|
||||
// Remove all references to the items
|
||||
mItems->Clear();
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::Create(nsISupports *aParent, const nsString &aLabel)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::GetParent(nsISupports*& aParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::GetLabel(nsString &aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::SetLabel(const nsString &aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::AddItem(nsISupports * aItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIMenuBar * nsMenu::GetMenuBar(nsIMenu * aMenu)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIWidget * nsMenu::GetParentWidget()
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::AddMenuItem(nsIMenuItem * aMenuItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::AddMenu(nsIMenu * aMenu)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::AddSeparator()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::GetItemCount(PRUint32 &aCount)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::GetItemAt(const PRUint32 aCount, nsISupports *& aMenuItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::InsertItemAt(const PRUint32 aCount, nsISupports * aMenuItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::InsertSeparator(const PRUint32 aCount)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::RemoveItem(const PRUint32 aCount)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::RemoveAll()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::GetNativeData(void ** aData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::AddMenuListener(nsIMenuListener * aMenuListener)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::RemoveMenuListener(nsIMenuListener * aMenuListener)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenu::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsMenu_h__
|
||||
#define nsMenu_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsIMenu.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
class nsIMenuListener;
|
||||
|
||||
/**
|
||||
* Native Win32 button wrapper
|
||||
*/
|
||||
|
||||
class nsMenu : public nsIMenu, public nsIMenuListener
|
||||
{
|
||||
|
||||
public:
|
||||
nsMenu();
|
||||
virtual ~nsMenu();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
//nsIMenuListener interface
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsString &aLabel);
|
||||
|
||||
|
||||
// nsIMenu Methods
|
||||
NS_IMETHOD GetParent(nsISupports *&aParent);
|
||||
NS_IMETHOD GetLabel(nsString &aText);
|
||||
NS_IMETHOD SetLabel(const nsString &aText);
|
||||
|
||||
NS_IMETHOD AddItem(nsISupports * aItem);
|
||||
|
||||
NS_IMETHOD AddSeparator();
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount);
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aPos, nsISupports *& aMenuItem);
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aPos, nsISupports * aMenuItem);
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aPos);
|
||||
NS_IMETHOD RemoveAll();
|
||||
NS_IMETHOD GetNativeData(void** aData);
|
||||
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener);
|
||||
|
||||
//
|
||||
NS_IMETHOD AddMenuItem(nsIMenuItem * aMenuItem);
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu);
|
||||
NS_IMETHOD InsertSeparator(const PRUint32 aCount);
|
||||
|
||||
// Native Impl Methods
|
||||
// These are not ref counted
|
||||
nsIMenu * GetMenuParent() { return mMenuParent; }
|
||||
nsIMenuBar * GetMenuBarParent() { return mMenuBarParent; }
|
||||
|
||||
protected:
|
||||
nsIMenuBar * GetMenuBar(nsIMenu * aMenu);
|
||||
nsIWidget * GetParentWidget();
|
||||
|
||||
nsString mLabel;
|
||||
|
||||
nsIMenuBar * mMenuBarParent;
|
||||
nsIMenu * mMenuParent;
|
||||
|
||||
nsISupportsArray * mItems;
|
||||
nsIMenuListener * mListener;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsMenu_h__
|
|
@ -0,0 +1,130 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsMenuBar.h"
|
||||
|
||||
static NS_DEFINE_IID(kIMenuBarIID, NS_IMENUBAR_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
nsresult nsMenuBar::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if (aIID.Equals(kIMenuBarIID)) {
|
||||
*aInstancePtr = (void*) ((nsIMenuBar*) this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)(nsIMenuBar*) this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIMenuListenerIID)) {
|
||||
*aInstancePtr = (void*) ((nsIMenuListener*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsMenuBar)
|
||||
NS_IMPL_RELEASE(nsMenuBar)
|
||||
|
||||
nsEventStatus nsMenuBar::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuBar::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsMenuBar::nsMenuBar() : nsIMenuBar(), nsIMenuListener()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsMenuBar::~nsMenuBar()
|
||||
{
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::Create(nsIWidget *aParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::GetParent(nsIWidget *&aParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::SetParent(nsIWidget *aParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::AddMenu(nsIMenu * aMenu)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::GetMenuCount(PRUint32 &aCount)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::InsertMenuAt(const PRUint32 aPos, nsIMenu *& aMenu)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::RemoveMenu(const PRUint32 aPos)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::RemoveAll()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::GetNativeData(void *& aData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::SetNativeData(void * aData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::Paint()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuBar::GetMenuAt(const PRUint32 aPos, nsIMenu *& aMenu)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsMenuBar_h__
|
||||
#define nsMenuBar_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsIMenuBar.h"
|
||||
#include "nsIMenuListener.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsIWidget;
|
||||
|
||||
class nsMenuBar : public nsIMenuBar, public nsIMenuListener
|
||||
{
|
||||
|
||||
public:
|
||||
nsMenuBar();
|
||||
virtual ~nsMenuBar();
|
||||
|
||||
// nsIMenuListener interface
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
NS_IMETHOD Create(nsIWidget * aParent);
|
||||
|
||||
// nsIMenuBar Methods
|
||||
NS_IMETHOD GetParent(nsIWidget *&aParent);
|
||||
NS_IMETHOD SetParent(nsIWidget * aParent);
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu);
|
||||
NS_IMETHOD GetMenuCount(PRUint32 &aCount);
|
||||
NS_IMETHOD GetMenuAt(const PRUint32 aPos, nsIMenu *& aMenu);
|
||||
NS_IMETHOD InsertMenuAt(const PRUint32 aPos, nsIMenu *& aMenu);
|
||||
NS_IMETHOD RemoveMenu(const PRUint32 aPos);
|
||||
NS_IMETHOD RemoveAll();
|
||||
NS_IMETHOD GetNativeData(void*& aData);
|
||||
NS_IMETHOD Paint();
|
||||
NS_IMETHOD SetNativeData(void* aData);
|
||||
|
||||
};
|
||||
|
||||
#endif // nsMenuBar_h__
|
|
@ -0,0 +1,171 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsMenuItem.h"
|
||||
#include "nsIMenu.h"
|
||||
#include "nsIMenuBar.h"
|
||||
#include "nsIPopUpMenu.h"
|
||||
|
||||
static NS_DEFINE_IID(kIMenuIID, NS_IMENU_IID);
|
||||
static NS_DEFINE_IID(kIMenuBarIID, NS_IMENUBAR_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIPopUpMenuIID, NS_IPOPUPMENU_IID);
|
||||
static NS_DEFINE_IID(kIMenuItemIID, NS_IMENUITEM_IID);
|
||||
|
||||
nsresult nsMenuItem::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if (aIID.Equals(kIMenuItemIID)) {
|
||||
*aInstancePtr = (void*)(nsIMenuItem*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIMenuListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIMenuListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIMenuItem*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsMenuItem)
|
||||
NS_IMPL_RELEASE(nsMenuItem)
|
||||
|
||||
nsMenuItem::nsMenuItem() : nsIMenuItem()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsMenuItem::~nsMenuItem()
|
||||
{
|
||||
}
|
||||
|
||||
nsIWidget * nsMenuItem::GetMenuBarParent(nsISupports * aParent)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::Create(nsIMenu * aParent, const nsString &aLabel, PRUint32 aCommand)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::Create(nsIPopUpMenu * aParent, const nsString &aLabel, PRUint32 aCommand)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::Create(nsIMenu * aParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::Create(nsIPopUpMenu * aParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::GetLabel(nsString &aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::SetLabel(nsString &aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::GetCommand(PRUint32 & aCommand)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::GetTarget(nsIWidget *& aTarget)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::GetNativeData(void *& aData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::AddMenuListener(nsIMenuListener * aMenuListener)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::RemoveMenuListener(nsIMenuListener * aMenuListener)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsMenuItem::SetCmdId(PRInt32 aId)
|
||||
{
|
||||
}
|
||||
|
||||
PRInt32 nsMenuItem::GetCmdId()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::IsSeparator(PRBool & aIsSep)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::SetEnabled(PRBool aIsEnabled)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::GetEnabled(PRBool *aIsEnabled)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::SetChecked(PRBool aIsEnabled)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::GetChecked(PRBool *aIsEnabled)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuItem::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuItem::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsMenuItem_h__
|
||||
#define nsMenuItem_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIMenuItem.h"
|
||||
#include "nsIMenuListener.h"
|
||||
|
||||
class nsIMenu;
|
||||
class nsIPopUpMenu;
|
||||
class nsIMenuListener;
|
||||
|
||||
/**
|
||||
* Native Win32 MenuItem wrapper
|
||||
*/
|
||||
|
||||
class nsMenuItem : public nsIMenuItem, public nsIMenuListener
|
||||
{
|
||||
|
||||
public:
|
||||
nsMenuItem();
|
||||
virtual ~nsMenuItem();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Create(nsIMenu * aParent, const nsString &aLabel, PRUint32 aCommand);
|
||||
NS_IMETHOD Create(nsIPopUpMenu * aParent, const nsString &aLabel, PRUint32 aCommand);
|
||||
NS_IMETHOD Create(nsIMenu * aParent);
|
||||
NS_IMETHOD Create(nsIPopUpMenu * aParent);
|
||||
|
||||
// nsIMenuBar Methods
|
||||
NS_IMETHOD GetLabel(nsString &aText);
|
||||
NS_IMETHOD SetLabel(nsString &aText);
|
||||
NS_IMETHOD SetEnabled(PRBool aIsEnabled);
|
||||
NS_IMETHOD GetEnabled(PRBool *aIsEnabled);
|
||||
NS_IMETHOD SetChecked(PRBool aIsEnabled);
|
||||
NS_IMETHOD GetChecked(PRBool *aIsEnabled);
|
||||
NS_IMETHOD GetCommand(PRUint32 & aCommand);
|
||||
NS_IMETHOD GetTarget(nsIWidget *& aTarget);
|
||||
NS_IMETHOD GetNativeData(void*& aData);
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD IsSeparator(PRBool & aIsSep);
|
||||
|
||||
// nsIMenuListener interface
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
// Need for Native Impl
|
||||
void SetCmdId(PRInt32 aId);
|
||||
PRInt32 GetCmdId();
|
||||
|
||||
protected:
|
||||
nsIWidget * GetMenuBarParent(nsISupports * aParent);
|
||||
|
||||
nsString mLabel;
|
||||
PRUint32 mCommand;
|
||||
nsIWidget * mTarget;
|
||||
nsIMenu * mMenu;
|
||||
nsIMenuListener * mListener;
|
||||
PRInt32 mCmdId;
|
||||
PRBool mIsSeparator;
|
||||
};
|
||||
|
||||
#endif // nsMenuItem_h__
|
|
@ -0,0 +1,105 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#include "nsPopUpMenu.h"
|
||||
|
||||
static NS_DEFINE_IID(kPopUpMenuIID, NS_IPOPUPMENU_IID);
|
||||
NS_IMPL_ISUPPORTS(nsPopUpMenu, kPopUpMenuIID)
|
||||
|
||||
nsPopUpMenu::nsPopUpMenu() : nsIPopUpMenu()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsPopUpMenu::~nsPopUpMenu()
|
||||
{
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::Create(nsIWidget *aParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::AddItem(const nsString &aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::AddItem(nsIMenuItem * aMenuItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::AddMenu(nsIMenu * aMenu)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::AddSeparator()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::GetItemCount(PRUint32 &aCount)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::GetItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::InsertItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::InsertItemAt(const PRUint32 aCount, const nsString & aMenuItemName)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::InsertSeparator(const PRUint32 aCount)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::RemoveItem(const PRUint32 aCount)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::RemoveAll()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::ShowMenu(PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::GetNativeData(void *& aData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPopUpMenu::GetParent(nsIWidget *& aParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsPopUpMenu_h__
|
||||
#define nsPopUpMenu_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsIPopUpMenu.h"
|
||||
|
||||
class nsPopUpMenu : public nsIPopUpMenu
|
||||
{
|
||||
|
||||
public:
|
||||
nsPopUpMenu();
|
||||
virtual ~nsPopUpMenu();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Create(nsIWidget * aParent);
|
||||
|
||||
// nsIPopUpMenu Methods
|
||||
NS_IMETHOD AddItem(const nsString &aText);
|
||||
NS_IMETHOD AddItem(nsIMenuItem * aMenuItem);
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu);
|
||||
NS_IMETHOD AddSeparator();
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount);
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem);
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem);
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aCount, const nsString & aMenuItemName);
|
||||
NS_IMETHOD InsertSeparator(const PRUint32 aCount);
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aCount);
|
||||
NS_IMETHOD RemoveAll();
|
||||
NS_IMETHOD ShowMenu(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD GetNativeData(void*& aData);
|
||||
NS_IMETHOD GetParent(nsIWidget*& aParent);
|
||||
|
||||
};
|
||||
|
||||
#endif // nsPopUpMenu_h__
|
|
@ -0,0 +1,85 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsRadioButton.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsRadioButton)
|
||||
NS_IMPL_RELEASE(nsRadioButton)
|
||||
|
||||
nsRadioButton::nsRadioButton() : nsWidget(), nsIRadioButton()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsRadioButton::~nsRadioButton()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsRadioButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kIRadioButtonIID, NS_IRADIOBUTTON_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kIRadioButtonIID)) {
|
||||
*aInstancePtr = (void*) ((nsIRadioButton*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_METHOD nsRadioButton::SetState(const PRBool aState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsRadioButton::GetState(PRBool& aState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsRadioButton::SetLabel(const nsString& aText)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsRadioButton::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsRadioButton::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsRadioButton::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsRadioButton::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsRadioButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsRadioButton_h__
|
||||
#define nsRadioButton_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsIRadioButton.h"
|
||||
|
||||
|
||||
/**
|
||||
* Native Win32 Radio button wrapper
|
||||
*/
|
||||
|
||||
class nsRadioButton : public nsWidget,
|
||||
public nsIRadioButton
|
||||
{
|
||||
|
||||
public:
|
||||
nsRadioButton();
|
||||
virtual ~nsRadioButton();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsIRadioButton part
|
||||
NS_IMETHOD SetLabel(const nsString& aText);
|
||||
NS_IMETHOD GetLabel(nsString& aBuffer);
|
||||
NS_IMETHOD SetState(const PRBool aState);
|
||||
NS_IMETHOD GetState(PRBool& aState);
|
||||
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif // nsRadioButton_h__
|
|
@ -0,0 +1,114 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsScrollBar.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsScrollbar)
|
||||
NS_IMPL_RELEASE(nsScrollbar)
|
||||
|
||||
nsScrollbar::nsScrollbar(PRBool aIsVertical) : nsWidget(), nsIScrollbar()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
};
|
||||
|
||||
nsScrollbar::~nsScrollbar()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsScrollbar::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kInsScrollbarIID, NS_ISCROLLBAR_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kInsScrollbarIID)) {
|
||||
*aInstancePtr = (void*) ((nsIScrollbar*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_METHOD nsScrollbar::SetMaxRange(PRUint32 aEndRange)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32 nsScrollbar::GetMaxRange(PRUint32& aRange)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_METHOD nsScrollbar::SetPosition(PRUint32 aPos)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32 nsScrollbar::GetPosition(PRUint32& aPosition)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_METHOD nsScrollbar::SetThumbSize(PRUint32 aSize)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsScrollbar::GetThumbSize(PRUint32& aSize)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsScrollbar::SetLineIncrement(PRUint32 aSize)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsScrollbar::GetLineIncrement(PRUint32& aSize)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsScrollbar::SetParameters(PRUint32 aMaxRange, PRUint32 aThumbSize,
|
||||
PRUint32 aPosition, PRUint32 aLineIncrement)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsScrollbar::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PRBool nsScrollbar::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PRBool nsScrollbar::OnScroll(PRUint32 scrollCode, int cPos)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsScrollbar::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsScrollbar_h__
|
||||
#define nsScrollbar_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsIScrollbar.h"
|
||||
|
||||
class nsScrollbar : public nsWidget,
|
||||
public nsIScrollbar
|
||||
{
|
||||
|
||||
public:
|
||||
nsScrollbar(PRBool aIsVertical);
|
||||
virtual ~nsScrollbar();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsIScrollBar implementation
|
||||
NS_IMETHOD SetMaxRange(PRUint32 aEndRange);
|
||||
NS_IMETHOD GetMaxRange(PRUint32& aMaxRange);
|
||||
NS_IMETHOD SetPosition(PRUint32 aPos);
|
||||
NS_IMETHOD GetPosition(PRUint32& aPos);
|
||||
NS_IMETHOD SetThumbSize(PRUint32 aSize);
|
||||
NS_IMETHOD GetThumbSize(PRUint32& aSize);
|
||||
NS_IMETHOD SetLineIncrement(PRUint32 aSize);
|
||||
NS_IMETHOD GetLineIncrement(PRUint32& aSize);
|
||||
NS_IMETHOD SetParameters(PRUint32 aMaxRange, PRUint32 aThumbSize,
|
||||
PRUint32 aPosition, PRUint32 aLineIncrement);
|
||||
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnScroll(PRUint32 scrollCode, int cPos);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
|
||||
};
|
||||
|
||||
#endif // nsButton_h__
|
|
@ -0,0 +1,72 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsTabWidget.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsTabWidget)
|
||||
NS_IMPL_RELEASE(nsTabWidget)
|
||||
|
||||
nsTabWidget::nsTabWidget() : nsWidget()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsTabWidget::~nsTabWidget()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsTabWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kInsTabWidgetIID, NS_ITABWIDGET_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kInsTabWidgetIID)) {
|
||||
*aInstancePtr = (void*) ((nsITabWidget*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_METHOD nsTabWidget::SetTabs(PRUint32 aNumberOfTabs, const nsString aTabLabels[])
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32 nsTabWidget::GetSelectedTab(PRUint32& aTabNumber)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRBool nsTabWidget::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsTabWidget::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsTabWidget::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsTabWidget_h__
|
||||
#define nsTabWidget_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsITabWidget.h"
|
||||
|
||||
class nsTabWidget : public nsWidget,
|
||||
public nsITabWidget
|
||||
{
|
||||
|
||||
public:
|
||||
nsTabWidget();
|
||||
virtual ~nsTabWidget();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
|
||||
// nsITabWidget part
|
||||
NS_IMETHOD SetTabs(PRUint32 aNumberOfTabs, const nsString aTabLabels[]);
|
||||
NS_IMETHOD GetSelectedTab(PRUint32& aTabNumber);
|
||||
|
||||
// nsIWidget overrides
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
|
||||
};
|
||||
|
||||
#endif // nsTabWidget_h__
|
|
@ -0,0 +1,78 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsTextAreaWidget.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsTextAreaWidget)
|
||||
NS_IMPL_RELEASE(nsTextAreaWidget)
|
||||
|
||||
nsTextAreaWidget::nsTextAreaWidget()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsTextAreaWidget::~nsTextAreaWidget()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsTextAreaWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
static NS_DEFINE_IID(kITextAreaWidgetIID, NS_ITEXTAREAWIDGET_IID);
|
||||
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
|
||||
|
||||
if (aIID.Equals(kITextAreaWidgetIID)) {
|
||||
nsITextAreaWidget* textArea = this;
|
||||
*aInstancePtr = (void*) (textArea);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(kIWidgetIID)) {
|
||||
nsIWidget* widget = this;
|
||||
*aInstancePtr = (void*) (widget);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
PRBool nsTextAreaWidget::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsTextAreaWidget::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsTextAreaWidget::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextAreaWidget::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextAreaWidget::Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsTextAreaWidget_h__
|
||||
#define nsTextAreaWidget_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsTextHelper.h"
|
||||
|
||||
#include "nsITextAreaWidget.h"
|
||||
|
||||
/**
|
||||
* Native WIN32 multi-line edit control wrapper.
|
||||
*/
|
||||
|
||||
class nsTextAreaWidget : public nsTextHelper
|
||||
{
|
||||
|
||||
public:
|
||||
nsTextAreaWidget();
|
||||
virtual ~nsTextAreaWidget();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsIWidget Overrides
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif // nsTextAreaWidget_h__
|
|
@ -0,0 +1,97 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsTextHelper.h"
|
||||
|
||||
NS_METHOD nsTextHelper::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::SetMaxTextLength(PRUint32 aChars)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::GetText(nsString& aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::SetText(const nsString &aText, PRUint32& aActualSize)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::RemoveText()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::SetPassword(PRBool aIsPassword)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::SetReadOnly(PRBool aReadOnlyFlag, PRBool& aOldFlag)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::SelectAll()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::SetSelection(PRUint32 aStartSel, PRUint32 aEndSel)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::SetCaretPosition(PRUint32 aPosition)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextHelper::GetCaretPosition(PRUint32& aPos)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTextHelper::nsTextHelper() : nsWidget(), nsITextAreaWidget(), nsITextWidget()
|
||||
{
|
||||
}
|
||||
|
||||
nsTextHelper::~nsTextHelper()
|
||||
{
|
||||
}
|
||||
|
||||
PRBool nsTextHelper::AutoErase()
|
||||
{
|
||||
return(PR_TRUE);
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef nsTextHelper_h__
|
||||
#define nsTextHelper_h__
|
||||
|
||||
#include "nsITextWidget.h"
|
||||
#include "nsITextAreaWidget.h"
|
||||
#include "nsWidget.h"
|
||||
|
||||
/**
|
||||
* Base class for nsTextAreaWidget and nsTextWidget
|
||||
*/
|
||||
|
||||
class nsTextHelper : public nsWidget,
|
||||
public nsITextAreaWidget,
|
||||
public nsITextWidget
|
||||
{
|
||||
|
||||
public:
|
||||
nsTextHelper();
|
||||
virtual ~nsTextHelper();
|
||||
|
||||
NS_IMETHOD SelectAll();
|
||||
NS_IMETHOD SetMaxTextLength(PRUint32 aChars);
|
||||
NS_IMETHOD GetText(nsString& aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize);
|
||||
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize);
|
||||
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize);
|
||||
NS_IMETHOD RemoveText();
|
||||
NS_IMETHOD SetPassword(PRBool aIsPassword);
|
||||
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag);
|
||||
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel);
|
||||
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel);
|
||||
NS_IMETHOD SetCaretPosition(PRUint32 aPosition);
|
||||
NS_IMETHOD GetCaretPosition(PRUint32& aPosition);
|
||||
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
|
||||
virtual PRBool AutoErase();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // nsTextHelper_h__
|
|
@ -0,0 +1,72 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsTextWidget.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsTextWidget)
|
||||
NS_IMPL_RELEASE(nsTextWidget)
|
||||
|
||||
nsTextWidget::nsTextWidget() : nsTextHelper()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsTextWidget::~nsTextWidget()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsTextWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kInsTextWidgetIID, NS_ITEXTWIDGET_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kInsTextWidgetIID)) {
|
||||
*aInstancePtr = (void*) ((nsITextWidget*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool nsTextWidget::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsTextWidget::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PRBool nsTextWidget::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextWidget::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTextWidget::Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsTextWidget_h__
|
||||
#define nsTextWidget_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsTextHelper.h"
|
||||
#include "nsITextWidget.h"
|
||||
|
||||
class nsTextWidget : public nsTextHelper
|
||||
{
|
||||
|
||||
public:
|
||||
nsTextWidget();
|
||||
virtual ~nsTextWidget();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
};
|
||||
|
||||
#endif // nsTextWidget_h__
|
|
@ -0,0 +1,38 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsToolkit.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "plevent.h"
|
||||
|
||||
nsToolkit::nsToolkit()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsToolkit::~nsToolkit()
|
||||
{
|
||||
}
|
||||
|
||||
NS_DEFINE_IID(kIToolkitIID, NS_ITOOLKIT_IID);
|
||||
NS_IMPL_ISUPPORTS(nsToolkit,kIToolkitIID);
|
||||
|
||||
NS_METHOD nsToolkit::Init(PRThread *aThread)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsToolkit_h__
|
||||
#define nsToolkit_h__
|
||||
|
||||
#include "nsIToolkit.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
struct PLEventQueue;
|
||||
struct MethodInfo;
|
||||
|
||||
/**
|
||||
* Wrapper around the thread running the message pump.
|
||||
* The toolkit abstraction is necessary because the message pump must
|
||||
* execute within the same thread that created the widget under Win32.
|
||||
*/
|
||||
|
||||
class nsToolkit : public nsIToolkit
|
||||
{
|
||||
|
||||
public:
|
||||
nsToolkit();
|
||||
virtual ~nsToolkit();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD Init(PRThread *aThread);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,66 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsTooltipWidget.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsTooltipWidget)
|
||||
NS_IMPL_RELEASE(nsTooltipWidget)
|
||||
|
||||
|
||||
nsTooltipWidget::nsTooltipWidget()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsTooltipWidget::~nsTooltipWidget()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsTooltipWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kInsTooltipWidgetIID, NS_ITOOLTIPWIDGET_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kInsTooltipWidgetIID)) {
|
||||
*aInstancePtr = (void*) ((nsITooltipWidget*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool nsTooltipWidget::OnPaint()
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsTooltipWidget::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsTooltipWidget::AutoErase()
|
||||
{
|
||||
return(PR_TRUE);
|
||||
}
|
||||
|
||||
NS_METHOD nsTooltipWidget::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsTooltipWidget_h__
|
||||
#define nsTooltipWidget_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsITooltipWidget.h"
|
||||
|
||||
/**
|
||||
* Native Win32 tooltip window wrapper
|
||||
*/
|
||||
|
||||
class nsTooltipWidget : public nsWidget,
|
||||
public nsITooltipWidget
|
||||
{
|
||||
|
||||
public:
|
||||
nsTooltipWidget();
|
||||
virtual ~nsTooltipWidget();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual PRBool AutoErase();
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // nsTooltipWidget_h__
|
|
@ -0,0 +1,309 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsWidget.h"
|
||||
|
||||
Display *gDisplay;
|
||||
Screen *gScreen;
|
||||
int gScreenNum;
|
||||
int gDepth;
|
||||
Visual *gVisual;
|
||||
XVisualInfo *gVisualInfo;
|
||||
|
||||
nsWidget::nsWidget() : nsBaseWidget()
|
||||
{
|
||||
mPreferredWidth = 0;
|
||||
mPreferredHeight = 0;
|
||||
mWindow = 0;
|
||||
}
|
||||
|
||||
nsWidget::~nsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData)
|
||||
{
|
||||
return(StandardWindowCreate(aParent, aRect, aHandleEventFunction,
|
||||
aContext, aAppShell, aToolkit, aInitData,
|
||||
nsnull));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData)
|
||||
{
|
||||
return(StandardWindowCreate(nsnull, aRect, aHandleEventFunction,
|
||||
aContext, aAppShell, aToolkit, aInitData,
|
||||
aParent));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWidget::StandardWindowCreate(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData,
|
||||
nsNativeWidget aNativeParent)
|
||||
{
|
||||
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long attr_mask;
|
||||
Window parent;
|
||||
|
||||
// set up the BaseWidget parts.
|
||||
BaseCreate(aParent, aRect, aHandleEventFunction, aContext,
|
||||
aAppShell, aToolkit, aInitData);
|
||||
// check to see if the parent is there...
|
||||
if (nsnull != aParent) {
|
||||
parent = ((aParent) ? (Window)aParent->GetNativeData(NS_NATIVE_WINDOW) : nsnull);
|
||||
} else {
|
||||
parent = (Window)aNativeParent;
|
||||
}
|
||||
// if there's no parent, make the parent the root window.
|
||||
if (parent == 0) {
|
||||
parent = RootWindow(gDisplay, gScreenNum);
|
||||
}
|
||||
// on a window resize, we don't want to window contents to
|
||||
// be discarded...
|
||||
attr.bit_gravity = NorthWestGravity;
|
||||
// make sure that we listen for events
|
||||
attr.event_mask = SubstructureNotifyMask | StructureNotifyMask;
|
||||
// here's what's in the struct
|
||||
attr_mask = CWBitGravity | CWEventMask;
|
||||
|
||||
mWindow = XCreateWindow(gDisplay,
|
||||
parent,
|
||||
aRect.x, aRect.y,
|
||||
aRect.width, aRect.height,
|
||||
0, // border width
|
||||
gDepth,
|
||||
InputOutput, // class
|
||||
CopyFromParent, // visual
|
||||
attr_mask,
|
||||
&attr);
|
||||
// map this window and flush the connection. we want to see this
|
||||
// thing now.
|
||||
XMapWindow(gDisplay,
|
||||
mWindow);
|
||||
XFlush(gDisplay);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Destroy()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Move(PRUint32 aX, PRUint32 aY)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Resize(PRUint32 aWidth,
|
||||
PRUint32 aHeight,
|
||||
PRBool aRepaint)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Resize(PRUint32 aX,
|
||||
PRUint32 aY,
|
||||
PRUint32 aWidth,
|
||||
PRUint32 aHeight,
|
||||
PRBool aRepaint)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Enable(PRBool bState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::SetFocus(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Invalidate(PRBool aIsSynchronous)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFontMetrics* nsWidget::GetFont(void)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::SetMenuBar(nsIMenuBar * aMenuBar)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void * nsWidget::GetNativeData(PRUint32 aDataType)
|
||||
{
|
||||
switch (aDataType) {
|
||||
case NS_NATIVE_WIDGET:
|
||||
case NS_NATIVE_WINDOW:
|
||||
return (void *)mWindow;
|
||||
break;
|
||||
case NS_NATIVE_DISPLAY:
|
||||
return (void *)gDisplay;
|
||||
break;
|
||||
case NS_NATIVE_GRAPHIC:
|
||||
// XXX implement this...
|
||||
return NULL;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "nsWidget::GetNativeData(%d) called with crap value.\n",
|
||||
aDataType);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::SetTitle(const nsString& aTitle)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::SetTooltips(PRUint32 aNumberOfTips,
|
||||
nsRect* aTooltipAreas[])
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::UpdateTooltips(nsRect* aNewTips[])
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::RemoveTooltips()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::SetFont(const nsFont &aFont)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::BeginResizingChildren(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::EndResizingChildren(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::SetColorMap(nsColorMap *aColorMap)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Show(PRBool bState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::IsVisible(PRBool &aState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Update()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::DispatchEvent(nsGUIEvent* event,
|
||||
nsEventStatus & aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::GetClientBounds(nsRect &aRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::SetBackgroundColor(const nscolor &aColor)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::WidgetToScreen(const nsRect& aOldRect,
|
||||
nsRect& aNewRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::ScreenToWidget(const nsRect& aOldRect,
|
||||
nsRect& aNewRect)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::SetCursor(nsCursor aCursor)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIWidget *nsWidget::GetParent(void)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsWidget_h__
|
||||
#define nsWidget_h__
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xos.h>
|
||||
#include "nsBaseWidget.h"
|
||||
|
||||
class nsWidget : public nsBaseWidget
|
||||
{
|
||||
public:
|
||||
nsWidget();
|
||||
virtual ~nsWidget();
|
||||
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
|
||||
virtual nsresult StandardWindowCreate(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData,
|
||||
nsNativeWidget aNativeParent = nsnull);
|
||||
NS_IMETHOD Destroy();
|
||||
virtual nsIWidget *GetParent(void);
|
||||
NS_IMETHOD Show(PRBool bState);
|
||||
NS_IMETHOD IsVisible(PRBool &aState);
|
||||
|
||||
NS_IMETHOD Move(PRUint32 aX, PRUint32 aY);
|
||||
NS_IMETHOD Resize(PRUint32 aWidth,
|
||||
PRUint32 aHeight,
|
||||
PRBool aRepaint);
|
||||
NS_IMETHOD Resize(PRUint32 aX,
|
||||
PRUint32 aY,
|
||||
PRUint32 aWidth,
|
||||
PRUint32 aHeight,
|
||||
PRBool aRepaint);
|
||||
|
||||
NS_IMETHOD Enable(PRBool bState);
|
||||
NS_IMETHOD SetFocus(void);
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
NS_IMETHOD GetClientBounds(nsRect &aRect);
|
||||
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
||||
virtual nsIFontMetrics* GetFont(void);
|
||||
NS_IMETHOD SetFont(const nsFont &aFont);
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
||||
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous);
|
||||
NS_IMETHOD Update();
|
||||
virtual void* GetNativeData(PRUint32 aDataType);
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
|
||||
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
|
||||
NS_IMETHOD SetTitle(const nsString& aTitle);
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
|
||||
NS_IMETHOD SetTooltips(PRUint32 aNumberOfTips,nsRect* aTooltipAreas[]);
|
||||
NS_IMETHOD RemoveTooltips();
|
||||
NS_IMETHOD UpdateTooltips(nsRect* aNewTips[]);
|
||||
NS_IMETHOD WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect);
|
||||
NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect);
|
||||
NS_IMETHOD BeginResizingChildren(void);
|
||||
NS_IMETHOD EndResizingChildren(void);
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
|
||||
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
||||
|
||||
protected:
|
||||
PRUint32 mPreferredWidth;
|
||||
PRUint32 mPreferredHeight;
|
||||
Window mWindow;
|
||||
};
|
||||
|
||||
extern Display *gDisplay;
|
||||
extern Screen *gScreen;
|
||||
extern int gScreenNum;
|
||||
extern int gDepth;
|
||||
extern Visual *gVisual;
|
||||
extern XVisualInfo *gVisualInfo;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,263 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
||||
// includes for our specific widgets
|
||||
#include "nsWindow.h"
|
||||
#include "nsButton.h"
|
||||
#include "nsCheckButton.h"
|
||||
#include "nsComboBox.h"
|
||||
#include "nsRadioButton.h"
|
||||
#include "nsFileWidget.h"
|
||||
#include "nsListBox.h"
|
||||
#include "nsScrollBar.h"
|
||||
#include "nsTextAreaWidget.h"
|
||||
#include "nsTextWidget.h"
|
||||
#include "nsTabWidget.h"
|
||||
#include "nsTooltipWidget.h"
|
||||
#include "nsAppShell.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsLookAndFeel.h"
|
||||
#include "nsDialog.h"
|
||||
#include "nsLabel.h"
|
||||
#include "nsMenuBar.h"
|
||||
#include "nsMenu.h"
|
||||
#include "nsMenuItem.h"
|
||||
#include "nsImageButton.h"
|
||||
#include "nsMenuButton.h"
|
||||
#include "nsPopUpMenu.h"
|
||||
|
||||
static NS_DEFINE_IID(kCWindow, NS_WINDOW_CID);
|
||||
static NS_DEFINE_IID(kCChild, NS_CHILD_CID);
|
||||
static NS_DEFINE_IID(kCButton, NS_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCCheckButton, NS_CHECKBUTTON_CID);
|
||||
static NS_DEFINE_IID(kCCombobox, NS_COMBOBOX_CID);
|
||||
static NS_DEFINE_IID(kCFileOpen, NS_FILEWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCListbox, NS_LISTBOX_CID);
|
||||
static NS_DEFINE_IID(kCRadioButton, NS_RADIOBUTTON_CID);
|
||||
static NS_DEFINE_IID(kCHorzScrollbar, NS_HORZSCROLLBAR_CID);
|
||||
static NS_DEFINE_IID(kCVertScrollbar, NS_VERTSCROLLBAR_CID);
|
||||
static NS_DEFINE_IID(kCTextArea, NS_TEXTAREA_CID);
|
||||
static NS_DEFINE_IID(kCTextField, NS_TEXTFIELD_CID);
|
||||
static NS_DEFINE_IID(kCTabWidget, NS_TABWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCTooltipWidget, NS_TOOLTIPWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCAppShell, NS_APPSHELL_CID);
|
||||
static NS_DEFINE_IID(kCToolkit, NS_TOOLKIT_CID);
|
||||
static NS_DEFINE_IID(kCLookAndFeel, NS_LOOKANDFEEL_CID);
|
||||
static NS_DEFINE_IID(kCDialog, NS_DIALOG_CID);
|
||||
static NS_DEFINE_IID(kCLabel, NS_LABEL_CID);
|
||||
static NS_DEFINE_IID(kCMenuBar, NS_MENUBAR_CID);
|
||||
static NS_DEFINE_IID(kCMenu, NS_MENU_CID);
|
||||
static NS_DEFINE_IID(kCMenuItem, NS_MENUITEM_CID);
|
||||
static NS_DEFINE_IID(kCImageButton, NS_IMAGEBUTTON_CID);
|
||||
static NS_DEFINE_IID(kCPopUpMenu, NS_POPUPMENU_CID);
|
||||
static NS_DEFINE_IID(kCMenuButton, NS_MENUBUTTON_CID);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
class nsWidgetFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
nsWidgetFactory(const nsCID &aClass);
|
||||
virtual ~nsWidgetFactory();
|
||||
|
||||
private:
|
||||
nsCID mClassID;
|
||||
};
|
||||
|
||||
NS_IMPL_ADDREF(nsWidgetFactory)
|
||||
NS_IMPL_RELEASE(nsWidgetFactory)
|
||||
|
||||
nsWidgetFactory::nsWidgetFactory(const nsCID &aClass)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mClassID = aClass;
|
||||
}
|
||||
|
||||
nsWidgetFactory::~nsWidgetFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "Reference count not zero in destructor");
|
||||
}
|
||||
|
||||
nsresult nsWidgetFactory::QueryInterface(const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = NULL;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
}
|
||||
|
||||
if (*aResult == NULL) {
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF_THIS(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsWidgetFactory::CreateInstance(nsISupports* aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aResult = NULL;
|
||||
if (nsnull != aOuter) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
if (mClassID.Equals(kCWindow)) {
|
||||
inst = (nsISupports*)new nsWindow();
|
||||
}
|
||||
else if (mClassID.Equals(kCChild)) {
|
||||
inst = (nsISupports*)new ChildWindow();
|
||||
}
|
||||
else if (mClassID.Equals(kCButton)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsButton();
|
||||
}
|
||||
else if (mClassID.Equals(kCCheckButton)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsCheckButton();
|
||||
}
|
||||
else if (mClassID.Equals(kCCombobox)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsComboBox();
|
||||
}
|
||||
else if (mClassID.Equals(kCRadioButton)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsRadioButton();
|
||||
}
|
||||
else if (mClassID.Equals(kCFileOpen)) {
|
||||
inst = (nsISupports*)new nsFileWidget();
|
||||
}
|
||||
else if (mClassID.Equals(kCListbox)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsListBox();
|
||||
}
|
||||
else if (mClassID.Equals(kCHorzScrollbar)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsScrollbar(PR_FALSE);
|
||||
}
|
||||
else if (mClassID.Equals(kCVertScrollbar)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsScrollbar(PR_TRUE);
|
||||
}
|
||||
else if (mClassID.Equals(kCTextArea)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsTextAreaWidget();
|
||||
}
|
||||
else if (mClassID.Equals(kCTextField)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsTextWidget();
|
||||
}
|
||||
else if (mClassID.Equals(kCTabWidget)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsTabWidget();
|
||||
}
|
||||
else if (mClassID.Equals(kCTooltipWidget)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsTooltipWidget();
|
||||
}
|
||||
else if (mClassID.Equals(kCAppShell)) {
|
||||
inst = (nsISupports*)new nsAppShell();
|
||||
}
|
||||
else if (mClassID.Equals(kCToolkit)) {
|
||||
inst = (nsISupports*)new nsToolkit();
|
||||
}
|
||||
else if (mClassID.Equals(kCLookAndFeel)) {
|
||||
inst = (nsISupports*)new nsLookAndFeel();
|
||||
}
|
||||
else if (mClassID.Equals(kCDialog)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsDialog();
|
||||
}
|
||||
else if (mClassID.Equals(kCLabel)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsLabel();
|
||||
}
|
||||
else if (mClassID.Equals(kCMenuBar)) {
|
||||
inst = (nsISupports*)(nsIMenuBar*) new nsMenuBar();
|
||||
}
|
||||
else if (mClassID.Equals(kCMenu)) {
|
||||
inst = (nsISupports*)(nsIMenu*) new nsMenu();
|
||||
}
|
||||
else if (mClassID.Equals(kCMenuItem)) {
|
||||
inst = (nsISupports*)(nsIMenuItem*) new nsMenuItem();
|
||||
}
|
||||
else if (mClassID.Equals(kCImageButton)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsImageButton();
|
||||
}
|
||||
else if (mClassID.Equals(kCMenuButton)) {
|
||||
inst = (nsISupports*)(nsWindow*)new nsMenuButton();
|
||||
}
|
||||
else if (mClassID.Equals(kCPopUpMenu)) {
|
||||
inst = (nsISupports*)new nsPopUpMenu();
|
||||
}
|
||||
if (inst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK) {
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsWidgetFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_WIDGET nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aFactory = new nsWidgetFactory(aClass);
|
||||
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsWindow.h"
|
||||
|
||||
nsWindow::nsWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsWindow::~nsWindow()
|
||||
{
|
||||
}
|
||||
|
||||
ChildWindow::ChildWindow()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsWindow_h__
|
||||
#define nsWindow_h__
|
||||
|
||||
#include "nsWidget.h"
|
||||
|
||||
class nsWindow : public nsWidget
|
||||
{
|
||||
public:
|
||||
nsWindow();
|
||||
~nsWindow();
|
||||
};
|
||||
|
||||
class ChildWindow : public nsWindow
|
||||
{
|
||||
public:
|
||||
ChildWindow();
|
||||
virtual IsChild() { return PR_TRUE; };
|
||||
};
|
||||
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче