cvs: php-gtk-doc /en/tutorials hellow.xml
| From: | Thomas Gonzalez Miranda | Date: | Sat, 21 Sep 2002 21:20:43 +0000 |
| Subject: | cvs: php-gtk-doc /en/tutorials hellow.xml | ||
| Groups: | php.gtk.doc | ||
| Request: | Send a blank email to php-gtk-doc+get-564@lists.php.net to get a copy of this message | ||
thomasgm Sat Sep 21 17:20:43 2002 EDT
Modified files:
/php-gtk-doc/en/tutorials hellow.xml
Log:
updated
Index: php-gtk-doc/en/tutorials/hellow.xml diff -u php-gtk-doc/en/tutorials/hellow.xml:1.7 php-gtk-doc/en/tutorials/hellow.xml:1.8 --- php-gtk-doc/en/tutorials/hellow.xml:1.7 Sun Jan 20 14:47:45 2002 +++ php-gtk-doc/en/tutorials/hellow.xml Sat Sep 21 17:20:43 2002 @@ -2,71 +2,65 @@ <chapter id="tutorials.hellow"> <title>Hello World Tutorial</title> <simpara> - When you begin to learn a programming language, the first program - you often write is a 'hello world' program. So, just to fit in with - everyone else, the first tutorial in this manual just happens to - be a 'hello world' tutorial! + Quando você começa a aprender uma linguagem, o primeiro programa + que você é ensinado à fazer é o famoso 'hello world'. + Então, somente para não ser diferente de ninguém, o primeiro + tutorial deste manual será o famoso 'hello world'! </simpara> <simpara> - Throughout the tutorials we expect a reasonable grasp of PHP itself. - The tutorials are designed to give the user an idea of how to use - PHP-GTK, and the ideas and techniques behind it. + Através dos tutorias nós esperamos que você já tenha um conhecimento razoável + do PHP. Os tutoriais são feitos para que o usuário possa ter uma idéia + do uso do PHP-GTK, e as idéias e técnicas por trás dele. </simpara> <simpara> - In this tutorial we will create a simple window with the text "Hello - World!" in it. + Neste tutorial você irá criar uma simples janela com o texto "Hello + World!" escrito nela. </simpara> <simpara> - We will start by listing the program and will then explain each line of - the program, giving an overview of a very basic PHP-GTK application. + Nós começaremos mostrando todo o programa e logo após iremos explicar + cada linha do programa, dando uma idéia de como é uma aplicação básica + feita em PHP-GTK. </simpara> <para> <example> - <title>PHP-GTK Hello World Program Listing</title> - <programlisting role="php"> -if (!class_exists('gtk')) { - if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')) - dl('php_gtk.dll'); - else - dl('php_gtk.so'); -} - -function delete_event() -{ - return false; -} - -function shutdown() -{ - print("Shutting down...\n"); - gtk::main_quit(); -} - -function hello() -{ - global $window; - print "Hello World!\n"; - $window->destroy(); -} - -$window = &new GtkWindow(); -$window->connect('destroy', 'shutdown'); -$window->connect('delete-event', 'delete_event'); -$window->set_border_width(10); - -$button = &new GtkButton('Hello World!'); -$button->connect('clicked', 'hello'); -$window->add($button); - -$window->show_all(); - -gtk::main(); + <title>PHP-GTK Hello World</title> + <programlisting role="php"> +if (!class_exists('gtk')) { + if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')) + dl('php_gtk.dll'); + else + dl('php_gtk.so'); + } + function deleta_evento() + { + return false; + } + function fechar() + { + print("Fechando...\n"); + gtk::main_quit(); + } + function hello() + { + global $window; + print "Hello World!\n"; + $window->destroy(); + } + $window = &new GtkWindow(); + $window->connect('destroy', 'fechar'); + $window->connect('delete-event', 'deleta_evento'); + $window->set_border_width(10); + $button = &new GtkButton('Hello World!'); + $button->connect('clicked', 'hello'); + $window->add($button); + $window->show_all(); + gtk::main(); </programlisting> </example> </para> <para> <example> - <title>Loading PHP-GTK</title> + <title>Carregando o PHP-GTK</title> <programlisting role="php"> if (!class_exists('gtk')) { if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')) @@ -76,63 +70,63 @@ } </programlisting> </example> - These first few lines check to see if the PHP-GTK extension is - already available, and loads it if it isn't. This is done by the - <literal>dl('php_gtk.dll');</literal> or - <literal>dl('php_gtk.so');</literal> statements on Windows and Linux - respectively. + Estas primeiras linhas checam se a extensão do PHP-GTK está + disponível, e carrega ela caso não esteja carregada. Isto é feito + pelo uso das funções <literal>dl('php_gtk.dll');</literal> ou + <literal>dl('php_gtk.so');</literal> no Windows e Linux + respectivamente. </para> <para> <example> - <title>The delete_event() function</title> + <title>A função deleta_evento()</title> <programlisting role="php"> -function delete_event() +function deleta_evento() { return false; } </programlisting> </example> - The <literal>delete_event()</literal> function is registered as a handler - (see below) for the <signalname>delete-event</signalname> signal. It - returns <literal>false</literal>, telling PHP-GTK to fire the - event's default signal handler, which in this case is the - <function class="GtkObject">destroy()</function> method. If the function - were to return <literal>true</literal>, PHP-GTK would stop the default - signal handler running at this point. This is useful to know if you need - to write a user-defined function in place of - <function class="GtkObject">destroy()</function> - for example, to - produce a dialog box confirming that the user intends to close down the - application. + A função <literal>deleta_evento()</literal> é registrada como um evento + (veja abaixo) para o sinal <signalname>delete-event</signalname>. Ela + retorna <literal>false</literal>, dizendo ao PHP-GTK para disparar o + evento de sinal padrão, que no nosso caso é o método + <function class="GtkObject">destroy()</function>. Se a função retornar + <literal>true</literal>, o PHP-GTK irá parar o evento de sinal padrão + que estava rodando até este ponto. É importante saber isto se você + pretende escrever uma função definida pelo usuário no lugar da função + <function class="GtkObject">destroy()</function> - por exemplo, para + produzir uma caixa de diálogo que confirma se o usuário pretende fechar a + janela do aplicativo. </para> <simpara> - It is not strictly necessary to return <literal>false</literal> in order - to connect the <signalname>delete-event</signalname> signal to the - <function class="GtkObject">destroy()</function> method, as this - particular signal returns <literal>false</literal> by default. It is - possible to not specify any behaviour at all for a window's - <signalname>delete-event</signalname> signal, just so long as the - <signalname>destroy</signalname> signal is handled in the correct way, as - it is here. + Não é estritamente necessário retornar <literal>false</literal> + It is not strictly necessary to return <literal>false</literal> para conectar + o sinal <signalname>delete-event</signalname> com o método + <function class="GtkObject">destroy()</function>, mas este sinal em particular + retornar <literal>false</literal> por padrão. É possível não especificar nenhum + comportamento para todos os sinais <signalname>delete-event</signalname> de todas as janelas, + baste ter o sinal de método <signalname>destroy</signalname> no lugar certo, como + ele está aqui. </simpara> <para> <example> - <title>The shutdown() function</title> + <title>A função fechar()</title> <programlisting role="php"> -function shutdown() -{ - print("Shutting down...\n"); - gtk::main_quit(); -} +function fechar() +{ + print("Fechando...\n"); + gtk::main_quit(); +} </programlisting> </example> - The <literal>shutdown()</literal> function is registered as a handler for - the <signalname>destroy</signalname> signal. The function prints the text - <literal>"Shutting down...\n"</literal> to the console and then - calls the static function gtk::<function>main_quit()</function>. + A função <literal>fechar()</literal> é registrada como um evento para o sinal + <signalname>destroy</signalname>. A função imprime o texto + <literal>"Fechando...\n"</literal> para o console e chama a função + gtk::<function>main_quit()</function>. </para> <para> <example> - <title>The hello() function</title> + <title>A função hello()</title> <programlisting role="php"> function hello() { @@ -142,46 +136,43 @@ } </programlisting> </example> - The <literal>hello()</literal> function is registered as a handler for the - <signalname>clicked</signalname> signal on the button. It globalises the - <literal>$window</literal> variable so it can access the instance of - <classname>GtkWindow</classname> created further down the script. It then - prints the text <literal>"Hello World"</literal> to the console - before calling the <function class="GtkObject">destroy()</function> method - on the window, which in turn fires the <signalname>destroy</signalname> - signal, which in turn calls the <literal>shutdown()</literal> function. + A função <literal>hello()</literal> é registrada como um evento para o sinal + <signalname>clicked</signalname> do botão. Ela globaliza a variável + <literal>$window</literal> para que ela possa ser instânciada pela + <classname>GtkWindow</classname> criada para ser usada em todo o script. Com isto + é possível imprimir o texto <literal>"Hello World"</literal> para o console + antes de chamar o método <function class="GtkObject">destroy()</function>, que dispara + o sinal <signalname>destroy</signalname>, que dispara a função <literal>fechar()</literal>. </para> <simpara> - Another way that the <literal>hello()</literal> function would be able to - access the <literal>$window</literal> variable is if the variable were - passed as a - <link linkend="gtk.signals.custom.params">custom parameter</link>. + Outra maneira que a função <literal>hello()</literal> poderia acessar a variável + <literal>$window</literal> era se a variável fosse passa como um + <link linkend="gtk.signals.custom.params">parâmetro customizado</link>. </simpara> <para> <example> - <title>Setting up the Window</title> + <title>Configurando a Janela</title> <programlisting role="php"> $window = &new GtkWindow(); -$window->connect('destroy', 'shutdown'); -$window->connect('delete-event', 'delete_event'); +$window->connect('destroy', 'fechar'); +$window->connect('delete-event', 'deleta_evento'); $window->set_border_width(10); </programlisting> </example> - The next four lines set up the window itself. Firstly we create an - instance of <classname>GtkWindow</classname>. Once this has been done - successfully, we call the <function class="GtkObject">connect()</function> - method from the window in order to register the - <literal>shutdown()</literal> function as the handler for the - <signalname>destroy</signalname> signal and the - <literal>delete_event()</literal> function as the handler for the - <signalname>delete-event</signalname> signal. Finally, we call the - <function class="GtkContainer">set_border_width()</function> function to - set a 10-pixel wide border on the instance of - <classname>GtkWindow</classname> that we just created. + As próximas quatro linhas configurando a janela. Prmeiramente nós criamos a instância + <classname>GtkWindow</classname>. Uma vez criada, ela chama a função + <function class="GtkObject">connect()</function> do método <literal>window</literal> que registra a função + <literal>fechar()</literal> como um método para o sinal + <signalname>destroy</signalname> e a função + <literal>deleta_evento()</literal> como um método para o sinal + <signalname>delete-event</signalname>. Finalmente, nós chamamos a função + <function class="GtkContainer">set_border_width()</function> para setar + a largura da borda em 10-pixel na instância + <classname>GtkWindow</classname> que nós acabamos de criar. </para> <para> <example> - <title>Setting up the Button</title> + <title>Configurando o Botão</title> <programlisting role="php"> $button = &new GtkButton('Hello World!'); $button->connect('clicked', 'hello'); @@ -190,36 +181,35 @@ $window->show_all(); </programlisting> </example> - These three lines of the script create and set up the button. In the first - line of the above code snippet we create a new instance of the - <classname>GtkButton</classname> widget. The argument to the constructor - is the text we want the button to display - in this case - <literal>"Hello World!"</literal>. We then call the - <function class="GtkObject">connect()</function> method to register the - <literal>hello()</literal> function we defined earlier, as the handler for - the <signalname>clicked</signalname> signal. Finally we add the button to - the window we previously created by calling the - <classname>GtkContainer</classname> method - <function class="GtkContainer">add()</function> from our containing - <literal>$window</literal>, and then display everything contained by - <literal>$window</literal> (and its child widget, - <literal>$button</literal>) by calling the - <function class="GtkWidget">show_all()</function> method, also from our - instance of <classname>GtkWindow</classname>. + Estas três linhas do script criam e configuram o botão. Na primeira + linha do código nós criamos o "code snippet" para a nova instância + <classname>GtkButton</classname>. O argumento construtor + do texto que nós queremos mostrar no botão - neste caso + <literal>"Hello World!"</literal>. Nós então chamamos o método + <function class="GtkObject">connect()</function> para registrar a função + <literal>hello()</literal> que nós havíamos definido, como o evento do sinal + <signalname>clicked</signalname>. Finalmente nós adicionamos o botão à janela + que nós havíamos criado anteriormente chamando a função + <function class="GtkContainer">add()</function> do nosso método + <classname>GtkContainer</classname>, a variável + <literal>$window</literal>, então dispara tudo que contém na variável + <literal>$window</literal> (e o child widget, + <literal>$button</literal>) chamando o método + <function class="GtkWidget">show_all()</function>, também definido na nossa instância + <classname>GtkWindow</classname>. </para> <para> <example> - <title>The call to gtk::main</title> + <title>A chamada ao gtk::main</title> <programlisting role="php"> gtk::main(); </programlisting> </example> - The final line of the script calls the static - gtk::<function>main()</function> function. This tells PHP-GTK that we - have finished setting up our interface, and that the main loop can begin - listening for the events fired by user interaction so that the callback - functions we defined earlier can be called and the various actions carried - out. + A última linha do script chama a função estática + gtk::<function>main()</function>. Ela mostra ao PHP-GTK que nós + acabamos nossa interface, e isto dispara o loop principal que começa + a mostrar os eventos disparados pelo usuário interegindo com as funções + que nós definimos. </para> </chapter>
Index: php-gtk-doc/en/tutorials/hellow.xml diff -u php-gtk-doc/en/tutorials/hellow.xml:1.7 php-gtk-doc/en/tutorials/hellow.xml:1.8 --- php-gtk-doc/en/tutorials/hellow.xml:1.7 Sun Jan 20 14:47:45 2002 +++ php-gtk-doc/en/tutorials/hellow.xml Sat Sep 21 17:20:43 2002 @@ -2,71 +2,65 @@ <chapter id="tutorials.hellow"> <title>Hello World Tutorial</title> <simpara> - When you begin to learn a programming language, the first program - you often write is a 'hello world' program. So, just to fit in with - everyone else, the first tutorial in this manual just happens to - be a 'hello world' tutorial! + Quando você começa a aprender uma linguagem, o primeiro programa + que você é ensinado à fazer é o famoso 'hello world'. + Então, somente para não ser diferente de ninguém, o primeiro + tutorial deste manual será o famoso 'hello world'! </simpara> <simpara> - Throughout the tutorials we expect a reasonable grasp of PHP itself. - The tutorials are designed to give the user an idea of how to use - PHP-GTK, and the ideas and techniques behind it. + Através dos tutorias nós esperamos que você já tenha um conhecimento razoável + do PHP. Os tutoriais são feitos para que o usuário possa ter uma idéia + do uso do PHP-GTK, e as idéias e técnicas por trás dele. </simpara> <simpara> - In this tutorial we will create a simple window with the text "Hello - World!" in it. + Neste tutorial você irá criar uma simples janela com o texto "Hello + World!" escrito nela. </simpara> <simpara> - We will start by listing the program and will then explain each line of - the program, giving an overview of a very basic PHP-GTK application. + Nós começaremos mostrando todo o programa e logo após iremos explicar + cada linha do programa, dando uma idéia de como é uma aplicação básica + feita em PHP-GTK. </simpara> <para> <example> - <title>PHP-GTK Hello World Program Listing</title> - <programlisting role="php"> -if (!class_exists('gtk')) { - if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')) - dl('php_gtk.dll'); - else - dl('php_gtk.so'); -} - -function delete_event() -{ - return false; -} - -function shutdown() -{ - print("Shutting down...\n"); - gtk::main_quit(); -} - -function hello() -{ - global $window; - print "Hello World!\n"; - $window->destroy(); -} - -$window = &new GtkWindow(); -$window->connect('destroy', 'shutdown'); -$window->connect('delete-event', 'delete_event'); -$window->set_border_width(10); - -$button = &new GtkButton('Hello World!'); -$button->connect('clicked', 'hello'); -$window->add($button); - -$window->show_all(); - -gtk::main(); + <title>PHP-GTK Hello World</title> + <programlisting role="php"> +if (!class_exists('gtk')) { + if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')) + dl('php_gtk.dll'); + else + dl('php_gtk.so'); + } + function deleta_evento() + { + return false; + } + function fechar() + { + print("Fechando...\n"); + gtk::main_quit(); + } + function hello() + { + global $window; + print "Hello World!\n"; + $window->destroy(); + } + $window = &new GtkWindow(); + $window->connect('destroy', 'fechar'); + $window->connect('delete-event', 'deleta_evento'); + $window->set_border_width(10); + $button = &new GtkButton('Hello World!'); + $button->connect('clicked', 'hello'); + $window->add($button); + $window->show_all(); + gtk::main(); </programlisting> </example> </para> <para> <example> - <title>Loading PHP-GTK</title> + <title>Carregando o PHP-GTK</title> <programlisting role="php"> if (!class_exists('gtk')) { if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')) @@ -76,63 +70,63 @@ } </programlisting> </example> - These first few lines check to see if the PHP-GTK extension is - already available, and loads it if it isn't. This is done by the - <literal>dl('php_gtk.dll');</literal> or - <literal>dl('php_gtk.so');</literal> statements on Windows and Linux - respectively. + Estas primeiras linhas checam se a extensão do PHP-GTK está + disponível, e carrega ela caso não esteja carregada. Isto é feito + pelo uso das funções <literal>dl('php_gtk.dll');</literal> ou + <literal>dl('php_gtk.so');</literal> no Windows e Linux + respectivamente. </para> <para> <example> - <title>The delete_event() function</title> + <title>A função deleta_evento()</title> <programlisting role="php"> -function delete_event() +function deleta_evento() { return false; } </programlisting> </example> - The <literal>delete_event()</literal> function is registered as a handler - (see below) for the <signalname>delete-event</signalname> signal. It - returns <literal>false</literal>, telling PHP-GTK to fire the - event's default signal handler, which in this case is the - <function class="GtkObject">destroy()</function> method. If the function - were to return <literal>true</literal>, PHP-GTK would stop the default - signal handler running at this point. This is useful to know if you need - to write a user-defined function in place of - <function class="GtkObject">destroy()</function> - for example, to - produce a dialog box confirming that the user intends to close down the - application. + A função <literal>deleta_evento()</literal> é registrada como um evento + (veja abaixo) para o sinal <signalname>delete-event</signalname>. Ela + retorna <literal>false</literal>, dizendo ao PHP-GTK para disparar o + evento de sinal padrão, que no nosso caso é o método + <function class="GtkObject">destroy()</function>. Se a função retornar + <literal>true</literal>, o PHP-GTK irá parar o evento de sinal padrão + que estava rodando até este ponto. É importante saber isto se você + pretende escrever uma função definida pelo usuário no lugar da função + <function class="GtkObject">destroy()</function> - por exemplo, para + produzir uma caixa de diálogo que confirma se o usuário pretende fechar a + janela do aplicativo. </para> <simpara> - It is not strictly necessary to return <literal>false</literal> in order - to connect the <signalname>delete-event</signalname> signal to the - <function class="GtkObject">destroy()</function> method, as this - particular signal returns <literal>false</literal> by default. It is - possible to not specify any behaviour at all for a window's - <signalname>delete-event</signalname> signal, just so long as the - <signalname>destroy</signalname> signal is handled in the correct way, as - it is here. + Não é estritamente necessário retornar <literal>false</literal> + It is not strictly necessary to return <literal>false</literal> para conectar + o sinal <signalname>delete-event</signalname> com o método + <function class="GtkObject">destroy()</function>, mas este sinal em particular + retornar <literal>false</literal> por padrão. É possível não especificar nenhum + comportamento para todos os sinais <signalname>delete-event</signalname> de todas as janelas, + baste ter o sinal de método <signalname>destroy</signalname> no lugar certo, como + ele está aqui. </simpara> <para> <example> - <title>The shutdown() function</title> + <title>A função fechar()</title> <programlisting role="php"> -function shutdown() -{ - print("Shutting down...\n"); - gtk::main_quit(); -} +function fechar() +{ + print("Fechando...\n"); + gtk::main_quit(); +} </programlisting> </example> - The <literal>shutdown()</literal> function is registered as a handler for - the <signalname>destroy</signalname> signal. The function prints the text - <literal>"Shutting down...\n"</literal> to the console and then - calls the static function gtk::<function>main_quit()</function>. + A função <literal>fechar()</literal> é registrada como um evento para o sinal + <signalname>destroy</signalname>. A função imprime o texto + <literal>"Fechando...\n"</literal> para o console e chama a função + gtk::<function>main_quit()</function>. </para> <para> <example> - <title>The hello() function</title> + <title>A função hello()</title> <programlisting role="php"> function hello() { @@ -142,46 +136,43 @@ } </programlisting> </example> - The <literal>hello()</literal> function is registered as a handler for the - <signalname>clicked</signalname> signal on the button. It globalises the - <literal>$window</literal> variable so it can access the instance of - <classname>GtkWindow</classname> created further down the script. It then - prints the text <literal>"Hello World"</literal> to the console - before calling the <function class="GtkObject">destroy()</function> method - on the window, which in turn fires the <signalname>destroy</signalname> - signal, which in turn calls the <literal>shutdown()</literal> function. + A função <literal>hello()</literal> é registrada como um evento para o sinal + <signalname>clicked</signalname> do botão. Ela globaliza a variável + <literal>$window</literal> para que ela possa ser instânciada pela + <classname>GtkWindow</classname> criada para ser usada em todo o script. Com isto + é possível imprimir o texto <literal>"Hello World"</literal> para o console + antes de chamar o método <function class="GtkObject">destroy()</function>, que dispara + o sinal <signalname>destroy</signalname>, que dispara a função <literal>fechar()</literal>. </para> <simpara> - Another way that the <literal>hello()</literal> function would be able to - access the <literal>$window</literal> variable is if the variable were - passed as a - <link linkend="gtk.signals.custom.params">custom parameter</link>. + Outra maneira que a função <literal>hello()</literal> poderia acessar a variável + <literal>$window</literal> era se a variável fosse passa como um + <link linkend="gtk.signals.custom.params">parâmetro customizado</link>. </simpara> <para> <example> - <title>Setting up the Window</title> + <title>Configurando a Janela</title> <programlisting role="php"> $window = &new GtkWindow(); -$window->connect('destroy', 'shutdown'); -$window->connect('delete-event', 'delete_event'); +$window->connect('destroy', 'fechar'); +$window->connect('delete-event', 'deleta_evento'); $window->set_border_width(10); </programlisting> </example> - The next four lines set up the window itself. Firstly we create an - instance of <classname>GtkWindow</classname>. Once this has been done - successfully, we call the <function class="GtkObject">connect()</function> - method from the window in order to register the - <literal>shutdown()</literal> function as the handler for the - <signalname>destroy</signalname> signal and the - <literal>delete_event()</literal> function as the handler for the - <signalname>delete-event</signalname> signal. Finally, we call the - <function class="GtkContainer">set_border_width()</function> function to - set a 10-pixel wide border on the instance of - <classname>GtkWindow</classname> that we just created. + As próximas quatro linhas configurando a janela. Prmeiramente nós criamos a instância + <classname>GtkWindow</classname>. Uma vez criada, ela chama a função + <function class="GtkObject">connect()</function> do método <literal>window</literal> que registra a função + <literal>fechar()</literal> como um método para o sinal + <signalname>destroy</signalname> e a função + <literal>deleta_evento()</literal> como um método para o sinal + <signalname>delete-event</signalname>. Finalmente, nós chamamos a função + <function class="GtkContainer">set_border_width()</function> para setar + a largura da borda em 10-pixel na instância + <classname>GtkWindow</classname> que nós acabamos de criar. </para> <para> <example> - <title>Setting up the Button</title> + <title>Configurando o Botão</title> <programlisting role="php"> $button = &new GtkButton('Hello World!'); $button->connect('clicked', 'hello'); @@ -190,36 +181,35 @@ $window->show_all(); </programlisting> </example> - These three lines of the script create and set up the button. In the first - line of the above code snippet we create a new instance of the - <classname>GtkButton</classname> widget. The argument to the constructor - is the text we want the button to display - in this case - <literal>"Hello World!"</literal>. We then call the - <function class="GtkObject">connect()</function> method to register the - <literal>hello()</literal> function we defined earlier, as the handler for - the <signalname>clicked</signalname> signal. Finally we add the button to - the window we previously created by calling the - <classname>GtkContainer</classname> method - <function class="GtkContainer">add()</function> from our containing - <literal>$window</literal>, and then display everything contained by - <literal>$window</literal> (and its child widget, - <literal>$button</literal>) by calling the - <function class="GtkWidget">show_all()</function> method, also from our - instance of <classname>GtkWindow</classname>. + Estas três linhas do script criam e configuram o botão. Na primeira + linha do código nós criamos o "code snippet" para a nova instância + <classname>GtkButton</classname>. O argumento construtor + do texto que nós queremos mostrar no botão - neste caso + <literal>"Hello World!"</literal>. Nós então chamamos o método + <function class="GtkObject">connect()</function> para registrar a função + <literal>hello()</literal> que nós havíamos definido, como o evento do sinal + <signalname>clicked</signalname>. Finalmente nós adicionamos o botão à janela + que nós havíamos criado anteriormente chamando a função + <function class="GtkContainer">add()</function> do nosso método + <classname>GtkContainer</classname>, a variável + <literal>$window</literal>, então dispara tudo que contém na variável + <literal>$window</literal> (e o child widget, + <literal>$button</literal>) chamando o método + <function class="GtkWidget">show_all()</function>, também definido na nossa instância + <classname>GtkWindow</classname>. </para> <para> <example> - <title>The call to gtk::main</title> + <title>A chamada ao gtk::main</title> <programlisting role="php"> gtk::main(); </programlisting> </example> - The final line of the script calls the static - gtk::<function>main()</function> function. This tells PHP-GTK that we - have finished setting up our interface, and that the main loop can begin - listening for the events fired by user interaction so that the callback - functions we defined earlier can be called and the various actions carried - out. + A última linha do script chama a função estática + gtk::<function>main()</function>. Ela mostra ao PHP-GTK que nós + acabamos nossa interface, e isto dispara o loop principal que começa + a mostrar os eventos disparados pelo usuário interegindo com as funções + que nós definimos. </para> </chapter>