Data about a single field in the IndustryCargoesWindow panel. More...
Public Member Functions | |
| void | MakeEmpty (CargoesFieldType type) |
| Make one of the empty fields (CFT_EMPTY or CFT_SMALL_EMPTY). | |
| void | MakeIndustry (IndustryType ind_type) |
| Make an industry type field. | |
| int | ConnectCargo (CargoID cargo, bool producer) |
| Connect a cargo from an industry to the CFT_CARGO column. | |
| bool | HasConnection () |
| Does this CFT_CARGO field have a horizontal connection? | |
| void | MakeCargo (const CargoID *cargoes, uint length, int count=-1, bool top_end=false, bool bottom_end=false) |
| Make a piece of cargo column. | |
| void | MakeCargoLabel (const CargoID *cargoes, uint length, bool left_align) |
| Make a field displaying cargo type names. | |
| void | MakeHeader (StringID textid) |
| Make a header above an industry column. | |
| int | GetCargoBase (int xpos) const |
| For a CFT_CARGO, compute the left position of the left-most vertical cargo connection. | |
| void | Draw (int xpos, int ypos) const |
| Draw the field. | |
| CargoID | CargoClickedAt (const CargoesField *left, const CargoesField *right, Point pt) const |
| Decide which cargo was clicked at in a CFT_CARGO field. | |
| CargoID | CargoLabelClickedAt (Point pt) const |
| Decide what cargo the user clicked in the cargo label field. | |
Data Fields | |
| CargoesFieldType | type |
| Type of field. | |
| union { | |
| struct { | |
| IndustryType ind_type | |
| Industry type (NUM_INDUSTRYTYPES means 'houses'). | |
| CargoID other_produced [MAX_CARGOES] | |
| Cargoes produced but not used in this figure. | |
| CargoID other_accepted [MAX_CARGOES] | |
| Cargoes accepted but not used in this figure. | |
| } industry | |
| Industry data (for CFT_INDUSTRY). | |
| struct { | |
| CargoID vertical_cargoes [MAX_CARGOES] | |
| Cargoes running from top to bottom (cargo ID or INVALID_CARGO). | |
| byte num_cargoes | |
| Number of cargoes. | |
| CargoID supp_cargoes [MAX_CARGOES] | |
| Cargoes entering from the left (index in vertical_cargoes, or INVALID_CARGO). | |
| byte top_end | |
| Stop at the top of the vertical cargoes. | |
| CargoID cust_cargoes [MAX_CARGOES] | |
| Cargoes leaving to the right (index in vertical_cargoes, or INVALID_CARGO). | |
| byte bottom_end | |
| Stop at the bottom of the vertical cargoes. | |
| } cargo | |
| Cargo data (for CFT_CARGO). | |
| struct { | |
| CargoID cargoes [MAX_CARGOES] | |
| Cargoes to display (or INVALID_CARGO). | |
| bool left_align | |
| Align all cargo texts to the left (else align to the right). | |
| } cargo_label | |
| Label data (for CFT_CARGO_LABEL). | |
| StringID header | |
| Header text (for CFT_HEADER). | |
| } | u |
Static Public Attributes | |
| static const int | VERT_INTER_INDUSTRY_SPACE = 6 |
| Amount of space between two industries in a column. | |
| static const int | HOR_CARGO_BORDER_SPACE = 15 |
| Amount of space between the left/right edge of a CFT_CARGO field, and the left/right most vertical cargo. | |
| static const int | CARGO_STUB_WIDTH = 10 |
| Width of a cargo not carried in the column (should be less than HOR_CARGO_BORDER_SPACE). | |
| static const int | HOR_CARGO_WIDTH = 15 |
| Width of a vertical cargo column (inclusive the border line). | |
| static const int | HOR_CARGO_SPACE = 5 |
| Amount of horizontal space between two vertical cargoes. | |
| static const int | CARGO_FIELD_WIDTH = HOR_CARGO_BORDER_SPACE * 2 + HOR_CARGO_WIDTH * MAX_CARGOES + HOR_CARGO_SPACE * (MAX_CARGOES - 1) |
| Width of a CFT_CARGO field. | |
| static const int | VERT_CARGO_SPACE = 4 |
| Amount of vertical space between two connected cargoes at an industry. | |
| static const int | VERT_CARGO_EDGE = 4 |
| Amount of vertical space between top/bottom and the top/bottom connected cargo at an industry. | |
| static const int | BLOB_DISTANCE = 5 |
| Distance of the industry legend colour from the edge of the industry box. | |
| static const int | BLOB_WIDTH = 12 |
| Width of the industry legend colour, including border. | |
| static const int | BLOB_HEIGHT = 9 |
| Height of the industry legend colour, including border. | |
| static const int | INDUSTRY_LINE_COLOUR = 191 |
| Line colour of the industry type box. | |
| static const int | CARGO_LINE_COLOUR = 191 |
| Line colour around the cargo. | |
| static int | small_height |
| Height of the header row. | |
| static int | normal_height |
| Height of the non-header rows. | |
| static int | industry_width |
| Width of an industry field. | |
Static Private Member Functions | |
| static void | DrawHorConnection (int left, int right, int top, const CargoSpec *csp) |
| Draw a horizontal cargo connection. | |
Data about a single field in the IndustryCargoesWindow panel.
Definition at line 1464 of file industry_gui.cpp.
| CargoID CargoesField::CargoClickedAt | ( | const CargoesField * | left, | |
| const CargoesField * | right, | |||
| Point | pt | |||
| ) | const [inline] |
Decide which cargo was clicked at in a CFT_CARGO field.
| left | Left industry neighbour if available (else NULL should be supplied). | |
| right | Right industry neighbour if available (else NULL should be supplied). | |
| pt | Click position in the cargo field. |
Definition at line 1792 of file industry_gui.cpp.
References cargo_label, CFT_CARGO, CFT_CARGO_LABEL, CFT_INDUSTRY, FONT_HEIGHT_NORMAL, GetCargoBase(), HOR_CARGO_SPACE, HOR_CARGO_WIDTH, industry, INVALID_CARGO, type, VERT_CARGO_EDGE, VERT_CARGO_SPACE, and VERT_INTER_INDUSTRY_SPACE.
Referenced by IndustryCargoesWindow::OnClick(), and IndustryCargoesWindow::OnHover().
Decide what cargo the user clicked in the cargo label field.
| pt | Click position in the cargo label field. |
Definition at line 1849 of file industry_gui.cpp.
References CFT_CARGO_LABEL, FONT_HEIGHT_NORMAL, INVALID_CARGO, type, VERT_CARGO_EDGE, VERT_CARGO_SPACE, and VERT_INTER_INDUSTRY_SPACE.
Referenced by IndustryCargoesWindow::OnClick(), and IndustryCargoesWindow::OnHover().
| int CargoesField::ConnectCargo | ( | CargoID | cargo, | |
| bool | producer | |||
| ) | [inline] |
Connect a cargo from an industry to the CFT_CARGO column.
| cargo | Cargo to connect. | |
| produced | Cargo is produced (if false, cargo is assumed to be accepted). |
-1 if not accepted at all. Definition at line 1529 of file industry_gui.cpp.
References CFT_CARGO, INVALID_CARGO, and type.
Referenced by CargoesRow::ConnectIndustryAccepted(), CargoesRow::ConnectIndustryProduced(), and CargoesRow::MakeCargoLabel().
| void CargoesField::Draw | ( | int | xpos, | |
| int | ypos | |||
| ) | const [inline] |
Draw the field.
| xpos | Position of the left edge. | |
| vpos | Position of the top edge. |
Definition at line 1645 of file industry_gui.cpp.
References _current_text_dir, BLOB_DISTANCE, BLOB_HEIGHT, BLOB_WIDTH, CARGO_FIELD_WIDTH, CARGO_LINE_COLOUR, CARGO_STUB_WIDTH, CFT_CARGO, CFT_CARGO_LABEL, CFT_EMPTY, CFT_HEADER, CFT_INDUSTRY, CFT_SMALL_EMPTY, DrawHorConnection(), DrawString(), FILLRECT_OPAQUE, FONT_HEIGHT_NORMAL, CargoSpec::Get(), GetCargoBase(), GetIndustrySpec(), GfxFillRect(), HOR_CARGO_SPACE, HOR_CARGO_WIDTH, INDUSTRY_LINE_COLOUR, industry_width, INVALID_CARGO, IndustrySpec::map_colour, CargoSpec::name, IndustrySpec::name, normal_height, NUM_INDUSTRYTYPES, SA_HOR_CENTER, SA_LEFT, SA_RIGHT, SetDParam(), small_height, TD_RTL, type, VERT_CARGO_EDGE, VERT_CARGO_SPACE, VERT_INTER_INDUSTRY_SPACE, WD_FRAMERECT_LEFT, and WD_FRAMERECT_RIGHT.
| static void CargoesField::DrawHorConnection | ( | int | left, | |
| int | right, | |||
| int | top, | |||
| const CargoSpec * | csp | |||
| ) | [inline, static, private] |
Draw a horizontal cargo connection.
| left | Left-most coordinate to draw. | |
| right | Right-most coordinate to draw. | |
| top | Top coordinate of the cargo connection. Cargo to draw. |
Definition at line 1872 of file industry_gui.cpp.
References CARGO_LINE_COLOUR, FILLRECT_OPAQUE, FONT_HEIGHT_NORMAL, and GfxFillRect().
Referenced by Draw().
| int CargoesField::GetCargoBase | ( | int | xpos | ) | const [inline] |
For a CFT_CARGO, compute the left position of the left-most vertical cargo connection.
| xpos | Left position of the field. |
Definition at line 1627 of file industry_gui.cpp.
References CARGO_FIELD_WIDTH, CFT_CARGO, HOR_CARGO_SPACE, HOR_CARGO_WIDTH, and type.
Referenced by CargoClickedAt(), and Draw().
| bool CargoesField::HasConnection | ( | ) | [inline] |
Does this CFT_CARGO field have a horizontal connection?
true if a horizontal connection exists, false otherwise. Definition at line 1558 of file industry_gui.cpp.
References CFT_CARGO, INVALID_CARGO, and type.
| void CargoesField::MakeCargo | ( | const CargoID * | cargoes, | |
| uint | length, | |||
| int | count = -1, |
|||
| bool | top_end = false, |
|||
| bool | bottom_end = false | |||
| ) | [inline] |
Make a piece of cargo column.
| cargoes | Array of CargoID (may contain INVALID_CARGO). | |
| length | Number of cargoes in cargoes. | |
| count | Number of cargoes to display (should be at least the number of valid cargoes, or -1 to let the method compute it). | |
| top_end | This is the first cargo field of this column. | |
| bottom_end | This is the last cargo field of this column. |
Definition at line 1578 of file industry_gui.cpp.
References bottom_end, INVALID_CARGO, MemSetT(), top_end, and type.
Referenced by IndustryCargoesWindow::ComputeCargoDisplay(), and IndustryCargoesWindow::ComputeIndustryDisplay().
| void CargoesField::MakeCargoLabel | ( | const CargoID * | cargoes, | |
| uint | length, | |||
| bool | left_align | |||
| ) | [inline] |
Make a field displaying cargo type names.
| cargoes | Array of CargoID (may contain INVALID_CARGO). | |
| length | Number of cargoes in cargoes. | |
| left_align | ALign texts to the left (else to the right). |
Definition at line 1603 of file industry_gui.cpp.
References INVALID_CARGO, and type.
Referenced by CargoesRow::MakeCargoLabel().
| void CargoesField::MakeEmpty | ( | CargoesFieldType | type | ) | [inline] |
Make one of the empty fields (CFT_EMPTY or CFT_SMALL_EMPTY).
| type | Type of empty field. |
Definition at line 1505 of file industry_gui.cpp.
Referenced by IndustryCargoesWindow::ComputeCargoDisplay(), and IndustryCargoesWindow::ComputeIndustryDisplay().
| void CargoesField::MakeHeader | ( | StringID | textid | ) | [inline] |
Make a header above an industry column.
| textid | Text to display. |
Definition at line 1616 of file industry_gui.cpp.
References type.
Referenced by IndustryCargoesWindow::ComputeCargoDisplay(), and IndustryCargoesWindow::ComputeIndustryDisplay().
| void CargoesField::MakeIndustry | ( | IndustryType | ind_type | ) | [inline] |
Make an industry type field.
| ind_type | Industry type (NUM_INDUSTRYTYPES means 'houses'). |
Definition at line 1515 of file industry_gui.cpp.
References INVALID_CARGO, MemSetT(), and type.
const int CargoesField::CARGO_FIELD_WIDTH = HOR_CARGO_BORDER_SPACE * 2 + HOR_CARGO_WIDTH * MAX_CARGOES + HOR_CARGO_SPACE * (MAX_CARGOES - 1) [static] |
Width of a CFT_CARGO field.
Definition at line 1469 of file industry_gui.cpp.
Referenced by Draw(), and GetCargoBase().
1.7.1