This commit is contained in:
rods%netscape.com 1998-09-01 21:08:32 +00:00
Родитель 18834062f0
Коммит f68761c718
3 изменённых файлов: 154 добавлений и 128 удалений

Просмотреть файл

@ -34,6 +34,7 @@
#include "nsIDOMDocument.h"
#include "nsIURL.h"
#include "nsIFileWidget.h"
#include "nsILookAndFeel.h"
#include "nsRepository.h"
#include "nsIFactory.h"
#include "nsCRT.h"
@ -104,6 +105,7 @@
#define WEBSHELL_BOTTOM_INSET 0
#endif
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID);
static NS_DEFINE_IID(kButtonCID, NS_BUTTON_CID);
static NS_DEFINE_IID(kFileWidgetCID, NS_FILEWIDGET_CID);
@ -116,6 +118,7 @@ static NS_DEFINE_IID(kCheckButtonCID, NS_CHECKBUTTON_CID);
static NS_DEFINE_IID(kRadioButtonCID, NS_RADIOBUTTON_CID);
static NS_DEFINE_IID(kLabelCID, NS_LABEL_CID);
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID);
static NS_DEFINE_IID(kIButtonIID, NS_IBUTTON_IID);
static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
@ -590,15 +593,19 @@ nsEventStatus nsBrowserWindow::ProcessDialogEvent(nsGUIEvent *aEvent)
void
nsBrowserWindow::DoFind()
{
if (mDialog != nsnull) {
mDialog->Show(PR_TRUE);
mTextField->SetFocus();
nsString str;
mTextField->GetText(str, 255);
mTextField->SelectAll();
return;
if (mDialog == nsnull) {
nscoord txtHeight = 24;
nscolor textBGColor = NS_RGB(0, 0, 0);
nscolor textFGColor = NS_RGB(255, 255, 255);
nsILookAndFeel * lookAndFeel;
if (NS_OK == nsRepository::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID, (void**)&lookAndFeel)) {
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TextFieldHeight, txtHeight);
lookAndFeel->GetColor(nsILookAndFeel::eColor_TextBackground, textBGColor);
lookAndFeel->GetColor(nsILookAndFeel::eColor_TextForeground, textFGColor);
}
nsIDeviceContext* dc = mWindow->GetDeviceContext();
float t2d;
dc->GetTwipsToDevUnits(t2d);
@ -630,10 +637,11 @@ nsBrowserWindow::DoFind()
xx += 75 + 5;
// Create TextField
rect.SetRect(xx, 5, 200, 24);
rect.SetRect(xx, 5, 200, txtHeight);
nsRepository::CreateInstance(kTextFieldCID, nsnull, kITextWidgetIID, (void**)&mTextField);
mTextField->Create(mDialog, rect, HandleEvent, NULL);
mTextField->SetBackgroundColor(NS_RGB(255,255,255));
mTextField->SetBackgroundColor(textBGColor);
mTextField->SetForegroundColor(textFGColor);
mTextField->SetFont(font);
mTextField->Show(PR_TRUE);
mTextField->SetClientData(this);
@ -641,7 +649,7 @@ nsBrowserWindow::DoFind()
nscoord w = 65;
nscoord x = 205+80-w;
nscoord y = 29 + 5;
nscoord y = txtHeight + 10;
nscoord h = 19;
// Create Up RadioButton
@ -693,8 +701,10 @@ nsBrowserWindow::DoFind()
mCancelBtn->Show(PR_TRUE);
mCancelBtn->SetClientData(this);
}
mDialog->Show(PR_TRUE);
mTextField->SetFocus();
mTextField->SelectAll();
}

Просмотреть файл

@ -90,11 +90,13 @@ static NS_DEFINE_IID(kCDocumentLoaderCID, NS_DOCUMENTLOADER_CID);
static NS_DEFINE_IID(kThrobberCID, NS_THROBBER_CID);
static NS_DEFINE_IID(kCPluginHostCID, NS_PLUGIN_HOST_CID);
static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID);
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
extern "C" void
NS_SetupRegistry()
{
nsRepository::RegisterFactory(kLookAndFeelCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCWindowIID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCScrollbarIID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCHScrollbarIID, WIDGET_DLL, PR_FALSE, PR_FALSE);

Просмотреть файл

@ -35,6 +35,8 @@
#include "nsILabel.h"
#include "nsIButton.h"
#include "nsITextWidget.h"
#include "nsILookAndFeel.h"
#include "nscolor.h"
// XXX For font setting below
#include "nsFont.h"
@ -510,6 +512,7 @@ static nsIButton * mSitePrevBtn;
static nsIButton * mSiteNextBtn;
static nsILabel * mSiteLabel;
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
static NS_DEFINE_IID(kButtonCID, NS_BUTTON_CID);
static NS_DEFINE_IID(kTextFieldCID, NS_TEXTFIELD_CID);
static NS_DEFINE_IID(kWindowCID, NS_WINDOW_CID);
@ -517,6 +520,7 @@ static NS_DEFINE_IID(kDialogCID, NS_DIALOG_CID);
static NS_DEFINE_IID(kCheckButtonCID, NS_CHECKBUTTON_CID);
static NS_DEFINE_IID(kLabelCID, NS_LABEL_CID);
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
static NS_DEFINE_IID(kIButtonIID, NS_IBUTTON_IID);
static NS_DEFINE_IID(kITextWidgetIID, NS_ITEXTWIDGET_IID);
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
@ -647,6 +651,16 @@ PRBool CreateRobotDialog(nsIWidget * aParent)
mRobotDialog->SetLabel("Debug Robot Options");
nscoord txtHeight = 24;
nscolor textBGColor = NS_RGB(255,255,255);
nscolor textFGColor = NS_RGB(255,255,255);
nsILookAndFeel * lookAndFeel;
if (NS_OK == nsRepository::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID, (void**)&lookAndFeel)) {
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TextFieldHeight, txtHeight);
lookAndFeel->GetColor(nsILookAndFeel::eColor_TextBackground, textBGColor);
lookAndFeel->GetColor(nsILookAndFeel::eColor_TextForeground, textFGColor);
}
nscoord w = 65;
nscoord x = 5;
nscoord y = 10;
@ -677,7 +691,8 @@ PRBool CreateRobotDialog(nsIWidget * aParent)
rect.SetRect(x, y, 225, txtHeight);
nsRepository::CreateInstance(kTextFieldCID, nsnull, kITextWidgetIID, (void**)&mVerDirTxt);
mVerDirTxt->Create(mRobotDialog, rect, HandleRobotEvent, NULL);
mVerDirTxt->SetBackgroundColor(NS_RGB(255,255,255));
mVerDirTxt->SetBackgroundColor(textBGColor);
mVerDirTxt->SetForegroundColor(textFGColor);
mVerDirTxt->SetFont(font);
nsString verStr(DEBUG_EMPTY);
mVerDirTxt->SetText(verStr);
@ -703,7 +718,8 @@ PRBool CreateRobotDialog(nsIWidget * aParent)
rect.SetRect(x, y, 75, txtHeight);
nsRepository::CreateInstance(kTextFieldCID, nsnull, kITextWidgetIID, (void**)&mStopAfterTxt);
mStopAfterTxt->Create(mRobotDialog, rect, HandleRobotEvent, NULL);
mStopAfterTxt->SetBackgroundColor(NS_RGB(255,255,255));
mStopAfterTxt->SetBackgroundColor(textBGColor);
mStopAfterTxt->SetForegroundColor(textFGColor);
mStopAfterTxt->SetFont(font);
mStopAfterTxt->Show(PR_TRUE);
@ -987,19 +1003,18 @@ PRBool CreateSiteDialog(nsIWidget * aParent)
PRBool result = TRUE;
/* mSiteDialog->Show(PR_TRUE);
mSiteNextBtn->SetFocus();
// Init
mSitePrevBtn->Enable(PR_FALSE);
if (gWinData) {
nsString urlStr(gTop100List[gTop100Pointer]);
gWinData->LoadURL(urlStr);
mSiteLabel->SetLabel(urlStr);
}
return TRUE;
}*/
if (mSiteDialog == nsnull) {
nscoord txtHeight = 24;
nscolor textBGColor = NS_RGB(0,0,0);
nscolor textFGColor = NS_RGB(255,255,255);
nsILookAndFeel * lookAndFeel;
if (NS_OK == nsRepository::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID, (void**)&lookAndFeel)) {
//lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TextFieldHeight, txtHeight);
//lookAndFeel->GetColor(nsILookAndFeel::eColor_TextBackground, textBGColor);
//lookAndFeel->GetColor(nsILookAndFeel::eColor_TextForeground, textFGColor);
}
nsILabel * label;
nsIDeviceContext* dc = aParent->GetDeviceContext();
@ -1021,7 +1036,6 @@ PRBool CreateSiteDialog(nsIWidget * aParent)
mSiteDialog->SetLabel("Top 100 Site Walker");
//mSiteDialog->SetClientData(this);
nscoord txtHeight = 24;
nscoord w = 65;
nscoord x = 5;
nscoord y = 10;