CrossPlatform GUI Programming with wxWidgets [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

CrossPlatform GUI Programming with wxWidgets [Electronic resources] - نسخه متنی

Julian Smart; Kevin Hock; Stefan Csomor

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید











  • Static Controls


    Static controls do not take any input and are used to display information or to enhance the application's aesthetics.

    wxGauge


    This is a horizontal or vertical bar that shows a quantity (often time) from zero to the specified range. No command events are generated for the gauge. Here's a simple example of creating a gauge:


    #include "wx/gauge.h"
    wxGauge* gauge = new wxGauge(panel, ID_GAUGE,
    200, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL);
    gauge->SetValue(50);

    Under Windows, this is displayed as shown in Figure 4-28.

    Figure 4-28. A wxGauge

    wxGauge Styles

    Table 4-42 lists the specific window styles for wxGauge.

    Table 4-42. wxGauge Styles

    wxGA_HORIZONTAL

    Creates a horizontal gauge.

    wxGA_VERTICAL

    Creates a vertical gauge.

    wxGA_SMOOTH

    Creates a smooth progress bar with no spaces between steps. This is only supported on Windows.

    wxGauge Events

    Because it only displays information, wxGauge does not generate events.

    wxGauge Member Functions

    These are the major wxGauge functions.

    GeTRange and SetRange are accessors for the gauge range (the maximum integer value).

    GetValue and SetValue get and set the integer value of the gauge.

    IsVertical returns TRue if the gauge is vertical, and false if horizontal.

    wxStaticText


    A static text control displays one or more lines of read-only text.

    To create a wxStaticText control, pass a parent window, identifier, label, position, size, and style. For example:


    #include "wx/stattext.h"
    wxStaticText* staticText = new wxStaticText(panel, wxID_STATIC,
    wxT("This is my &static label"),
    wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);

    Under Windows, this creates the control shown in Figure 4-29.

    Figure 4-29. A wxStaticText

    An ampersand in the label (as shown here) indicates to some platformscurrently Windows and GTK+that the following letter should be underscored and used as a shortcut key for navigating to the next non-static control.

    wxStaticText Styles

    Table 4-43 lists the specific window styles for wxStaticText.

    Table 4-43. wxStaticText Styles

    wxALIGN_LEFT

    Aligns the text to the left.

    wxALIGN_RIGHT

    Aligns the text to the right.

    wxALIGN_CENTRE

    Centers the text horizontally. wxALIGN_CENTER

    wxST_NO_AUTORESIZE

    By default, the control will adjust its size to exactly fit the size of the text when SetLabel is called. If this style is given, the control will not change its size. This style is especially useful with controls that also have wxALIGN_RIGHT or wxALIGN_CENTER because otherwise they won't make sense any longer after a call to SetLabel.

    wxStaticText Member Functions

    GetLabel and SetLabel are accessors for the text label.

    wxStaticBitmap


    A static bitmap control displays an image.

    To create a wxStaticBitmap control, pass a parent window, identifier, bitmap, position, size and style. For example:


    #include "wx/statbmp.h"
    #include "print.xpm"
    wxBitmap bitmap(print_xpm);
    wxStaticBitmap* staticBitmap = new wxStaticBitmap(panel, wxID_STATIC,
    bitmap);

    This produces a simple image on the panel or dialog as shown in Figure 4-30.

    Figure 4-30. A wxStaticBitmap

    wxStaticBitmap Styles

    There are no special styles for wxStaticBitmap.

    wxStaticBitmap Member Functions

    GetBitmap and SetBitmap are accessors for the bitmap label.

    wxStaticLine


    This control displays a horizontal or vertical line, to be used as a separator in dialogs.

    Here's an example of creating a wxStaticLine control:


    #include "wx/statline.h"
    wxStaticLine* staticLine = new wxStaticLine(panel, wxID_STATIC,
    wxDefaultPosition, wxSize(150, -1), wxLI_HORIZONTAL);

    Figure 4-31 shows what a horizontal static line looks like under Windows.

    Figure 4-31. A wxStaticLine

    wxStaticLine Styles

    Table 4-44 lists the specific window styles for wxStaticLine.

    Table 4-44. wxStaticLine Styles

    wxLI_HORIZONTAL

    Creates a horizontal line.

    wxLI_VERTICAL

    Creates a vertical line.

    wxStaticLine Member Functions

    IsVertical returns true if the line is vertical, false otherwise.

    wxStaticBox


    This control is a rectangle drawn around other controls to denote a logical grouping of items, with an optional text label. At present, the control should not be used as a parent for further controls; the controls that it surrounds are actually siblings of the box and should be created after it but with the same parent as the box. Future versions of wxWidgets may allow contained controls to be either siblings or children.

    Here's an example of creating a wxStaticBox control:


    #include "wx/statbox.h"
    wxStaticBox* staticBox = new wxStaticBox(panel, wxID_STATIC,
    wxT("&Static box"), wxDefaultPosition, wxSize(100, 100));

    This will look like the control in Figure 4-32 under Windows.

    Figure 4-32. A wxStaticBox

    wxStaticBox Styles

    There are no special styles for wxStaticBox.

    wxStaticBox Member Functions

    Use GetLabel and SetLabel to get and set the static box text.

  • / 261