Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/ResPopupBrowser.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.8 by h677, Sun May 13 17:38:44 2007 UTC revision 1.1.2.9 by h677, Mon May 14 22:02:43 2007 UTC
# Line 62  begin Line 62  begin
62      Visible := False;      Visible := False;
63      Title := '';      Title := '';
64      RawDocument := '';      RawDocument := '';
65        FEvent := nil;
66  end;  end;
67    
68  destructor TResPopupBrowser.Destroy;  destructor TResPopupBrowser.Destroy;
69  begin  begin
70        Self.OnEnter := nil;
71        Self.OnBeforeNavigate2 := nil;
72        Self.OnStatusTextChange := nil;
73        Self.OnNewWindow2 := nil;
74        if (FChild <> nil) then begin
75            FChild.Free;
76            FChild := nil;
77        end;
78        if (FEvent <> nil) then begin
79            FEvent.Free;
80            FEvent := nil;
81        end;
82        FThread := nil;
83          inherited Destroy;          inherited Destroy;
84  end;  end;
85    
86  procedure TResPopupBrowser.CreateParams(var Params: TCreateParams);  procedure TResPopupBrowser.CreateParams(var Params: TCreateParams);
87  begin  begin
88          inherited CreateParams(Params);          inherited;
89        Params.Style := Params.Style or WS_EX_TOOLWINDOW;
90    
91  end;  end;
92  function TResPopupBrowser.CreateNewBrowser: TResPopupBrowser;  function TResPopupBrowser.CreateNewBrowser: TResPopupBrowser;
93  begin  begin
# Line 84  begin Line 100  begin
100              end;              end;
101          end else begin          end else begin
102              FChild := TResPopupBrowser.Create(Self);              FChild := TResPopupBrowser.Create(Self);
103              TOleControl(FChild).Parent := nil;              TOleControl(FChild).Parent := TOleControl(Self).Parent;
104              FChild.ParentBrowser := Self;              FChild.ParentBrowser := Self;
105              FChild.NavigateBlank;              FChild.NavigateBlank;
106    
107              FChild.OnEnter := GikoForm.BrowserEnter;              FChild.OnEnter := GikoForm.BrowserEnter;
108              FChild.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2;              FChild.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2;
109              FChild.OnStatusTextChange := GikoForm.BrowserStatusTextChange;              FChild.OnStatusTextChange := GikoForm.BrowserStatusTextChange;
110              FChild.OnNewWindow2 := GikoForm.BrowserNewWindow2;              FChild.OnNewWindow2 := GikoForm.BrowserNewWindow2;
111                SetWindowPos(FChild.Handle, HWND_BOTTOM,
112                    0, 0, 0 , 0,
113                    SWP_NOSIZE or SWP_NOMOVE or  SWP_NOACTIVATE or SWP_HIDEWINDOW);
114              ShowWindow(FChild.Handle, SW_HIDE);              ShowWindow(FChild.Handle, SW_HIDE);
115              Result := FChild;              Result := FChild;
116          end;          end;
# Line 102  begin Line 122  begin
122          Self.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2;          Self.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2;
123          Self.OnStatusTextChange := GikoForm.BrowserStatusTextChange;          Self.OnStatusTextChange := GikoForm.BrowserStatusTextChange;
124          Self.OnNewWindow2 := GikoForm.BrowserNewWindow2;          Self.OnNewWindow2 := GikoForm.BrowserNewWindow2;
125            SetWindowPos(Self.Handle, HWND_BOTTOM,
126                0, 0, 0 , 0,
127                SWP_NOSIZE or SWP_NOMOVE or  SWP_NOACTIVATE or SWP_HIDEWINDOW);
128          Result := Self;          Result := Self;
129      end;      end;
130  end;  end;
# Line 131  begin Line 154  begin
154  end;  end;
155  procedure TResPopupBrowser.Write(ADocument: String; OnlyTitle: Boolean = False);  procedure TResPopupBrowser.Write(ADocument: String; OnlyTitle: Boolean = False);
156  var  var
157            p: TPoint;
158      doc: Variant;      doc: Variant;
159          ARect: TRect;          ARect: TRect;
160      FDispHtmlDocument: DispHTMLDocument;      FDispHtmlDocument: DispHTMLDocument;
161  begin  begin
     Self.OnStatusTextChange := nil;  
162      try      try
163          try          // タスクバーから消す
164              // いったん縮小          SetWindowLongA(Self.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
165              SetWindowPos(Self.Handle, HWND_TOP,          GetCursorpos(p);
166                  0, 0, 50 , 50,          // いったん縮小
167                  SWP_NOMOVE or SWP_NOACTIVATE or SWP_HIDEWINDOW);          SetWindowPos(Self.Handle, HWND_BOTTOM,
168                p.X, p.Y, 50 , 50,
169              doc := Idispatch( olevariant(Self.ControlInterface).Document) as IHTMLDocument2;              SWP_NOACTIVATE or SWP_HIDEWINDOW);
170              doc.open;          doc := Idispatch( olevariant(Self.ControlInterface).Document) as IHTMLDocument2;
171              doc.charset := 'Shift_JIS';          doc.open;
172              doc.Write('<html><head>'#13#10 +          doc.charset := 'Shift_JIS';
173                      '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">'#13#10          doc.Write('<html><head>'#13#10 +
174                      + GetBodyStyle(OnlyTitle) + '</head><body>'                  '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">'#13#10
175                      + GetTitle(OnlyTitle)                  + GetBodyStyle(OnlyTitle) + '</head><body>'
176                      + ADocument + '<a name="bottom"></a></body></html>');                  + GetTitle(OnlyTitle)
177              doc.Close;                  + ADocument + '<a name="bottom"></a></body></html>');
178            doc.Close;
179              ARect := CalcRect(Screen.WorkAreaHeight, Screen.WorkAreaWidth,  
180                   not OnlyTitle);          ARect := CalcRect(Screen.WorkAreaHeight, Screen.WorkAreaWidth,
181              SetWindowPos(Self.Handle, HWND_TOP,               not OnlyTitle);
182                  ARect.Left, ARect.Top,  
183                  (ARect.Right - ARect.Left) ,          FDispHtmlDocument := Idispatch(OleVariant(Self.ControlInterface).Document) as DispHTMLDocument;
184                  (ARect.Bottom - ARect.Top),          FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
185                  SWP_NOACTIVATE or SWP_HIDEWINDOW);          FEvent.OnClick := ResPopupBrowserClick;
186              FDispHtmlDocument := Idispatch(OleVariant(Self.ControlInterface).Document) as DispHTMLDocument;  
187              FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);          Self.Visible := True;
188              FEvent.OnClick := ResPopupBrowserClick;          SetWindowPos(Self.Handle, HWND_TOP,
189              ShowWindow(Self.Handle, SW_SHOWNOACTIVATE);              ARect.Left, ARect.Top,
190              Self.Visible := True;              (ARect.Right - ARect.Left) ,
191          except              (ARect.Bottom - ARect.Top),
192          end;              SWP_NOACTIVATE or SWP_HIDEWINDOW);
     finally  
         Self.OnStatusTextChange := GikoForm.BrowserStatusTextChange;  
     end;  
193    
194            ShowWindow(Self.Handle, SW_SHOWNOACTIVATE);
195        except
196        end;
197  end;  end;
198  function TResPopupBrowser.GetTitle(OnlyTitle: Boolean): string;  function TResPopupBrowser.GetTitle(OnlyTitle: Boolean): string;
199  begin  begin
# Line 210  begin Line 233  begin
233  end;  end;
234    
235  procedure TResPopupBrowser.Clear;  procedure TResPopupBrowser.Clear;
236    var
237        body: IHTMLElement2;
238  begin  begin
239      ChildClear;      ChildClear;
240      if (Self.Visible) then begin      if (Self.Visible) then begin
241            try
242                if (Self.ParentBrowser = nil) then begin
243                    body := (Idispatch( olevariant(GikoForm.ActiveContent.Browser
244                        .ControlInterface).Document) as IHTMLDocument2).body as IHTMLElement2;
245                    body.focus;
246                end;
247            except
248            end;
249          Self.Title := '';          Self.Title := '';
250          Self.RawDocument := '';          Self.RawDocument := '';
251          Self.FThread := nil;          Self.FThread := nil;
252          FEvent.Free;          FEvent.Free;
253            FEvent := nil;
254          NavigateBlank;          NavigateBlank;
255          ShowWindow(Self.Handle, SW_HIDE);          ShowWindow(Self.Handle, SW_HIDE);
256          Self.Visible := False;          Self.Visible := False;
# Line 306  begin Line 340  begin
340      end;      end;
341  end;  end;
342  function TResPopupBrowser.ResPopupBrowserClick(Sender: TObject): WordBool;  function TResPopupBrowser.ResPopupBrowserClick(Sender: TObject): WordBool;
343    var
344        doc: IHTMLDocument2;
345        body: IHTMLElement2;
346  begin  begin
347    //    doc := Idispatch( olevariant(
348    //        GikoForm.ActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2;
349        doc := Idispatch( olevariant(
350            Self.ControlInterface).Document) as IHTMLDocument2;
351        body := (doc.body as IHTMLElement2);
352        body.focus;
353      Result := True;      Result := True;
354  end;  end;
355  function TResPopupBrowser.GetThread: TThreadItem;  function TResPopupBrowser.GetThread: TThreadItem;

Legend:
Removed from v.1.1.2.8  
changed lines
  Added in v.1.1.2.9

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26